OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """ | 6 """ |
7 Unit tests for the contents of device_utils.py (mostly DeviceUtils). | 7 Unit tests for the contents of device_utils.py (mostly DeviceUtils). |
8 """ | 8 """ |
9 | 9 |
10 # pylint: disable=C0321 | 10 # pylint: disable=C0321 |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 with self.assertCall( | 1397 with self.assertCall( |
1398 mock.call.pylib.device.adb_wrapper.AdbWrapper.GetDevices(), | 1398 mock.call.pylib.device.adb_wrapper.AdbWrapper.GetDevices(), |
1399 [_AdbWrapperMock(serial) for serial in test_serials]): | 1399 [_AdbWrapperMock(serial) for serial in test_serials]): |
1400 parallel_devices = device_utils.DeviceUtils.parallel() | 1400 parallel_devices = device_utils.DeviceUtils.parallel() |
1401 for serial, device in zip(test_serials, parallel_devices.pGet(None)): | 1401 for serial, device in zip(test_serials, parallel_devices.pGet(None)): |
1402 self.assertTrue( | 1402 self.assertTrue( |
1403 isinstance(device, device_utils.DeviceUtils) | 1403 isinstance(device, device_utils.DeviceUtils) |
1404 and serial == str(device), | 1404 and serial == str(device), |
1405 'Expected a DeviceUtils object with serial %s' % serial) | 1405 'Expected a DeviceUtils object with serial %s' % serial) |
1406 | 1406 |
| 1407 def testParallel_noDevices(self): |
| 1408 with self.assertCall( |
| 1409 mock.call.pylib.device.adb_wrapper.AdbWrapper.GetDevices(), []): |
| 1410 with self.assertRaises(device_errors.NoDevicesError): |
| 1411 device_utils.DeviceUtils.parallel() |
| 1412 |
1407 | 1413 |
1408 if __name__ == '__main__': | 1414 if __name__ == '__main__': |
1409 logging.getLogger().setLevel(logging.DEBUG) | 1415 logging.getLogger().setLevel(logging.DEBUG) |
1410 unittest.main(verbosity=2) | 1416 unittest.main(verbosity=2) |
1411 | 1417 |
OLD | NEW |