1# Copyright 2017 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import logging 6 7import py_utils 8 9from page_sets.system_health import system_health_story 10from page_sets.system_health import story_tags 11from page_sets.system_health import platforms 12 13 14class MultiTabStory(system_health_story.SystemHealthStory): 15 ABSTRACT_STORY = True 16 17 def __init__(self, story_set, take_memory_measurement, tabset_repeat=1): 18 super(MultiTabStory, self).__init__(story_set, take_memory_measurement) 19 self._tabset_repeat = tabset_repeat 20 21 def RunNavigateSteps(self, action_runner): 22 tabs = action_runner.tab.browser.tabs 23 24 # No need to create the first tab as there is already one 25 # when the browser is ready, 26 url_list = self.URL_LIST * self._tabset_repeat 27 if url_list: 28 action_runner.Navigate(url_list[0]) 29 for url in url_list[1:]: 30 new_tab = tabs.New() 31 new_tab.action_runner.Navigate(url) 32 33 for i, url in enumerate(url_list): 34 try: 35 tabs[i].action_runner.WaitForNetworkQuiescence() 36 except py_utils.TimeoutException: 37 logging.warning('WaitForNetworkQuiescence() timeout, url[%d]: %s' 38 % (i, url)) 39 40 def _DidLoadDocument(self, action_runner): 41 for tab in action_runner.tab.browser.tabs: 42 tab.Activate() 43 tab.WaitForFrameToBeDisplayed() 44 45 46class MultiTabTypical24Story(MultiTabStory): 47 """Load 24 different web sites in 24 tabs, then cycle through each tab.""" 48 NAME = 'multitab:misc:typical24' 49 TAGS = [story_tags.TABS_SWITCHING, story_tags.YEAR_2016] 50 URL_LIST = [ 51 # Why: Alexa games #48 52 'http://www.nick.com/games', 53 # Why: Alexa sports #45 54 'http://www.rei.com/', 55 # Why: Alexa sports #50 56 'http://www.fifa.com/', 57 # Why: Alexa shopping #41 58 'http://www.gamestop.com/ps3', 59 # Why: Alexa news #55 60 ('http://www.economist.com/news/science-and-technology/21573529-small-' 61 'models-cosmic-phenomena-are-shedding-light-real-thing-how-build'), 62 # Why: Alexa news #67 63 'http://www.theonion.com', 64 'http://arstechnica.com/', 65 # Why: Alexa home #10 66 'http://allrecipes.com/Recipe/Pull-Apart-Hot-Cross-Buns/Detail.aspx', 67 'http://www.html5rocks.com/en/', 68 'http://www.mlb.com/', 69 'http://gawker.com/5939683/based-on-a-true-story-is-a-rotten-lie-i-hope-you-never-believe', 70 'http://www.imdb.com/title/tt0910970/', 71 'http://www.flickr.com/search/?q=monkeys&f=hp', 72 'http://money.cnn.com/', 73 'http://www.nationalgeographic.com/', 74 'http://premierleague.com', 75 'http://www.osubeavers.com/', 76 'http://walgreens.com', 77 'http://colorado.edu', 78 ('http://www.ticketmaster.com/JAY-Z-and-Justin-Timberlake-tickets/artist/' 79 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), 80 # pylint: disable=line-too-long 81 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-in-the-world', 82 'http://www.airbnb.com/', 83 'http://www.ign.com/', 84 # Why: Alexa health #25 85 'http://www.fda.gov', 86 ] 87 URL = URL_LIST[0] 88 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY 89 90 91class MultiTabTypical24Story2018(MultiTabStory): 92 """Load 24 different web sites in 24 tabs, then cycle through each tab.""" 93 NAME = 'multitab:misc:typical24:2018' 94 TAGS = [story_tags.TABS_SWITCHING, story_tags.YEAR_2018, 95 story_tags.INTERNATIONAL] 96 URL_LIST = [ 97 # Why: Top Site Africa 98 'https://www.nairaland.com/?', 99 'https://www.jumia.com.ng', 100 101 # Why: Top Site Asia 102 ('https://activity.alibaba.com/sale/Super-September/' 103 'machinery.html?spm=a2700.8293689.procates.4.46ce65aa0eZF5r'), 104 'https://www.flipkart.com/', 105 ('https://www.indiatimes.com/technology/science-and-future/' 106 'how-spacex-s-trip-around-the-moon-can-make-the-tourists-sick-or-even' 107 '-give-them-a-heart-attack-353365.html'), 108 109 # Why: Top Site Caribbean 110 'https://www.clasificadosonline.com/Miscellaneous.asp', 111 'http://guardian.co.tt/', 112 113 # Why: Top Site Central America 114 'https://www.copaair.com/en/web/us', 115 'http://www.ticotimes.net', 116 117 # Why: Top Site Europe 118 'https://poker.bet365.com/home/ro/', 119 'https://www.asos.com/se/kvinna/?r=1', 120 'https://www.thesun.co.uk/', 121 122 # Why: Top Site Middle East 123 'https://www.irib.ir/', 124 'https://www.qatarliving.com', 125 'https://www.aljazeera.com/', 126 127 # Why: Top Site North America 128 'https://www.nih.gov/', 129 ('https://www.walmart.com/browse/2637_615760?cat_id=2637_615760_1088766_' 130 '1054039&povid=615760+%7C+2018-08-31+%7C+Kids%20Costumes%20POV'), 131 'https://weather.com/', 132 133 # Why: Top Site Oceania 134 'http://www.abc.net.au/', 135 ('https://www.seek.com.au/jobs-in-consulting-strategy?highpay=True&' 136 'salaryrange=150000-999999&salarytype=annual'), 137 'https://www.westpac.com.au/', 138 139 # Why: Top Site South America 140 'http://brasil.gov.br', 141 'http://www.b3.com.br/pt_br/', 142 'https://www.visitchile.com/es/circuitos/' 143 ] 144 URL = URL_LIST[0] 145 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY 146