Chromium Code Reviews| 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 |
|
perezju
2017/04/21 11:59:48
nit: add a blank like in between
vovoy
2017/04/24 16:43:49
Done.
| |
| 17 def __init__(self, story_set, take_memory_measurement, tabset_repeat = 1): | |
|
perezju
2017/04/21 11:59:48
nit: spacing, should be tabset_repeat=1
vovoy
2017/04/24 16:43:49
Done.
| |
| 18 super(MultiTabStory, self).__init__(story_set, take_memory_measurement) | |
| 19 self._tabset_repeat = tabset_repeat | |
| 17 | 20 |
| 18 def RunNavigateSteps(self, action_runner): | 21 def RunNavigateSteps(self, action_runner): |
| 19 tabs = action_runner.tab.browser.tabs | 22 tabs = action_runner.tab.browser.tabs |
| 20 | 23 |
| 21 # No need to create the first tab as there is already one | 24 # No need to create the first tab as there is already one |
| 22 # when the browser is ready, | 25 # when the browser is ready, |
| 23 if self.URL_LIST: | 26 url_list = self.URL_LIST * self._tabset_repeat |
| 24 action_runner.Navigate(self.URL_LIST[0]) | 27 if url_list: |
| 25 for url in self.URL_LIST[1:]: | 28 action_runner.Navigate(url_list[0]) |
| 29 for url in url_list[1:]: | |
| 26 new_tab = tabs.New() | 30 new_tab = tabs.New() |
| 27 new_tab.action_runner.Navigate(url) | 31 new_tab.action_runner.Navigate(url) |
| 28 | 32 |
| 29 for i, url in enumerate(self.URL_LIST): | 33 for i, url in enumerate(url_list): |
| 30 try: | 34 try: |
| 31 tabs[i].action_runner.WaitForNetworkQuiescence() | 35 tabs[i].action_runner.WaitForNetworkQuiescence() |
| 32 except py_utils.TimeoutException: | 36 except py_utils.TimeoutException: |
| 33 logging.warning('WaitForNetworkQuiescence() timeout, url[%d]: %s' | 37 logging.warning('WaitForNetworkQuiescence() timeout, url[%d]: %s' |
| 34 % (i, url)) | 38 % (i, url)) |
| 35 | 39 |
| 36 def RunPageInteractions(self, action_runner): | 40 def RunPageInteractions(self, action_runner): |
| 37 for tab in action_runner.tab.browser.tabs: | 41 for tab in action_runner.tab.browser.tabs: |
| 38 tab.Activate() | 42 tab.Activate() |
| 39 tab.WaitForFrameToBeDisplayed() | 43 tab.WaitForFrameToBeDisplayed() |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), | 79 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), |
| 76 # pylint: disable=line-too-long | 80 # pylint: disable=line-too-long |
| 77 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-in- the-world', | 81 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-in- the-world', |
| 78 'http://www.airbnb.com/', | 82 'http://www.airbnb.com/', |
| 79 'http://www.ign.com/', | 83 'http://www.ign.com/', |
| 80 # Why: Alexa health #25 | 84 # Why: Alexa health #25 |
| 81 'http://www.fda.gov', | 85 'http://www.fda.gov', |
| 82 ] | 86 ] |
| 83 URL = URL_LIST[0] | 87 URL = URL_LIST[0] |
| 84 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 88 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| OLD | NEW |