Chromium Code Reviews| Index: tools/perf/page_sets/system_health/background_stories.py |
| diff --git a/tools/perf/page_sets/system_health/background_stories.py b/tools/perf/page_sets/system_health/background_stories.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..69db9570c86044b1b1cda069f753559f6de714e7 |
| --- /dev/null |
| +++ b/tools/perf/page_sets/system_health/background_stories.py |
| @@ -0,0 +1,60 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from page_sets.system_health import platforms |
| +from page_sets.system_health.loading_stories import _LoadingStory |
| +from page_sets.system_health.loading_stories import _LoadGmailBaseStory |
| + |
| +class _BackgroundStoryMixin(object): |
| + """Mixin class for background stories |
| + |
| + Overrides _Measure to put the browser into the background before measuring. |
| + """ |
| + |
| + def _Measure(self, action_runner): |
| + action_runner.tab.browser.Background() |
| + super(_BackgroundStoryMixin, self)._Measure(action_runner) |
| + |
| + |
| +class BackgroundGoogleStory(_LoadingStory, _BackgroundStoryMixin): |
| + NAME = 'background:search:google' |
| + URL = 'https://www.google.co.uk/#q=tom+cruise+movies' |
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| + |
| + def _DidLoadDocument(self, action_runner): |
| + # Activte the immersive movie browsing experience |
| + action_runner.WaitForJavaScriptCondition( |
| + 'document.querySelector("g-fab") !== null') |
| + action_runner.ExecuteJavaScript( |
| + 'document.querySelector("g-fab").click()') |
| + |
| + |
| +class BackgroundFacebookMobileStory(_LoadingStory, _BackgroundStoryMixin): |
| + NAME = 'background:social:facebook' |
| + URL = 'https://www.facebook.com/rihanna' |
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| + |
| + |
| +class BackgroundNytimesMobileStory(_LoadingStory, _BackgroundStoryMixin): |
| + """The third top website in http://www.alexa.com/topsites/category/News""" |
| + NAME = 'background:news:nytimes' |
| + URL = 'http://www.nytimes.com/2016/10/04/us/politics/vice-presidential-debate.html?_r=0' |
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| + |
| + |
| +class BackgroundImgurMobileStory(_LoadingStory, _BackgroundStoryMixin): |
| + NAME = 'background:media:imgur' |
| + URL = 'http://imgur.com/gallery/hUita' |
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| + |
| + |
| +# pylint: disable=too-many-ancestors |
| +class BackgroundGmailMobileStory(_LoadGmailBaseStory, _BackgroundStoryMixin): |
|
perezju
2016/10/06 12:41:45
I'm not super excited about the multiple inheritan
|
| + NAME = 'background:tools:gmail' |
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| + |
| + def _DidLoadDocument(self, action_runner): |
| + pass |
| + |
| + |