Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: tools/perf/page_sets/system_health/background_stories.py

Issue 2386083003: Add background stories to MobileSystemHealth (Closed)
Patch Set: fix a typo & click on nytime video Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/perf/page_sets/system_health/loading_stories.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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("#additional-content button") !== null')
50 action_runner.ExecuteJavaScript(
51 'document.querySelector("#additional-content button").click()')
52
53 action_runner.WaitForJavaScriptCondition(
54 'document.querySelector(".nytd-player-poster") !== null')
55 action_runner.ExecuteJavaScript(
56 'document.querySelector(".nytd-player-poster").scrollIntoView();')
nednguyen 2016/10/08 14:30:13 Instead of doing this, can you use action_runner.S
57 action_runner.ExecuteJavaScript(
58 'document.querySelector(".nytd-player-poster").click();')
59
60
61 class BackgroundImgurMobileStory(_BackgroundStory):
62 NAME = 'background:media:imgur'
63 URL = 'http://imgur.com/gallery/hUita'
64 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
65
66
67 class BackgroundGmailMobileStory(LoadGmailMobileStory):
68 NAME = 'background:tools:gmail'
69 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
70
71 def _Measure(self, action_runner):
72 action_runner.tab.browser.Background()
73 super(BackgroundGmailMobileStory, self)._Measure(action_runner)
74
75 def _DidLoadDocument(self, action_runner):
76 # The hacks in LoadGmailMobileStory _DidLoadDocument no longer apply.
77 pass
78
OLDNEW
« no previous file with comments | « no previous file | tools/perf/page_sets/system_health/loading_stories.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698