Index: tools/telemetry/telemetry/core/backends/android_app_backend.py |
diff --git a/tools/telemetry/telemetry/core/backends/android_app_backend.py b/tools/telemetry/telemetry/core/backends/android_app_backend.py |
index 196d855d75de903f650fcaac64fbc9b41723eb67..ecb5c6ce00f067deb5513b878266285adbe9033b 100644 |
--- a/tools/telemetry/telemetry/core/backends/android_app_backend.py |
+++ b/tools/telemetry/telemetry/core/backends/android_app_backend.py |
@@ -10,9 +10,12 @@ from telemetry.core import util |
from telemetry.core import web_contents |
from telemetry.core.backends import adb_commands |
from telemetry.core.backends import app_backend |
+from telemetry.core.backends import android_browser_backend_settings |
+from telemetry.core.backends import android_command_line_backend |
class AndroidAppBackend(app_backend.AppBackend): |
+ |
def __init__(self, android_platform_backend, start_intent, |
is_app_ready_predicate=None): |
super(AndroidAppBackend, self).__init__( |
@@ -23,6 +26,13 @@ class AndroidAppBackend(app_backend.AppBackend): |
self._is_running = False |
self._existing_processes_by_pid = {} |
+ webview_startup_args = self.GetWebviewStartupArgs() |
nednguyen
2015/01/13 16:03:04
Calling a method in the constructor can be dangero
ariblue
2015/01/13 20:23:37
I've moved it to the __enter__ function in part of
|
+ backend_settings = android_browser_backend_settings.WebviewBackendSettings( |
+ 'android-webview') |
+ self._android_command_line_backend = ( |
+ android_command_line_backend.AndroidCommandLineBackend( |
+ self._adb, backend_settings, webview_startup_args)) |
+ |
@property |
def _adb(self): |
return self.platform_backend.adb |
@@ -36,10 +46,16 @@ class AndroidAppBackend(app_backend.AppBackend): |
AppStory derivations can customize the wait-for-ready-state to wait |
for a more specific event if needed. |
""" |
+ self._android_command_line_backend.SetUpCommandLine() |
nednguyen
2015/01/13 16:03:04
Instead of try & finally as below, can we use the
ariblue
2015/01/13 20:23:37
Yeah, that looks cleaner too. Good call, updated h
|
+ |
# TODO(slamm): check if can use "blocking=True" instead of needing to sleep. |
# If "blocking=True" does not work, switch sleep to "ps" check. |
self._adb.device().StartActivity(self._start_intent, blocking=False) |
- util.WaitFor(self._IsAppReady, timeout=60) |
+ |
+ try: |
+ util.WaitFor(self._IsAppReady, timeout=60) |
+ finally: |
+ self._android_command_line_backend.RestoreCommandLine() |
self._is_running = True |
def Close(self): |
@@ -81,3 +97,15 @@ class AndroidAppBackend(app_backend.AppBackend): |
for process in self.GetProcesses(): |
webviews.update(process.GetWebViews()) |
return webviews |
+ |
+ def GetWebviewStartupArgs(self): |
+ args = [] |
+ |
+ # Turn on GPU benchmarking extension for all runs. The only side effect of |
+ # the extension being on is that render stats are tracked. This is believed |
+ # to be effectively free. And, by doing so here, it avoids us having to |
+ # programmatically inspect a pageset's actions in order to determine if it |
+ # might eventually scroll. |
+ args.append('--enable-gpu-benchmarking') |
+ |
+ return args |