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

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

Issue 2386083003: Add background stories to MobileSystemHealth (Closed)
Patch Set: tweak stories some more Created 4 years, 1 month 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
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 _WAIT_FOR_VIDEO_SECONDS = 5
10
11 class _BackgroundStory(system_health_story.SystemHealthStory):
12 """Abstract base class for background stories
13
14 As in _LoadingStory except it puts the browser into the
15 background before measuring.
16 """
17 ABSTRACT_STORY = True
18 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
19
20 def _Measure(self, action_runner):
21 action_runner.tab.browser.Background()
22 super(_BackgroundStory, self)._Measure(action_runner)
23
24
25 class BackgroundGoogleStory(_BackgroundStory):
26 NAME = 'background:search:google'
27 URL = 'https://www.google.co.uk/#q=tom+cruise+movies'
28
29 def _DidLoadDocument(self, action_runner):
30 # Activte the immersive movie browsing experience
31 action_runner.WaitForElement(selector='g-fab')
32 action_runner.ScrollPageToElement(selector='g-fab')
33 action_runner.TapElement(selector='g-fab')
34
35
36 class BackgroundFacebookMobileStory(_BackgroundStory):
37 NAME = 'background:social:facebook'
38 URL = 'https://www.facebook.com/rihanna'
39 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
40
41
42 class BackgroundNytimesMobileStory(_BackgroundStory):
43 """The third top website in http://www.alexa.com/topsites/category/News"""
44 NAME = 'background:news:nytimes'
45 URL = 'http://www.nytimes.com/2016/10/04/us/politics/vice-presidential-debate. html?_r=0'
46 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
47
48 def _DidLoadDocument(self, action_runner):
49 # Dismiss the 'You have n free articles' message.
50 action_runner.WaitForElement(selector='.growl-dismiss')
51 action_runner.TapElement(selector='.growl-dismiss')
52
53 # Tap the 'Show Full Article' button.
54 action_runner.WaitForElement(selector='#additional-content button')
55 action_runner.ScrollPageToElement(selector='#additional-content button')
56 # TapElement seems flaky here so use JavaScript instead.
57 action_runner.ExecuteJavaScript(
58 'document.querySelector("#additional-content button").click()')
59
60 # Scroll to video, start it and then wait for a few seconds.
61 action_runner.WaitForElement(selector='.nytd-player-poster')
62 action_runner.ScrollPageToElement(selector='.nytd-player-poster')
63 action_runner.TapElement(selector='.nytd-player-poster')
64 action_runner.Wait(_WAIT_FOR_VIDEO_SECONDS)
65
66
67 class BackgroundImgurMobileStory(_BackgroundStory):
68 NAME = 'background:media:imgur'
69 URL = 'http://imgur.com/gallery/hUita'
70 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
71
72
73 class BackgroundGmailMobileStory(LoadGmailMobileStory):
74 NAME = 'background:tools:gmail'
75 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
76
77 def _Measure(self, action_runner):
78 action_runner.tab.browser.Background()
79 super(BackgroundGmailMobileStory, self)._Measure(action_runner)
80
OLDNEW
« no previous file with comments | « tools/perf/page_sets/data/system_health_mobile_052.wpr.sha1 ('k') | tools/perf/page_sets/system_health/loading_stories.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698