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

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

Issue 2272993003: [Telemetry] Convert long running user stories to the System Health format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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.login_helpers import google_login
6 from page_sets.system_health import platforms
7 from page_sets.system_health import system_health_story
8
9
10 IDLE_TIME_IN_SECONDS = 100
11 SAMPLING_INTERVAL_IN_SECONDS = 1
12 STEPS = IDLE_TIME_IN_SECONDS / SAMPLING_INTERVAL_IN_SECONDS
13
14
15 class _LongRunningStory(system_health_story.SystemHealthStory):
16 """Abstract base class for long running stories."""
17 IS_SINGLE_PAGE_APP = False
18 ITEM_SELECTOR = NotImplemented
petrcermak 2016/08/25 09:57:19 Remove these two constants (IS_SINGLE_PAGE_APP, IT
rnephew (Reviews Here) 2016/08/25 15:28:57 Done.
19 ABSTRACT_STORY = True
20 BACKGROUND = False
21
22 def RunPageInteractions(self, action_runner):
23 super(_LongRunningStory, self).RunPageInteractions(action_runner)
24 if self.BACKGROUND:
25 action_runner.tab.browser.tabs.New()
26 action_runner.tab.browser.DumpMemory()
petrcermak 2016/08/25 09:57:19 instead of calling DumpMemory directly, please do
rnephew (Reviews Here) 2016/08/25 15:28:57 Done.
27 for _ in xrange(STEPS):
28 action_runner.Wait(SAMPLING_INTERVAL_IN_SECONDS)
29 action_runner.tab.browser.DumpMemory()
30
31
32 ##############################################################################
33 # Long running gmail stories.
petrcermak 2016/08/25 09:57:19 nit: s/gmail/Gmail/
rnephew (Reviews Here) 2016/08/25 15:28:57 Done.
34 ##############################################################################
35
36
37 class _LongRunningGmailBase(_LongRunningStory):
petrcermak 2016/08/25 09:57:19 There's a lot of code duplication between this fil
rnephew (Reviews Here) 2016/08/25 15:28:57 Added todo, will start working on merging them nex
38 URL = 'https://mail.google.com/mail/'
39 ABSTRACT_STORY = True
40
41 def _Login(self, action_runner):
42 google_login.LoginGoogleAccount(action_runner, 'googletest',
43 self.credentials_path)
44
45 # Navigating to https://mail.google.com immediately leads to an infinite
46 # redirection loop due to a bug in WPR (see
47 # https://github.com/chromium/web-page-replay/issues/70). We therefore first
48 # navigate to a sub-URL to set up the session and hit the resulting
49 # redirection loop. Afterwards, we can safely navigate to
50 # https://mail.google.com.
51 action_runner.Navigate(
52 'https://mail.google.com/mail/mu/mp/872/trigger_redirection_loop')
53 action_runner.tab.WaitForDocumentReadyStateToBeComplete()
54
55 class _LongRunningGmailMobileBase(_LongRunningGmailBase):
56 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
57
58 def _DidLoadDocument(self, action_runner):
59 # Close the "Get Inbox by Gmail" interstitial.
60 action_runner.WaitForJavaScriptCondition(
61 'document.querySelector("#isppromo a") !== null')
62 action_runner.ExecuteJavaScript(
63 'document.querySelector("#isppromo a").click()')
64 # Wait until the UI loads.
65 action_runner.WaitForJavaScriptCondition(
66 'document.getElementById("apploadingdiv").style.height === "0px"')
67
68
69 class _LongRunningGmailDesktopBase(_LongRunningGmailBase):
70 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
71
72 def _DidLoadDocument(self, action_runner):
73 # Wait until the UI loads.
74 action_runner.WaitForJavaScriptCondition(
75 'document.getElementById("loading").style.display === "none"')
76
77
78 class LongRunningGmailMobileForegroundStory(_LongRunningGmailMobileBase):
79 NAME = 'long_running:tools:gmail-foreground'
80
81
82 class LongRunningGmailDesktopForegroundStory(_LongRunningGmailDesktopBase):
83 NAME = 'long_running:tools:gmail-foreground'
84
85
86 class LongRunningGmailMobileBackgroundStory(_LongRunningGmailMobileBase):
87 BACKGROUND = True
88 NAME = 'long_running:tools:gmail-background'
89
90
91 class LongRunningGmailDesktopBackgroundStory(_LongRunningGmailDesktopBase):
92 BACKGROUND = True
93 NAME = 'long_running:tools:gmail-background'
OLDNEW
« tools/perf/benchmarks/battor.py ('K') | « tools/perf/page_sets/data/system_health_mobile.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698