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

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

Issue 796663002: Update from https://crrev.com/307758 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Updates for SkCanvas::NewRaster deprecation 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
« no previous file with comments | « build/android/pylib/device/device_utils.py ('k') | build/android/pylib/utils/device_temp_file.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 c451ef38912762628d872196773c29523c9796fe..2646bfb53c7e220a96dfb62d468993c4275d84c6 100755
--- a/build/android/pylib/device/device_utils_test.py
+++ b/build/android/pylib/device/device_utils_test.py
@@ -254,13 +254,18 @@ class DeviceUtilsOldImplTest(unittest.TestCase):
def tearDown(self):
self._get_adb_path_patch.stop()
+
+def _AdbWrapperMock(test_serial):
+ adb = mock.Mock(spec=adb_wrapper.AdbWrapper)
+ adb.__str__ = mock.Mock(return_value=test_serial)
+ adb.GetDeviceSerial.return_value = test_serial
+ return adb
+
+
class DeviceUtilsNewImplTest(mock_calls.TestCase):
def setUp(self):
- test_serial = '0123456789abcdef'
- self.adb = mock.Mock(spec=adb_wrapper.AdbWrapper)
- self.adb.__str__ = mock.Mock(return_value=test_serial)
- self.adb.GetDeviceSerial.return_value = test_serial
+ self.adb = _AdbWrapperMock('0123456789abcdef')
self.device = device_utils.DeviceUtils(
self.adb, default_timeout=10, default_retries=0)
self.watchMethodCalls(self.call.adb, ignore=['GetDeviceSerial'])
@@ -1181,7 +1186,7 @@ class DeviceUtilsWriteFileTest(DeviceUtilsNewImplTest):
with self.assertCalls(
(mock.call.tempfile.NamedTemporaryFile(), tmp_host),
(self.call.device.NeedsSU(), True),
- (mock.call.pylib.utils.device_temp_file.DeviceTempFile(self.device),
+ (mock.call.pylib.utils.device_temp_file.DeviceTempFile(self.adb),
MockTempFile('/external/path/tmp/on.device')),
self.call.adb.Push('/tmp/file/on.host', '/external/path/tmp/on.device'),
self.call.device.RunShellCommand(
@@ -1518,6 +1523,21 @@ class DeviceUtilsStrTest(DeviceUtilsNewImplTest):
self.assertEqual('0123456789abcdef', str(self.device))
+class DeviceUtilsParallelTest(mock_calls.TestCase):
+
+ def testParallel_default(self):
+ test_serials = ['0123456789abcdef', 'fedcba9876543210']
+ with self.assertCall(
+ mock.call.pylib.device.adb_wrapper.AdbWrapper.GetDevices(),
+ [_AdbWrapperMock(serial) for serial in test_serials]):
+ parallel_devices = device_utils.DeviceUtils.parallel()
+ for serial, device in zip(test_serials, parallel_devices.pGet(None)):
+ self.assertTrue(
+ isinstance(device, device_utils.DeviceUtils)
+ and serial == str(device),
+ 'Expected a DeviceUtils object with serial %s' % serial)
+
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.DEBUG)
unittest.main(verbosity=2)
« no previous file with comments | « build/android/pylib/device/device_utils.py ('k') | build/android/pylib/utils/device_temp_file.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698