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

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

Issue 724413003: Migrate device_utils.RestartServer to adb_wrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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'):
« build/android/pylib/device/adb_wrapper.py ('K') | « build/android/pylib/device/device_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698