OLD | NEW |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import py_utils | 5 import py_utils |
6 import logging | 6 import logging |
7 | 7 |
8 from page_sets.system_health import system_health_story | 8 from page_sets.system_health import system_health_story |
9 from page_sets.system_health import story_tags | 9 from page_sets.system_health import story_tags |
10 from page_sets.system_health import platforms | 10 from page_sets.system_health import platforms |
11 | 11 |
12 from telemetry import benchmark | 12 from telemetry import benchmark |
13 | 13 |
14 | 14 |
15 class MultiTabStory(system_health_story.SystemHealthStory): | 15 class MultiTabStory(system_health_story.SystemHealthStory): |
16 ABSTRACT_STORY = True | 16 ABSTRACT_STORY = True |
17 | 17 |
| 18 def __init__(self, story_set, take_memory_measurement): |
| 19 super(MultiTabStory, self).__init__(story_set, take_memory_measurement) |
| 20 self._pageset_repeat = 1 |
| 21 |
| 22 def Run(self, shared_state): |
| 23 finder_options = getattr(shared_state, '_finder_options') |
| 24 self._pageset_repeat = finder_options.pageset_repeat |
| 25 super(MultiTabStory, self).Run(shared_state) |
| 26 |
18 def RunNavigateSteps(self, action_runner): | 27 def RunNavigateSteps(self, action_runner): |
19 tabs = action_runner.tab.browser.tabs | 28 tabs = action_runner.tab.browser.tabs |
20 | 29 |
21 # No need to create the first tab as there is already one | 30 # If this is the first pageset, don't have to create the first tab |
22 # when the browser is ready, | 31 # as there is already one when the browser is ready, |
23 if self.URL_LIST: | 32 for i, url in enumerate(self.URL_LIST): |
24 action_runner.Navigate(self.URL_LIST[0]) | 33 if i == 0 and len(action_runner.tab.browser.tabs) == 1: |
25 for url in self.URL_LIST[1:]: | 34 action_runner.Navigate(url) |
26 new_tab = tabs.New() | 35 else: |
27 new_tab.action_runner.Navigate(url) | 36 new_tab = tabs.New() |
| 37 new_tab.action_runner.Navigate(url) |
28 | 38 |
29 for i, url in enumerate(self.URL_LIST): | 39 for i, url in enumerate(self.URL_LIST): |
30 try: | 40 try: |
31 tabs[i].action_runner.WaitForNetworkQuiescence() | 41 tabs[i].action_runner.WaitForNetworkQuiescence() |
32 except py_utils.TimeoutException: | 42 except py_utils.TimeoutException: |
33 logging.warning('WaitForNetworkQuiescence() timeout, url[%d]: %s' | 43 logging.warning('WaitForNetworkQuiescence() timeout, url[%d]: %s' |
34 % (i, url)) | 44 % (i, url)) |
35 | 45 |
36 def RunPageInteractions(self, action_runner): | 46 def RunPageInteractions(self, action_runner): |
| 47 # if tab switching on every pageset, the metrics data would be a mix of |
| 48 # tab switching on different tab counts and is hard to analyze. only |
| 49 # tab switching on the last pageset |
| 50 if self._pageset_repeat != 1 and len(action_runner.tab.browser.tabs) != \ |
| 51 len(self.URL_LIST) * self._pageset_repeat: |
| 52 return |
| 53 |
37 for tab in action_runner.tab.browser.tabs: | 54 for tab in action_runner.tab.browser.tabs: |
38 tab.Activate() | 55 tab.Activate() |
39 tab.WaitForFrameToBeDisplayed() | 56 tab.WaitForFrameToBeDisplayed() |
40 | 57 |
41 | 58 |
42 @benchmark.Disabled('all') # crbug.com/704197 | 59 @benchmark.Disabled('all') # crbug.com/704197 |
43 class MultiTabTypical24Story(MultiTabStory): | 60 class MultiTabTypical24Story(MultiTabStory): |
44 NAME = 'multitab:misc:typical24' | 61 NAME = 'multitab:misc:typical24' |
45 TAGS = [story_tags.TABS_SWITCHING] | 62 TAGS = [story_tags.TABS_SWITCHING] |
46 URL_LIST = [ | 63 URL_LIST = [ |
(...skipping 28 matching lines...) Expand all Loading... |
75 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), | 92 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), |
76 # pylint: disable=line-too-long | 93 # pylint: disable=line-too-long |
77 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-in-
the-world', | 94 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-in-
the-world', |
78 'http://www.airbnb.com/', | 95 'http://www.airbnb.com/', |
79 'http://www.ign.com/', | 96 'http://www.ign.com/', |
80 # Why: Alexa health #25 | 97 # Why: Alexa health #25 |
81 'http://www.fda.gov', | 98 'http://www.fda.gov', |
82 ] | 99 ] |
83 URL = URL_LIST[0] | 100 URL = URL_LIST[0] |
84 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 101 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
OLD | NEW |