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

Unified Diff: systrace/profile_chrome/util.py

Issue 2295913002: Enable some profile_chrome unit tests on Trybots (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Disable DDMS test because it is flaky 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
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

Powered by Google App Engine
This is Rietveld 408576698