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 512a7d4b2fc58c6e8128e765cfc940ced8baf282..d4b081127a35f3bed29c08a2b749c0883a166972 100755 |
--- a/build/android/pylib/device/device_utils_test.py |
+++ b/build/android/pylib/device/device_utils_test.py |
@@ -69,6 +69,22 @@ class DeviceUtilsTest(unittest.TestCase): |
device_utils.DeviceUtils('') |
+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'): |