Index: tools/telemetry/telemetry/android_browser_finder.py |
diff --git a/tools/telemetry/telemetry/android_browser_finder.py b/tools/telemetry/telemetry/android_browser_finder.py |
index 26614351bd9680120a4a5cc1210331e1567ca261..b0a4b6b0215877c75867b612bd9991900ffdc3d8 100644 |
--- a/tools/telemetry/telemetry/android_browser_finder.py |
+++ b/tools/telemetry/telemetry/android_browser_finder.py |
@@ -7,6 +7,7 @@ import os |
import logging as real_logging |
import re |
import subprocess |
+import sys |
from telemetry import adb_commands |
from telemetry import android_browser_backend |
@@ -14,6 +15,14 @@ from telemetry import android_platform |
from telemetry import browser |
from telemetry import possible_browser |
+sys.path.append( |
nduca
2012/12/04 09:20:17
please call through adb_commands by wrapping. That
|
+ os.path.abspath( |
+ os.path.join(os.path.dirname(__file__), |
+ '../../../build/android/pylib'))) |
+import perf_tests_helper # pylint: disable=F0401 |
+import thermal_throttle # pylint: disable=F0401 |
+ |
+ |
ALL_BROWSER_TYPES = ','.join([ |
'android-content-shell', |
'android-chrome', |
@@ -58,6 +67,26 @@ class PossibleAndroidBrowser(possible_browser.PossibleBrowser): |
self._args[1] + self._args[4]) |
return browser.Browser(backend, platform) |
+ def CreatePlatformHarness(self): |
+ class AndroidPlatformHarness(object): |
+ def __init__(self, adb): |
+ self._perf_tests_setup = perf_tests_helper.PerfTestSetup(adb) |
+ self._thermal_throttle = thermal_throttle.ThermalThrottle(adb) |
+ |
+ def __enter__(self): |
+ if self._thermal_throttle.IsThrottled(): |
+ real_logging.warn('Device is being thermally throttled.') |
+ self._perf_tests_setup.SetUp() |
+ return self |
+ |
+ def __exit__(self, *args): |
+ if self._thermal_throttle.HasBeenThrottled(): |
+ real_logging.warn('Device was thermally throttled during tests.') |
+ self._perf_tests_setup.TearDown() |
+ |
+ return AndroidPlatformHarness(self._args[0].Adb()) |
+ |
+ |
def FindAllAvailableBrowsers(options, logging=real_logging): |
"""Finds all the desktop browsers available on this machine.""" |
if not adb_commands.IsAndroidSupported(): |