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

Unified Diff: tools/perf/page_sets/key_power_cases.py

Issue 1097463004: Add key_idle_power_cases for ensuring idle activity on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: tools/perf/page_sets/key_power_cases.py
diff --git a/tools/perf/page_sets/key_power_cases.py b/tools/perf/page_sets/key_power_cases.py
new file mode 100644
index 0000000000000000000000000000000000000000..89a4bb7da1c30002f1c07f0d1215c6322795798a
--- /dev/null
+++ b/tools/perf/page_sets/key_power_cases.py
@@ -0,0 +1,64 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+from page_sets import android_screen_restoration_shared_state
+
+from telemetry.page import page as page_module
+from telemetry.page import page_set as page_set_module
+
+
+class KeyPowerPage(page_module.Page):
+
+ def __init__(self, url, page_set, turn_screen_off):
+ super(KeyPowerPage, self).__init__(
+ url=url,
+ page_set=page_set,
+ shared_page_state_class=(android_screen_restoration_shared_state
+ .AndroidScreenRestorationSharedState))
+ self.user_agent_type = 'mobile'
+ self._turn_screen_off = turn_screen_off
+
+ def RunNavigateSteps(self, action_runner):
+ super(KeyPowerPage, self).RunNavigateSteps(action_runner)
+ action_runner.Wait(2)
+ if self._turn_screen_off:
+ action_runner._tab.browser.platform.android_action_runner.TurnScreenOff()
nednguyen 2015/04/27 17:47:49 This is an API violation. I am working enable a si
jdduke (slow) 2015/04/28 21:30:29 OK, how should we proceed? Wait on that?
nednguyen 2015/04/28 23:03:24 Yes. Or you can go ahead with this change and add
+ # We're not interested in tracking activity that occurs immediately after
+ # the screen is turned off. Several seconds should be enough time for the
+ # browser to "settle down" into an idle state.
+ action_runner.Wait(2)
+
+ def RunPageInteractions(self, action_runner):
+ # The page interaction is simply waiting in an idle state.
+ action_runner.Wait(20)
+
+
+class KeyPowerCasesPageSet(page_set_module.PageSet):
+
+ """ Key power cases """
+
+ def __init__(self):
+ super(KeyPowerCasesPageSet, self).__init__(
+ user_agent_type='mobile')
+
+ foreground_urls_list = [
+ # Why: Ensure minimal activity for static, empty pages in the foreground.
+ 'file://key_power_cases/blank.html',
+ ]
+
+ for url in foreground_urls_list:
+ self.AddUserStory(KeyPowerPage(url, self, False))
+
+ background_urls_list = [
+ # Why: Ensure animated GIFs aren't processed when Chrome is backgrounded.
+ 'file://key_power_cases/animated-gif.html',
+ # Why: Ensure CSS animations aren't processed when Chrome is backgrounded.
+ 'file://key_power_cases/css-animation.html',
+ # Why: Ensure rAF is suppressed when Chrome is backgrounded.
+ 'file://key_power_cases/request-animation-frame.html',
+ # Why: Ensure setTimeout is throttled when Chrome is backgrounded.
+ 'file://key_power_cases/set-timeout.html',
+ ]
+
+ for url in background_urls_list:
+ self.AddUserStory(KeyPowerPage(url, self, True))

Powered by Google App Engine
This is Rietveld 408576698