Index: tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py |
diff --git a/tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py b/tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py |
index 5d462172bc971321b2e4c64a1f9ebf4a7de28a66..b4f5170b6c83cdb836258d5c9f3292c438924e09 100755 |
--- a/tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py |
+++ b/tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py |
@@ -13,7 +13,6 @@ import optparse |
import os |
import random |
import re |
-import subprocess |
import sys |
import time |
@@ -30,6 +29,7 @@ sys.path.append(os.path.join(_SRC_PATH, 'build', 'android')) |
import devil_chromium |
sys.path.append(os.path.join(_SRC_PATH, 'tools', 'android', 'loading')) |
+import chrome_setup |
import device_setup |
@@ -40,35 +40,6 @@ _TEST_APP_PACKAGE_NAME = 'org.chromium.customtabsclient.test' |
_INVALID_VALUE = -1 |
-# Command line arguments for Chrome. |
-CHROME_ARGS = [ |
- # Disable backgound network requests that may pollute WPR archive, pollute |
- # HTTP cache generation, and introduce noise in loading performance. |
- '--disable-background-networking', |
- '--disable-default-apps', |
- '--no-proxy-server', |
- # TODO(droger): Remove once crbug.com/354743 is fixed. |
- '--safebrowsing-disable-auto-update', |
- |
- # Disables actions that chrome performs only on first run or each launches, |
- # which can interfere with page load performance, or even block its |
- # execution by waiting for user input. |
- '--disable-fre', |
- '--no-default-browser-check', |
- '--no-first-run', |
-] |
- |
- |
-def ResetChromeLocalState(device): |
- """Remove the Chrome Profile and the various disk caches.""" |
- profile_dirs = ['app_chrome/Default', 'cache', 'app_chrome/ShaderCache', |
- 'app_tabs'] |
- cmd = ['rm', '-rf'] |
- cmd.extend( |
- '/data/data/{}/{}'.format(_CHROME_PACKAGE, d) for d in profile_dirs) |
- device.adb.Shell(subprocess.list2cmdline(cmd)) |
- |
- |
def RunOnce(device, url, warmup, speculation_mode, delay_to_may_launch_url, |
delay_to_launch_url, cold, chrome_args, reset_chrome_state): |
"""Runs a test on a device once. |
@@ -116,7 +87,7 @@ def RunOnce(device, url, warmup, speculation_mode, delay_to_may_launch_url, |
device.ForceStop(_TEST_APP_PACKAGE_NAME) |
if reset_chrome_state: |
- ResetChromeLocalState(device) |
+ chrome_setup.ResetChromeLocalState(device, _CHROME_PACKAGE) |
if cold: |
cache_control.CacheControl(device).DropRamCaches() |
@@ -180,7 +151,7 @@ def LoopOnDevice(device, configs, output_filename, wpr_archive_path=None, |
try: |
while should_stop is None or not should_stop.is_set(): |
config = configs[random.randint(0, len(configs) - 1)] |
- chrome_args = CHROME_ARGS + wpr_attributes.chrome_args |
+ chrome_args = chrome_setup.CHROME_ARGS + wpr_attributes.chrome_args |
if config['speculation_mode'] == 'no_state_prefetch': |
# NoStatePrefetch is enabled through an experiment. |
chrome_args.extend([ |