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 import system_health_story | |
| 7 from page_sets.system_health.loading_stories import LoadGmailMobileStory | |
| 8 | |
| 9 class _BackgroundStory(system_health_story.SystemHealthStory): | |
| 10 """Abstract base class for background stories | |
| 11 | |
| 12 As in _LoadingStory except it puts the browser into the | |
| 13 background before measuring. | |
| 14 """ | |
| 15 ABSTRACT_STORY = True | |
| 16 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 17 | |
| 18 def _Measure(self, action_runner): | |
| 19 action_runner.tab.browser.Background() | |
| 20 super(_BackgroundStory, self)._Measure(action_runner) | |
| 21 | |
| 22 | |
| 23 class BackgroundGoogleStory(_BackgroundStory): | |
| 24 NAME = 'background:search:google' | |
| 25 URL = 'https://www.google.co.uk/#q=tom+cruise+movies' | |
| 26 | |
| 27 def _DidLoadDocument(self, action_runner): | |
| 28 # Activte the immersive movie browsing experience | |
| 29 action_runner.WaitForJavaScriptCondition( | |
| 30 'document.querySelector("g-fab") !== null') | |
| 31 action_runner.ExecuteJavaScript( | |
| 32 'document.querySelector("g-fab").click()') | |
| 33 | |
| 34 | |
| 35 class BackgroundFacebookMobileStory(_BackgroundStory): | |
| 36 NAME = 'background:social:facebook' | |
| 37 URL = 'https://www.facebook.com/rihanna' | |
| 38 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 39 | |
| 40 | |
| 41 class BackgroundNytimesMobileStory(_BackgroundStory): | |
| 42 """The third top website in http://www.alexa.com/topsites/category/News""" | |
| 43 NAME = 'background:news:nytimes' | |
| 44 URL = 'http://www.nytimes.com/2016/10/04/us/politics/vice-presidential-debate. html?_r=0' | |
| 45 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 46 | |
| 47 def _DidLoadDocument(self, action_runner): | |
| 48 action_runner.WaitForJavaScriptCondition( | |
| 49 'document.querySelector(".nytd-player-poster") !== null') | |
| 50 action_runner.ScrollElement(selector='.nytd-player-poster') | |
|
nednguyen
2016/10/14 22:55:58
Randy has finished his work. You can now use: Scro
hjd
2016/10/18 11:50:00
Done.
| |
| 51 action_runner.ExecuteJavaScript( | |
| 52 'document.querySelector(".nytd-player-poster").click();') | |
| 53 | |
| 54 | |
| 55 class BackgroundImgurMobileStory(_BackgroundStory): | |
| 56 NAME = 'background:media:imgur' | |
| 57 URL = 'http://imgur.com/gallery/hUita' | |
| 58 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 59 | |
| 60 | |
| 61 class BackgroundGmailMobileStory(LoadGmailMobileStory): | |
| 62 NAME = 'background:tools:gmail' | |
| 63 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 64 | |
| 65 def _Measure(self, action_runner): | |
| 66 action_runner.tab.browser.Background() | |
| 67 super(BackgroundGmailMobileStory, self)._Measure(action_runner) | |
| 68 | |
| OLD | NEW |