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..384fe01923e4a624aff3526c8e777f35cbbbbbf6 |
--- /dev/null |
+++ b/tools/perf/page_sets/key_power_cases.py |
@@ -0,0 +1,57 @@ |
+# 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 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) |
+ self.user_agent_type = 'mobile' |
+ self._turn_screen_off = turn_screen_off |
+ |
+ def RunNavigateSteps(self, action_runner): |
+ action_runner._tab.browser.platform.android_action_runner.TurnScreenOn() |
+ super(KeyPowerPage, self).RunNavigateSteps(action_runner) |
+ action_runner.Wait(2) |
+ if self._turn_screen_off: |
+ action_runner._tab.browser.platform.android_action_runner.TurnScreenOff() |
+ action_runner.Wait(2) |
+ |
+ def RunPageInteractions(self, action_runner): |
+ action_runner.Wait(20) |
+ # TODO(jdduke): Restore screen state? |
+ |
rnephew (Reviews Here)
2015/04/23 18:28:05
Should the turn screen off/on step be performed he
jdduke (slow)
2015/04/24 16:10:52
Right, we don't want the "interaction" to include
|
+ |
+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', |
rnephew (Reviews Here)
2015/04/23 18:28:05
I dont know enough about telemetry to know if it s
jdduke (slow)
2015/04/24 16:10:52
Typically, yes, but these are (intentionally) synt
|
+ ] |
+ |
+ 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)) |