OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging, time | 5 import logging, time |
6 from autotest_lib.client.bin import test | 6 from autotest_lib.client.bin import test |
7 from autotest_lib.client.common_lib import error, site_power_status | 7 from autotest_lib.client.common_lib import error |
| 8 from autotest_lib.client.cros import power_status |
8 | 9 |
9 | 10 |
10 class power_BatteryCharge(test.test): | 11 class power_BatteryCharge(test.test): |
11 version = 1 | 12 version = 1 |
12 | 13 |
13 def initialize(self): | 14 def initialize(self): |
14 self.status = site_power_status.get_status() | 15 self.status = power_status.get_status() |
15 | 16 |
16 if not self.on_ac(): | 17 if not self.on_ac(): |
17 raise error.TestNAError( | 18 raise error.TestNAError( |
18 'This test needs to be run with the AC power online') | 19 'This test needs to be run with the AC power online') |
19 | 20 |
20 | 21 |
21 def run_once(self, max_run_time=180, percent_charge_to_add=1, | 22 def run_once(self, max_run_time=180, percent_charge_to_add=1, |
22 percent_initial_charge_max=None, | 23 percent_initial_charge_max=None, |
23 percent_target_charge=None): | 24 percent_target_charge=None): |
24 """ | 25 """ |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 keyvals['percent_initial_charge'] = self.initial_charge * 100 / \ | 88 keyvals['percent_initial_charge'] = self.initial_charge * 100 / \ |
88 keyvals['ah_charge_full_design'] | 89 keyvals['ah_charge_full_design'] |
89 keyvals['percent_final_charge'] = keyvals['ah_final_charge'] * 100 / \ | 90 keyvals['percent_final_charge'] = keyvals['ah_final_charge'] * 100 / \ |
90 keyvals['ah_charge_full_design'] | 91 keyvals['ah_charge_full_design'] |
91 | 92 |
92 self.write_perf_keyval(keyvals) | 93 self.write_perf_keyval(keyvals) |
93 | 94 |
94 | 95 |
95 def on_ac(self): | 96 def on_ac(self): |
96 return self.status.linepower[0].online | 97 return self.status.linepower[0].online |
OLD | NEW |