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

Unified Diff: devil/devil/android/sdk/adb_wrapper_test.py

Issue 3002993002: devil: Raise DeviceUnreachableError on cmd output "waiting for device" (Closed)
Patch Set: cmnt Created 3 years, 4 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 | « devil/devil/android/sdk/adb_wrapper.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/android/sdk/adb_wrapper_test.py
diff --git a/devil/devil/android/sdk/adb_wrapper_test.py b/devil/devil/android/sdk/adb_wrapper_test.py
index ef08661208d8fe96e28cdda09dadcca79f16d478..07f784d05784e19dde9abf9cc1c678e0450aadb0 100755
--- a/devil/devil/android/sdk/adb_wrapper_test.py
+++ b/devil/devil/android/sdk/adb_wrapper_test.py
@@ -19,7 +19,8 @@ with devil_env.SysPath(devil_env.PYMOCK_PATH):
class AdbWrapperTest(unittest.TestCase):
def setUp(self):
- self.adb = adb_wrapper.AdbWrapper('ABC12345678')
+ self.device_serial = 'ABC12345678'
+ self.adb = adb_wrapper.AdbWrapper(self.device_serial)
def _MockRunDeviceAdbCmd(self, return_value):
return mock.patch.object(
@@ -57,3 +58,15 @@ class AdbWrapperTest(unittest.TestCase):
self.assertRaises(
device_errors.AdbCommandFailedError, self.adb.DisableVerity)
+ @mock.patch('devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout')
+ def testDeviceUnreachable(self, get_cmd_mock):
+ get_cmd_mock.return_value = (
+ 1, "error: device '%s' not found" % self.device_serial)
+ self.assertRaises(
+ device_errors.DeviceUnreachableError, self.adb.Shell, '/bin/true')
+
+ @mock.patch('devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout')
+ def testWaitingForDevice(self, get_cmd_mock):
+ get_cmd_mock.return_value = (1, '- waiting for device - ')
+ self.assertRaises(
+ device_errors.DeviceUnreachableError, self.adb.Shell, '/bin/true')
« no previous file with comments | « devil/devil/android/sdk/adb_wrapper.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698