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 b7e807e06d74cf063d247e10b99c93fe870b4b5c..373a15e196bfee02f0464135d40fb4690e226e2f 100755 |
--- a/build/android/pylib/device/device_utils_test.py |
+++ b/build/android/pylib/device/device_utils_test.py |
@@ -1468,6 +1468,27 @@ class DeviceUtilsSetChargingTest(DeviceUtilsTest): |
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', 'reset'], check_return=True), []), |
+ (self.call.device.GetCharging(), True)): |
+ with self.device.BatteryMeasurement(): |
+ pass |
+ |
class DeviceUtilsStrTest(DeviceUtilsTest): |