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

Unified Diff: systrace/profile_chrome/agents_unittest.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: Add Chris as owner of Systrace bin directory 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 | « systrace/bin/run_tests ('k') | systrace/profile_chrome/atrace_tracing_agent_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: systrace/profile_chrome/agents_unittest.py
diff --git a/systrace/profile_chrome/agents_unittest.py b/systrace/profile_chrome/agents_unittest.py
index 527162cfcf9dab8b3f0e9a46fba65a81f97dfde0..8a22381983e985f382a72af5bf332fc19a4d393c 100644
--- a/systrace/profile_chrome/agents_unittest.py
+++ b/systrace/profile_chrome/agents_unittest.py
@@ -8,6 +8,7 @@ from profile_chrome import profiler
from devil.android import device_utils
from devil.android.sdk import intent
+from devil.android.sdk import keyevent
class BaseAgentTest(unittest.TestCase):
@@ -17,8 +18,28 @@ class BaseAgentTest(unittest.TestCase):
self.package_info = profiler.GetSupportedBrowsers()[self.browser]
self.device = devices[0]
- self.device.ForceStop(self.package_info.package)
+ curr_browser = self.GetChromeProcessID()
+ if curr_browser == None:
+ self.StartBrowser()
+
+ def StartBrowser(self):
+ # Turn on the device screen.
+ self.device.SetScreen(True)
+
+ # Unlock device.
+ self.device.SendKeyEvent(keyevent.KEYCODE_MENU)
+
+ # Start browser.
self.device.StartActivity(
- intent.Intent(activity=self.package_info.activity,
- package=self.package_info.package),
- blocking=True)
+ intent.Intent(activity=self.package_info.activity,
+ package=self.package_info.package,
+ data='about:blank',
+ extras={'create_new_tab': True}),
+ blocking=True, force_stop=True)
+
+ def GetChromeProcessID(self):
+ chrome_processes = self.device.GetPids(self.package_info.package)
+ if (self.package_info.package in chrome_processes and
+ len(chrome_processes[self.package_info.package]) > 0):
+ return chrome_processes[self.package_info.package][0]
+ return None
« no previous file with comments | « systrace/bin/run_tests ('k') | systrace/profile_chrome/atrace_tracing_agent_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698