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

Side by Side 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: Disabled Chrome tracing test since it occasionally fails as well 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import unittest 5 import unittest
6 6
7 from profile_chrome import profiler 7 from profile_chrome import profiler
8 8
9 from devil.android import device_utils 9 from devil.android import device_utils
10 from devil.android.sdk import intent 10 from devil.android.sdk import intent
11 from devil.android.sdk import keyevent
11 12
12 13
13 class BaseAgentTest(unittest.TestCase): 14 class BaseAgentTest(unittest.TestCase):
14 def setUp(self): 15 def setUp(self):
15 devices = device_utils.DeviceUtils.HealthyDevices() 16 devices = device_utils.DeviceUtils.HealthyDevices()
16 self.browser = 'stable' 17 self.browser = 'stable'
17 self.package_info = profiler.GetSupportedBrowsers()[self.browser] 18 self.package_info = profiler.GetSupportedBrowsers()[self.browser]
18 self.device = devices[0] 19 self.device = devices[0]
19 20
20 self.device.ForceStop(self.package_info.package) 21 curr_browser = self.GetChromeProcessID()
22 if curr_browser == None:
Sami 2016/09/12 14:26:32 nit: prefer "is None" instead of "== None" (or jus
23 self.StartBrowser()
24
25 def StartBrowser(self):
26 # Turn on the device screen.
27 self.device.SetScreen(True)
28
29 # Unlock device.
30 self.device.SendKeyEvent(keyevent.KEYCODE_MENU)
31
32 # Start browser.
21 self.device.StartActivity( 33 self.device.StartActivity(
22 intent.Intent(activity=self.package_info.activity, 34 intent.Intent(activity=self.package_info.activity,
23 package=self.package_info.package), 35 package=self.package_info.package,
24 blocking=True) 36 data='about:blank',
37 extras={'create_new_tab': True}),
38 blocking=True, force_stop=True)
39
40 def GetChromeProcessID(self):
41 chrome_processes = self.device.GetPids(self.package_info.package)
42 if (self.package_info.package in chrome_processes and
43 len(chrome_processes[self.package_info.package]) > 0):
44 return chrome_processes[self.package_info.package][0]
45 return None
OLDNEW
« 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