Chromium Code Reviews| Index: systrace/profile_chrome/util.py |
| diff --git a/systrace/profile_chrome/util.py b/systrace/profile_chrome/util.py |
| index f5cb5bf370aa97c4eb59b71b32109f9db0cc6004..0fdeddf3d8bf24b0dfc8bc230622437fee8ca64f 100644 |
| --- a/systrace/profile_chrome/util.py |
| +++ b/systrace/profile_chrome/util.py |
| @@ -7,6 +7,9 @@ import os |
| import time |
| import zipfile |
| +from devil.android.sdk import intent |
| +from devil.android.sdk import keyevent |
| + |
| def ArchiveFiles(host_files, output): |
| with zipfile.ZipFile(output, 'w', zipfile.ZIP_DEFLATED) as z: |
| @@ -33,3 +36,25 @@ def WriteDataToCompressedFile(data, output): |
| def GetTraceTimestamp(): |
| return time.strftime('%Y-%m-%d-%H%M%S', time.localtime()) |
| + |
| +def StartBrowser(device, package_info): |
|
Sami
2016/09/09 10:28:25
Feels like this fits in better in the test harness
washingtonp
2016/09/09 18:07:29
Done.
|
| + # Turn on the device screen. |
| + device.SetScreen(True) |
| + |
| + # Unlock device. |
| + device.SendKeyEvent(keyevent.KEYCODE_MENU) |
| + |
| + # Start browser. |
| + device.StartActivity( |
| + intent.Intent(activity=package_info.activity, |
| + package=package_info.package, |
| + data='about:blank', |
| + extras={'create_new_tab': True}), |
| + blocking=True, force_stop=True) |
| + |
| +def GetChromeProcessID(device, package_info): |
| + chrome_processes = device.GetPids(package_info.package) |
| + if (package_info.package in chrome_processes and |
| + len(chrome_processes[package_info.package]) > 0): |
| + return chrome_processes[package_info.package][0] |
| + return None |