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 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 timeout=10, check_return=True), '22'), | 1546 timeout=10, check_return=True), '22'), |
1547 (self.call.device.RunShellCommand( | 1547 (self.call.device.RunShellCommand( |
1548 ['dumpsys', 'batterystats', '--reset'], check_return=True), []), | 1548 ['dumpsys', 'batterystats', '--reset'], check_return=True), []), |
1549 (self.call.device.RunShellCommand( | 1549 (self.call.device.RunShellCommand( |
1550 ['dumpsys', 'batterystats', '--charged', '--checkin'], | 1550 ['dumpsys', 'batterystats', '--charged', '--checkin'], |
1551 check_return=True), []), | 1551 check_return=True), []), |
1552 (self.call.device.RunShellCommand( | 1552 (self.call.device.RunShellCommand( |
1553 ['dumpsys', 'battery', 'set', 'usb', '0'], check_return=True), []), | 1553 ['dumpsys', 'battery', 'set', 'usb', '0'], check_return=True), []), |
1554 (self.call.device.GetCharging(), False), | 1554 (self.call.device.GetCharging(), False), |
1555 (self.call.device.RunShellCommand( | 1555 (self.call.device.RunShellCommand( |
| 1556 ['dumpsys', 'battery', 'set', 'usb', '1'], check_return=True), []), |
| 1557 (self.call.device.RunShellCommand( |
1556 ['dumpsys', 'battery', 'reset'], check_return=True), []), | 1558 ['dumpsys', 'battery', 'reset'], check_return=True), []), |
1557 (self.call.device.GetCharging(), True)): | 1559 (self.call.device.GetCharging(), True)): |
1558 with self.device.BatteryMeasurement(): | 1560 with self.device.BatteryMeasurement(): |
1559 pass | 1561 pass |
1560 | 1562 |
1561 | 1563 |
1562 class DeviceUtilsStrTest(DeviceUtilsTest): | 1564 class DeviceUtilsStrTest(DeviceUtilsTest): |
1563 | 1565 |
1564 def testStr_returnsSerial(self): | 1566 def testStr_returnsSerial(self): |
1565 with self.assertCalls( | 1567 with self.assertCalls( |
(...skipping 19 matching lines...) Expand all Loading... |
1585 with self.assertCall( | 1587 with self.assertCall( |
1586 mock.call.pylib.device.adb_wrapper.AdbWrapper.GetDevices(), []): | 1588 mock.call.pylib.device.adb_wrapper.AdbWrapper.GetDevices(), []): |
1587 with self.assertRaises(device_errors.NoDevicesError): | 1589 with self.assertRaises(device_errors.NoDevicesError): |
1588 device_utils.DeviceUtils.parallel() | 1590 device_utils.DeviceUtils.parallel() |
1589 | 1591 |
1590 | 1592 |
1591 if __name__ == '__main__': | 1593 if __name__ == '__main__': |
1592 logging.getLogger().setLevel(logging.DEBUG) | 1594 logging.getLogger().setLevel(logging.DEBUG) |
1593 unittest.main(verbosity=2) | 1595 unittest.main(verbosity=2) |
1594 | 1596 |
OLD | NEW |