Chromium Code Reviews| 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() |