Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 from page_sets.system_health import platforms | |
| 6 from page_sets.system_health.loading_stories import _LoadingStory | |
| 7 from page_sets.system_health.loading_stories import _LoadGmailBaseStory | |
| 8 | |
| 9 class _BackgroundStoryMixin(object): | |
| 10 """Mixin class for background stories | |
| 11 | |
| 12 Overrides _Measure to put the browser into the background before measuring. | |
| 13 """ | |
| 14 | |
| 15 def _Measure(self, action_runner): | |
| 16 action_runner.tab.browser.Background() | |
| 17 super(_BackgroundStoryMixin, self)._Measure(action_runner) | |
| 18 | |
| 19 | |
| 20 class BackgroundGoogleStory(_LoadingStory, _BackgroundStoryMixin): | |
| 21 NAME = 'background:search:google' | |
| 22 URL = 'https://www.google.co.uk/#q=tom+cruise+movies' | |
| 23 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 24 | |
| 25 def _DidLoadDocument(self, action_runner): | |
| 26 # Activte the immersive movie browsing experience | |
| 27 action_runner.WaitForJavaScriptCondition( | |
| 28 'document.querySelector("g-fab") !== null') | |
| 29 action_runner.ExecuteJavaScript( | |
| 30 'document.querySelector("g-fab").click()') | |
| 31 | |
| 32 | |
| 33 class BackgroundFacebookMobileStory(_LoadingStory, _BackgroundStoryMixin): | |
| 34 NAME = 'background:social:facebook' | |
| 35 URL = 'https://www.facebook.com/rihanna' | |
| 36 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 37 | |
| 38 | |
| 39 class BackgroundNytimesMobileStory(_LoadingStory, _BackgroundStoryMixin): | |
| 40 """The third top website in http://www.alexa.com/topsites/category/News""" | |
| 41 NAME = 'background:news:nytimes' | |
| 42 URL = 'http://www.nytimes.com/2016/10/04/us/politics/vice-presidential-debate. html?_r=0' | |
| 43 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 44 | |
| 45 | |
| 46 class BackgroundImgurMobileStory(_LoadingStory, _BackgroundStoryMixin): | |
| 47 NAME = 'background:media:imgur' | |
| 48 URL = 'http://imgur.com/gallery/hUita' | |
| 49 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 50 | |
| 51 | |
| 52 # pylint: disable=too-many-ancestors | |
| 53 class BackgroundGmailMobileStory(_LoadGmailBaseStory, _BackgroundStoryMixin): | |
|
perezju
2016/10/06 12:41:45
I'm not super excited about the multiple inheritan
| |
| 54 NAME = 'background:tools:gmail' | |
| 55 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 56 | |
| 57 def _DidLoadDocument(self, action_runner): | |
| 58 pass | |
| 59 | |
| 60 | |
| OLD | NEW |