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

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

Issue 2386083003: Add background stories to MobileSystemHealth (Closed)
Patch Set: fixup stories 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
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
perezju 2016/10/06 13:32:42 nit: remove that blank space
hjd 2016/10/06 15:27:35 Done.
16 ABSTRACT_STORY = True
17 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
18
19 def _Measure(self, action_runner):
20 action_runner.tab.browser.Background()
21 super(_BackgroundStory, self)._Measure(action_runner)
22
23
24 class BackgroundGoogleStory(_BackgroundStory):
25 NAME = 'background:search:google'
26 URL = 'https://www.google.co.uk/#q=tom+cruise+movies'
27
28 def _DidLoadDocument(self, action_runner):
29 # Activte the immersive movie browsing experience
30 action_runner.WaitForJavaScriptCondition(
31 'document.querySelector("g-fab") !== null')
32 action_runner.ExecuteJavaScript(
33 'document.querySelector("g-fab").click()')
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'
nednguyen 2016/10/06 13:39:02 Turns out this page has few videos in it, could yo
hjd 2016/10/06 15:27:35 Okay done, seems to kinda work although the video
46 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
47
48
49 class BackgroundImgurMobileStory(_BackgroundStory):
50 NAME = 'background:media:imgur'
51 URL = 'http://imgur.com/gallery/hUita'
52 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
53
54
55 class BackgroundGmailMobileStory(LoadGmailMobileStory):
56 NAME = 'background:tools:gmail'
57 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
58
59 def _Measure(self, action_runner):
60 action_runner.tab.browser.Background()
61 super(BackgroundGmailMobileStory, self)._Measure(action_runner)
62
63 def _DidLoadDocument(self, action_runner):
64 # The hacks in LoadGmailMobileStory _DidLoadDocument no longer apply.
65 pass
66
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698