Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 time | |
| 5 import unittest | 6 import unittest |
| 6 | 7 |
| 7 from profile_chrome import profiler | 8 from profile_chrome import profiler |
| 8 | 9 |
| 9 from devil.android import device_utils | 10 from devil.android import device_utils |
| 10 from devil.android.sdk import intent | 11 from devil.android.sdk import intent |
| 12 from devil.android.sdk import keyevent | |
| 11 | 13 |
| 12 | 14 |
| 13 class BaseAgentTest(unittest.TestCase): | 15 class BaseAgentTest(unittest.TestCase): |
| 14 def setUp(self): | 16 def setUp(self): |
| 15 devices = device_utils.DeviceUtils.HealthyDevices() | 17 devices = device_utils.DeviceUtils.HealthyDevices() |
| 16 self.browser = 'stable' | 18 self.browser = 'stable' |
| 17 self.package_info = profiler.GetSupportedBrowsers()[self.browser] | 19 self.package_info = profiler.GetSupportedBrowsers()[self.browser] |
| 18 self.device = devices[0] | 20 self.device = devices[0] |
| 19 | 21 |
| 22 # Turn on and unlock device in order to access the browser. | |
| 23 self.device.SetScreen(True) | |
| 24 self.device.SendKeyEvent(keyevent.KEYCODE_MENU) | |
| 25 | |
| 20 self.device.ForceStop(self.package_info.package) | 26 self.device.ForceStop(self.package_info.package) |
| 21 self.device.StartActivity( | 27 self.device.StartActivity( |
| 22 intent.Intent(activity=self.package_info.activity, | 28 intent.Intent(activity=self.package_info.activity, |
| 23 package=self.package_info.package), | 29 package=self.package_info.package), |
| 24 blocking=True) | 30 blocking=True) |
| 31 | |
| 32 # Sleep between unit tests to avoid race conditions. | |
| 33 time.sleep(5) | |
|
Zhen Wang
2016/09/01 23:16:56
Have you figured out how to know if the browser is
Sami
2016/09/02 13:01:13
Yeah, it'd be great to avoid arbitrary sleeps sinc
washingtonp
2016/09/08 22:51:36
The chrome agent tests fail to find the start trac
washingtonp
2016/09/08 22:51:36
Unfortunately, from what I have repeatedly observe
| |
| OLD | NEW |