| 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 battery_utils.py | 7 Unit tests for the contents of battery_utils.py |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 # pylint: disable=W0613 | 10 # pylint: disable=W0613 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 with self.assertCalls( | 108 with self.assertCalls( |
| 109 (self.call.device.RunShellCommand( | 109 (self.call.device.RunShellCommand( |
| 110 mock.ANY, retries=0, single_line=True, | 110 mock.ANY, retries=0, single_line=True, |
| 111 timeout=10, check_return=True), '22'), | 111 timeout=10, check_return=True), '22'), |
| 112 (self.call.device.RunShellCommand( | 112 (self.call.device.RunShellCommand( |
| 113 ['dumpsys', 'battery', 'reset'], check_return=True), []), | 113 ['dumpsys', 'battery', 'reset'], check_return=True), []), |
| 114 (self.call.device.RunShellCommand( | 114 (self.call.device.RunShellCommand( |
| 115 ['dumpsys', 'batterystats', '--reset'], check_return=True), []), | 115 ['dumpsys', 'batterystats', '--reset'], check_return=True), []), |
| 116 (self.call.device.RunShellCommand( | 116 (self.call.device.RunShellCommand( |
| 117 ['dumpsys', 'batterystats', '--charged', '--checkin'], | 117 ['dumpsys', 'batterystats', '--charged', '--checkin'], |
| 118 check_return=True), []), | 118 check_return=True, large_output=True), []), |
| 119 (self.call.device.RunShellCommand( | 119 (self.call.device.RunShellCommand( |
| 120 ['dumpsys', 'battery', 'set', 'ac', '0'], check_return=True), []), | 120 ['dumpsys', 'battery', 'set', 'ac', '0'], check_return=True), []), |
| 121 (self.call.device.RunShellCommand( | 121 (self.call.device.RunShellCommand( |
| 122 ['dumpsys', 'battery', 'set', 'usb', '0'], check_return=True), []), | 122 ['dumpsys', 'battery', 'set', 'usb', '0'], check_return=True), []), |
| 123 (self.call.battery.GetCharging(), False), | 123 (self.call.battery.GetCharging(), False), |
| 124 (self.call.device.RunShellCommand( | 124 (self.call.device.RunShellCommand( |
| 125 ['dumpsys', 'battery', 'reset'], check_return=True), []), | 125 ['dumpsys', 'battery', 'reset'], check_return=True), []), |
| 126 (self.call.battery.GetCharging(), True)): | 126 (self.call.battery.GetCharging(), True)): |
| 127 with self.battery.BatteryMeasurement(): | 127 with self.battery.BatteryMeasurement(): |
| 128 pass | 128 pass |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 @mock.patch('time.sleep', mock.Mock()) | 319 @mock.patch('time.sleep', mock.Mock()) |
| 320 def testLetBatteryCoolToTemperature_startOver(self): | 320 def testLetBatteryCoolToTemperature_startOver(self): |
| 321 with self.assertCalls( | 321 with self.assertCalls( |
| 322 (self.call.battery.GetBatteryInfo(), {'temperature': '500'}), | 322 (self.call.battery.GetBatteryInfo(), {'temperature': '500'}), |
| 323 (self.call.battery.GetBatteryInfo(), {'temperature': '400'})): | 323 (self.call.battery.GetBatteryInfo(), {'temperature': '400'})): |
| 324 self.battery.LetBatteryCoolToTemperature(400) | 324 self.battery.LetBatteryCoolToTemperature(400) |
| 325 | 325 |
| 326 if __name__ == '__main__': | 326 if __name__ == '__main__': |
| 327 logging.getLogger().setLevel(logging.DEBUG) | 327 logging.getLogger().setLevel(logging.DEBUG) |
| 328 unittest.main(verbosity=2) | 328 unittest.main(verbosity=2) |
| OLD | NEW |