Chromium Code Reviews| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 732 | 732 |
| 733 | 733 |
| 734 class DeviceUtilsGetDevicePieWrapper(DeviceUtilsTest): | 734 class DeviceUtilsGetDevicePieWrapper(DeviceUtilsTest): |
| 735 | 735 |
| 736 def testGetDevicePieWrapper_jb(self): | 736 def testGetDevicePieWrapper_jb(self): |
| 737 with self.assertCall( | 737 with self.assertCall( |
| 738 self.call.device.build_version_sdk(), | 738 self.call.device.build_version_sdk(), |
| 739 constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN): | 739 constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN): |
| 740 self.assertEqual('', self.device.GetDevicePieWrapper()) | 740 self.assertEqual('', self.device.GetDevicePieWrapper()) |
| 741 | 741 |
| 742 def testGetDevicePieWrapper_ics(self): | |
|
jbudorick
2015/05/11 17:38:36
Removing the test but not the code isn't quite rig
| |
| 743 with self.assertCalls( | |
| 744 (self.call.device.build_version_sdk(), | |
| 745 constants.ANDROID_SDK_VERSION_CODES.ICE_CREAM_SANDWICH), | |
| 746 (mock.call.pylib.constants.GetOutDirectory(), '/foo/bar'), | |
| 747 (mock.call.os.path.exists(mock.ANY), True), | |
| 748 (self.call.adb.Push(mock.ANY, mock.ANY), '')): | |
| 749 self.assertNotEqual('', self.device.GetDevicePieWrapper()) | |
| 750 | |
| 751 | 742 |
| 752 @mock.patch('time.sleep', mock.Mock()) | 743 @mock.patch('time.sleep', mock.Mock()) |
| 753 class DeviceUtilsKillAllTest(DeviceUtilsTest): | 744 class DeviceUtilsKillAllTest(DeviceUtilsTest): |
| 754 | 745 |
| 755 def testKillAll_noMatchingProcessesFailure(self): | 746 def testKillAll_noMatchingProcessesFailure(self): |
| 756 with self.assertCall(self.call.device.GetPids('test_process'), {}): | 747 with self.assertCall(self.call.device.GetPids('test_process'), {}): |
| 757 with self.assertRaises(device_errors.CommandFailedError): | 748 with self.assertRaises(device_errors.CommandFailedError): |
| 758 self.device.KillAll('test_process') | 749 self.device.KillAll('test_process') |
| 759 | 750 |
| 760 def testKillAll_noMatchingProcessesQuiet(self): | 751 def testKillAll_noMatchingProcessesQuiet(self): |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1691 devices = device_utils.DeviceUtils.HealthyDevices() | 1682 devices = device_utils.DeviceUtils.HealthyDevices() |
| 1692 self.assertEquals(1, len(devices)) | 1683 self.assertEquals(1, len(devices)) |
| 1693 self.assertTrue(isinstance(devices[0], device_utils.DeviceUtils)) | 1684 self.assertTrue(isinstance(devices[0], device_utils.DeviceUtils)) |
| 1694 self.assertEquals('0123456789abcdef', devices[0].adb.GetDeviceSerial()) | 1685 self.assertEquals('0123456789abcdef', devices[0].adb.GetDeviceSerial()) |
| 1695 | 1686 |
| 1696 | 1687 |
| 1697 if __name__ == '__main__': | 1688 if __name__ == '__main__': |
| 1698 logging.getLogger().setLevel(logging.DEBUG) | 1689 logging.getLogger().setLevel(logging.DEBUG) |
| 1699 unittest.main(verbosity=2) | 1690 unittest.main(verbosity=2) |
| 1700 | 1691 |
| OLD | NEW |