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

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

Issue 2370823003: [CustomTabsBenchmark] Clear chrome local state between runs (Closed)
Patch Set: cleanup 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..1c8e093d62e999f8c6d82d50690a9083a43071ad 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,17 @@ sys.path.append(os.path.join(_SRC_PATH, 'build', 'android'))
import devil_chromium
+_CHROME_PACKAGE = 'com.google.android.apps.chrome'
Benoit L 2016/09/27 14:54:45 Maybe add a comment to say that it corresponds to
droger 2016/09/27 15:39:13 Done.
+
+
+def ResetChromeLocalState(device):
+ """Remove the Chrome Profile and the various disk caches."""
+ for directory in ['app_chrome/Default', 'cache', 'app_chrome/ShaderCache',
Benoit L 2016/09/27 14:54:45 Where does this list come?
droger 2016/09/27 15:39:13 This comes from controller.py: https://cs.chromium
+ 'app_tabs']:
+ cmd = ['rm', '-rf', '/data/data/{}/{}'.format(_CHROME_PACKAGE, directory)]
Benoit L 2016/09/27 14:54:45 rm can take several arguments, it woulb be a bit f
droger 2016/09/27 15:39:13 Done.
+ 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 +66,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