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 14aef954a9aaf62fac2d60b90e4cd3df537089c0..349bf41fe90b8a759150ae690f2f3f9f5421ce1b 100755 |
--- a/build/android/pylib/device/device_utils_test.py |
+++ b/build/android/pylib/device/device_utils_test.py |
@@ -1451,116 +1451,6 @@ class DeviceUtilsGetMemoryUsageForPidTest(DeviceUtilsTest): |
self.device.GetMemoryUsageForPid(4321)) |
-class DeviceUtilsGetBatteryInfoTest(DeviceUtilsTest): |
- def testGetBatteryInfo_normal(self): |
- with self.assertCall( |
- self.call.device.RunShellCommand( |
- ['dumpsys', 'battery'], check_return=True), |
- [ |
- 'Current Battery Service state:', |
- ' AC powered: false', |
- ' USB powered: true', |
- ' level: 100', |
- ' temperature: 321', |
- ]): |
- self.assertEquals( |
- { |
- 'AC powered': 'false', |
- 'USB powered': 'true', |
- 'level': '100', |
- 'temperature': '321', |
- }, |
- self.device.GetBatteryInfo()) |
- |
- |
- def testGetBatteryInfo_nothing(self): |
- with self.assertCall( |
- self.call.device.RunShellCommand( |
- ['dumpsys', 'battery'], check_return=True), []): |
- self.assertEquals({}, self.device.GetBatteryInfo()) |
- |
- |
-class DeviceUtilsGetChargingTest(DeviceUtilsTest): |
- def testGetCharging_usb(self): |
- with self.assertCall( |
- self.call.device.GetBatteryInfo(), {'USB powered': 'true'}): |
- self.assertTrue(self.device.GetCharging()) |
- |
- def testGetCharging_usbFalse(self): |
- with self.assertCall( |
- self.call.device.GetBatteryInfo(), {'USB powered': 'false'}): |
- self.assertFalse(self.device.GetCharging()) |
- |
- def testGetCharging_ac(self): |
- with self.assertCall( |
- self.call.device.GetBatteryInfo(), {'AC powered': 'true'}): |
- self.assertTrue(self.device.GetCharging()) |
- |
- def testGetCharging_wireless(self): |
- with self.assertCall( |
- self.call.device.GetBatteryInfo(), {'Wireless powered': 'true'}): |
- self.assertTrue(self.device.GetCharging()) |
- |
- def testGetCharging_unknown(self): |
- with self.assertCall( |
- self.call.device.GetBatteryInfo(), {'level': '42'}): |
- self.assertFalse(self.device.GetCharging()) |
- |
- |
-class DeviceUtilsSetChargingTest(DeviceUtilsTest): |
- |
- @mock.patch('time.sleep', mock.Mock()) |
- def testSetCharging_enabled(self): |
- with self.assertCalls( |
- (self.call.device.FileExists(mock.ANY), True), |
- (self.call.device.RunShellCommand(mock.ANY, check_return=True), []), |
- (self.call.device.GetCharging(), False), |
- (self.call.device.RunShellCommand(mock.ANY, check_return=True), []), |
- (self.call.device.GetCharging(), True)): |
- self.device.SetCharging(True) |
- |
- def testSetCharging_alreadyEnabled(self): |
- with self.assertCalls( |
- (self.call.device.FileExists(mock.ANY), True), |
- (self.call.device.RunShellCommand(mock.ANY, check_return=True), []), |
- (self.call.device.GetCharging(), True)): |
- self.device.SetCharging(True) |
- |
- @mock.patch('time.sleep', mock.Mock()) |
- def testSetCharging_disabled(self): |
- with self.assertCalls( |
- (self.call.device.FileExists(mock.ANY), True), |
- (self.call.device.RunShellCommand(mock.ANY, check_return=True), []), |
- (self.call.device.GetCharging(), True), |
- (self.call.device.RunShellCommand(mock.ANY, check_return=True), []), |
- (self.call.device.GetCharging(), False)): |
- self.device.SetCharging(False) |
- |
- |
-class DeviceUtilsSetBatteryMeasurementTest(DeviceUtilsTest): |
- |
- def testBatteryMeasurement(self): |
- with self.assertCalls( |
- (self.call.device.RunShellCommand( |
- mock.ANY, retries=0, single_line=True, |
- timeout=10, check_return=True), '22'), |
- (self.call.device.RunShellCommand( |
- ['dumpsys', 'batterystats', '--reset'], check_return=True), []), |
- (self.call.device.RunShellCommand( |
- ['dumpsys', 'batterystats', '--charged', '--checkin'], |
- check_return=True), []), |
- (self.call.device.RunShellCommand( |
- ['dumpsys', 'battery', 'set', 'usb', '0'], check_return=True), []), |
- (self.call.device.GetCharging(), False), |
- (self.call.device.RunShellCommand( |
- ['dumpsys', 'battery', 'set', 'usb', '1'], check_return=True), []), |
- (self.call.device.RunShellCommand( |
- ['dumpsys', 'battery', 'reset'], check_return=True), []), |
- (self.call.device.GetCharging(), True)): |
- with self.device.BatteryMeasurement(): |
- pass |
- |
- |
class DeviceUtilsStrTest(DeviceUtilsTest): |
def testStr_returnsSerial(self): |