Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 from page_sets.system_health import platforms | 5 from page_sets.system_health import platforms |
| 6 from page_sets.system_health import story_tags | 6 from page_sets.system_health import story_tags |
| 7 from page_sets.system_health import system_health_story | 7 from page_sets.system_health import system_health_story |
| 8 from page_sets.system_health.loading_stories import LoadGmailMobileStory | 8 from page_sets.system_health.loading_stories import LoadGmailMobileStory |
| 9 | 9 |
| 10 from telemetry import decorators | 10 from telemetry import decorators |
| 11 | 11 |
| 12 _WAIT_FOR_VIDEO_SECONDS = 5 | 12 _WAIT_FOR_VIDEO_SECONDS = 5 |
| 13 | 13 |
| 14 class _BackgroundStory(system_health_story.SystemHealthStory): | 14 class _BackgroundStory(system_health_story.SystemHealthStory): |
| 15 """Abstract base class for background stories | 15 """Abstract base class for background stories |
| 16 | 16 |
| 17 As in _LoadingStory except it puts the browser into the | 17 As in _LoadingStory except it puts the browser into the |
| 18 background before measuring. | 18 background before measuring. |
| 19 """ | 19 """ |
| 20 ABSTRACT_STORY = True | 20 ABSTRACT_STORY = True |
| 21 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 21 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 22 | 22 |
| 23 def _Measure(self, action_runner): | 23 def _Measure(self, action_runner): |
| 24 action_runner.tab.browser.Background() | 24 action_runner.tab.browser.Background() |
| 25 super(_BackgroundStory, self)._Measure(action_runner) | 25 super(_BackgroundStory, self)._Measure(action_runner) |
| 26 | 26 |
| 27 @classmethod | |
| 28 def GenerateStoryDescription(cls): | |
| 29 return 'Load %s, then put the Chrome browser into the background.' % cls.URL | |
|
perezju
2017/05/19 13:48:29
nit: "put the Chrome browser" --> "put the browser
nednguyen
2017/05/19 15:07:50
Done.
| |
| 30 | |
| 27 | 31 |
| 28 class BackgroundGoogleStory(_BackgroundStory): | 32 class BackgroundGoogleStory(_BackgroundStory): |
| 29 NAME = 'background:search:google' | 33 NAME = 'background:search:google' |
| 30 URL = 'https://www.google.co.uk/#q=tom+cruise+movies' | 34 URL = 'https://www.google.co.uk/#q=tom+cruise+movies' |
| 31 | 35 |
| 32 def _DidLoadDocument(self, action_runner): | 36 def _DidLoadDocument(self, action_runner): |
| 33 # Activte the immersive movie browsing experience | 37 # Activte the immersive movie browsing experience |
| 34 action_runner.WaitForElement(selector='g-fab') | 38 action_runner.WaitForElement(selector='g-fab') |
| 35 action_runner.ScrollPageToElement(selector='g-fab') | 39 action_runner.ScrollPageToElement(selector='g-fab') |
| 36 action_runner.TapElement(selector='g-fab') | 40 action_runner.TapElement(selector='g-fab') |
| 37 | 41 |
| 38 | 42 |
| 39 class BackgroundFacebookMobileStory(_BackgroundStory): | 43 class BackgroundFacebookMobileStory(_BackgroundStory): |
| 40 NAME = 'background:social:facebook' | 44 NAME = 'background:social:facebook' |
| 41 URL = 'https://www.facebook.com/rihanna' | 45 URL = 'https://www.facebook.com/rihanna' |
| 42 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 46 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 43 | 47 |
| 44 | 48 |
| 45 class BackgroundNytimesMobileStory(_BackgroundStory): | 49 class BackgroundNytimesMobileStory(_BackgroundStory): |
| 46 """The third top website in http://www.alexa.com/topsites/category/News""" | |
| 47 NAME = 'background:news:nytimes' | 50 NAME = 'background:news:nytimes' |
| 48 URL = 'http://www.nytimes.com/2016/10/04/us/politics/vice-presidential-debate. html?_r=0' | 51 URL = 'http://www.nytimes.com/2016/10/04/us/politics/vice-presidential-debate. html?_r=0' |
| 49 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 52 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 50 TAGS = [story_tags.JAVASCRIPT_HEAVY] | 53 TAGS = [story_tags.JAVASCRIPT_HEAVY] |
| 51 | 54 |
| 52 def _DidLoadDocument(self, action_runner): | 55 def _DidLoadDocument(self, action_runner): |
| 53 # Dismiss the 'You have n free articles' message. | 56 # Dismiss the 'You have n free articles' message. |
| 54 action_runner.WaitForElement(selector='.growl-dismiss') | 57 action_runner.WaitForElement(selector='.growl-dismiss') |
| 55 action_runner.TapElement(selector='.growl-dismiss') | 58 action_runner.TapElement(selector='.growl-dismiss') |
| 56 | 59 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 81 | 84 |
| 82 | 85 |
| 83 @decorators.Disabled('android') # crbug.com/676336 | 86 @decorators.Disabled('android') # crbug.com/676336 |
| 84 class BackgroundGmailMobileStory(LoadGmailMobileStory): | 87 class BackgroundGmailMobileStory(LoadGmailMobileStory): |
| 85 NAME = 'background:tools:gmail' | 88 NAME = 'background:tools:gmail' |
| 86 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 89 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 87 | 90 |
| 88 def _Measure(self, action_runner): | 91 def _Measure(self, action_runner): |
| 89 action_runner.tab.browser.Background() | 92 action_runner.tab.browser.Background() |
| 90 super(BackgroundGmailMobileStory, self)._Measure(action_runner) | 93 super(BackgroundGmailMobileStory, self)._Measure(action_runner) |
| OLD | NEW |