Index: chrome/test/pyautolib/pyauto.py |
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py |
index edb424356cdb7a6f42977c02ac0d607d58dac472..390c9bc29d42c677dcfe5a867f170eea716c8236 100644 |
--- a/chrome/test/pyautolib/pyauto.py |
+++ b/chrome/test/pyautolib/pyauto.py |
@@ -2371,6 +2371,27 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): |
cmd_dict = { 'command': 'SignoutInScreenLocker' } |
self._GetResultFromJSONRequest(cmd_dict, windex=-1) |
+ def GetBatteryInfo(self): |
+ """Get details about battery state. |
+ |
+ Returns: |
+ A dictionary. |
+ Sample: |
+ { u'battery': True, |
+ u'line_power': False, |
+ u'time_left': 29617, # 0 if the time left is still being calculated. |
Nirnimesh
2011/03/29 01:29:39
Using 0 for 'still being calculated' case is incor
dtu
2011/03/29 02:21:22
Done. Key will be absent in the 'still being calcu
|
+ u'percentage': 100.0, |
+ u'charged': False } |
+ |
+ Use 'charged' instead of 'percentage' to determine whether the |
+ battery is fully charged, since the percentage is only approximate. |
+ |
krisr
2011/03/29 01:02:01
I actually had to look at the device to see how th
dtu
2011/03/29 02:21:22
Comment expanded. I also changed it so fields only
|
+ Raises: |
+ pyauto_errors.JSONInterfaceError if the automation call returns an error. |
+ """ |
+ cmd_dict = { 'command': 'GetBatteryInfo' } |
+ return self._GetResultFromJSONRequest(cmd_dict, windex=-1) |
+ |
def GetNetworkInfo(self): |
"""Get details about ethernet, wifi, and cellular networks on chromeos. |