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

Unified Diff: tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py

Issue 2370823003: [CustomTabsBenchmark] Clear chrome local state between runs (Closed)
Patch Set: list comprehension Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698