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

Unified Diff: build/android/pylib/device/device_utils_test.py

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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 | « build/android/pylib/device/device_utils.py ('k') | build/android/pylib/instrumentation/test_options.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/device_utils_test.py
diff --git a/build/android/pylib/device/device_utils_test.py b/build/android/pylib/device/device_utils_test.py
index 5f35a356da08d863a415b81382f323d8bf0e6136..58dd56ac9ee8a01abcde63f65744733a8f7d046b 100755
--- a/build/android/pylib/device/device_utils_test.py
+++ b/build/android/pylib/device/device_utils_test.py
@@ -84,6 +84,22 @@ class DeviceUtilsGetAVDsTest(mock_calls.TestCase):
device_utils.GetAVDs())
+class DeviceUtilsRestartServerTest(mock_calls.TestCase):
+
+ @mock.patch('time.sleep', mock.Mock())
+ def testRestartServer_succeeds(self):
+ with self.assertCalls(
+ mock.call.pylib.device.adb_wrapper.AdbWrapper.KillServer(),
+ (mock.call.pylib.cmd_helper.GetCmdStatusAndOutput(['pgrep', 'adb']),
+ (1, '')),
+ mock.call.pylib.device.adb_wrapper.AdbWrapper.StartServer(),
+ (mock.call.pylib.cmd_helper.GetCmdStatusAndOutput(['pgrep', 'adb']),
+ (1, '')),
+ (mock.call.pylib.cmd_helper.GetCmdStatusAndOutput(['pgrep', 'adb']),
+ (0, '123\n'))):
+ device_utils.RestartServer()
+
+
class MockTempFile(object):
def __init__(self, name='/tmp/some/file'):
@@ -191,10 +207,10 @@ class DeviceUtilsNewImplTest(mock_calls.TestCase):
self.adb, default_timeout=10, default_retries=0)
self.watchMethodCalls(self.call.adb, ignore=['GetDeviceSerial'])
- def ShellError(self, output=None, exit_code=1):
+ def ShellError(self, output=None, status=1):
def action(cmd, *args, **kwargs):
- raise device_errors.AdbCommandFailedError(
- cmd, output, exit_code, str(self.device))
+ raise device_errors.AdbShellCommandFailedError(
+ cmd, output, status, str(self.device))
if output is None:
output = 'Permission denied\n'
return action
@@ -892,14 +908,12 @@ class DeviceUtilsBroadcastIntentTest(DeviceUtilsNewImplTest):
self.device.BroadcastIntent(test_intent)
-class DeviceUtilsGoHomeTest(DeviceUtilsOldImplTest):
+class DeviceUtilsGoHomeTest(DeviceUtilsNewImplTest):
def testGoHome(self):
- with self.assertCalls(
- "adb -s 0123456789abcdef shell 'am start "
- "-W "
- "-a android.intent.action.MAIN "
- "-c android.intent.category.HOME'",
+ with self.assertCall(
+ self.call.adb.Shell('am start -W -a android.intent.action.MAIN '
+ '-c android.intent.category.HOME'),
'Starting: Intent { act=android.intent.action.MAIN }\r\n'):
self.device.GoHome()
« no previous file with comments | « build/android/pylib/device/device_utils.py ('k') | build/android/pylib/instrumentation/test_options.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698