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

Unified Diff: tools/perf/page_sets/android_screen_restoration_shared_state.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: lint Created 5 years, 7 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
« no previous file with comments | « tools/perf/benchmarks/thread_times.py ('k') | tools/perf/page_sets/key_idle_power_cases.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/android_screen_restoration_shared_state.py
diff --git a/tools/perf/page_sets/android_screen_restoration_shared_state.py b/tools/perf/page_sets/android_screen_restoration_shared_state.py
new file mode 100644
index 0000000000000000000000000000000000000000..3de3c2e294267d0124d87661a543b7ccd1799963
--- /dev/null
+++ b/tools/perf/page_sets/android_screen_restoration_shared_state.py
@@ -0,0 +1,29 @@
+# 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.
+import logging
+
+from telemetry.page import shared_page_state
+
+
+class AndroidScreenRestorationSharedState(shared_page_state.SharedPageState):
+ """ Ensures the screen is on before and after each user story is run. """
+
+ def WillRunUserStory(self, page):
+ super(AndroidScreenRestorationSharedState, self).WillRunUserStory(page)
+ self._EnsureScreenOn()
+
+ def DidRunUserStory(self, results):
+ try:
+ super(AndroidScreenRestorationSharedState, self).DidRunUserStory(results)
+ finally:
+ self._EnsureScreenOn()
+
+ def CanRunOnBrowser(self, browser_info):
+ if not browser_info.browser_type.startswith('android'):
+ logging.warning('Browser is non-Android, skipping test')
+ return False
+ return True
+
+ def _EnsureScreenOn(self):
+ self.platform.android_action_runner.EnsureScreenOn()
« no previous file with comments | « tools/perf/benchmarks/thread_times.py ('k') | tools/perf/page_sets/key_idle_power_cases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698