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 | 12 |
| 13 class _MultiTabStory(system_health_story.SystemHealthStory): | 13 class MultiTabStory(system_health_story.SystemHealthStory): |
|
vovoy
2017/03/24 16:35:30
export MultiTabStory for testing
| |
| 14 ABSTRACT_STORY = True | 14 ABSTRACT_STORY = True |
| 15 | 15 |
| 16 def RunNavigateSteps(self, action_runner): | 16 def RunNavigateSteps(self, action_runner): |
| 17 tabs = action_runner.tab.browser.tabs | 17 tabs = action_runner.tab.browser.tabs |
| 18 | 18 |
| 19 # No need to create the first tab as there is already one | 19 # No need to create the first tab as there is already one |
| 20 # when the browser is ready, | 20 # when the browser is ready, |
| 21 if self.URL_LIST: | 21 if self.URL_LIST: |
| 22 action_runner.Navigate(self.URL_LIST[0]) | 22 action_runner.Navigate(self.URL_LIST[0]) |
| 23 for url in self.URL_LIST[1:]: | 23 for url in self.URL_LIST[1:]: |
| 24 new_tab = tabs.New() | 24 new_tab = tabs.New() |
| 25 new_tab.action_runner.Navigate(url) | 25 new_tab.action_runner.Navigate(url) |
| 26 | 26 |
| 27 for i, url in enumerate(self.URL_LIST): | 27 for i, url in enumerate(self.URL_LIST): |
| 28 try: | 28 try: |
| 29 tabs[i].action_runner.WaitForNetworkQuiescence() | 29 tabs[i].action_runner.WaitForNetworkQuiescence() |
| 30 except py_utils.TimeoutException: | 30 except py_utils.TimeoutException: |
| 31 logging.warning('WaitForNetworkQuiescence() timeout, url[%d]: %s' | 31 logging.warning('WaitForNetworkQuiescence() timeout, url[%d]: %s' |
| 32 % (i, url)) | 32 % (i, url)) |
| 33 | 33 |
| 34 def RunPageInteractions(self, action_runner): | 34 def RunPageInteractions(self, action_runner): |
| 35 for tab in action_runner.tab.browser.tabs: | 35 for tab in action_runner.tab.browser.tabs: |
| 36 tab.Activate() | 36 tab.Activate() |
| 37 tab.WaitForFrameToBeDisplayed() | 37 tab.WaitForFrameToBeDisplayed() |
| 38 | 38 |
| 39 | 39 |
| 40 class MultiTabTypical24Story(_MultiTabStory): | 40 class MultiTabTypical24Story(MultiTabStory): |
| 41 NAME = 'multitab:misc:typical24' | 41 NAME = 'multitab:misc:typical24' |
| 42 TAGS = [story_tags.TABS_SWITCHING] | 42 TAGS = [story_tags.TABS_SWITCHING] |
| 43 URL_LIST = [ | 43 URL_LIST = [ |
| 44 # Why: Alexa games #48 | 44 # Why: Alexa games #48 |
| 45 'http://www.nick.com/games', | 45 'http://www.nick.com/games', |
| 46 # Why: Alexa sports #45 | 46 # Why: Alexa sports #45 |
| 47 'http://www.rei.com/', | 47 'http://www.rei.com/', |
| 48 # Why: Alexa sports #50 | 48 # Why: Alexa sports #50 |
| 49 'http://www.fifa.com/', | 49 'http://www.fifa.com/', |
| 50 # Why: Alexa shopping #41 | 50 # Why: Alexa shopping #41 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 72 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), | 72 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), |
| 73 # pylint: disable=line-too-long | 73 # pylint: disable=line-too-long |
| 74 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-in- the-world', | 74 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-in- the-world', |
| 75 'http://www.airbnb.com/', | 75 'http://www.airbnb.com/', |
| 76 'http://www.ign.com/', | 76 'http://www.ign.com/', |
| 77 # Why: Alexa health #25 | 77 # Why: Alexa health #25 |
| 78 'http://www.fda.gov', | 78 'http://www.fda.gov', |
| 79 ] | 79 ] |
| 80 URL = URL_LIST[0] | 80 URL = URL_LIST[0] |
| 81 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 81 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| OLD | NEW |