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 487c4e1ac7c8137f287378fee2f72bebaf3ad18d..112130de0d68202cd8d133f899ac68e8275179e7 100755 |
--- a/tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py |
+++ b/tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py |
@@ -10,6 +10,7 @@ import logging |
import optparse |
import os |
import re |
+import subprocess |
import sys |
import time |
@@ -26,6 +27,20 @@ sys.path.append(os.path.join(_SRC_PATH, 'build', 'android')) |
import devil_chromium |
+# Local build of Chrome (not Chromium). |
+_CHROME_PACKAGE = 'com.google.android.apps.chrome' |
+ |
+ |
+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, no_prerendering, delay_to_may_launch_url, |
delay_to_launch_url, cold): |
"""Runs a test on a device once. |
@@ -54,8 +69,10 @@ def RunOnce(device, url, warmup, no_prerendering, delay_to_may_launch_url, |
result_line_re = re.compile(r'CUSTOMTABSBENCH.*: (.*)') |
logcat_monitor = device.GetLogcatMonitor(clear=True) |
logcat_monitor.Start() |
- device.ForceStop('com.google.android.apps.chrome') |
+ device.ForceStop(_CHROME_PACKAGE) |
device.ForceStop('org.chromium.customtabsclient.test') |
+ ResetChromeLocalState(device) |
+ |
if cold: |
if not device.HasRoot(): |
device.EnableRoot() |