| 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, os, time, utils | 5 import logging, os, time, utils |
| 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, site_ui, \ | 7 from autotest_lib.client.common_lib import error, site_power_status, site_ui, \ |
| 8 utils | 8 utils |
| 9 | 9 |
| 10 class power_Backlight(test.test): | 10 class power_Backlight(test.test): |
| 11 version = 1 | 11 version = 1 |
| 12 | 12 |
| 13 | 13 |
| 14 def run_once(self, delay=60, seconds=10, tries=20): | 14 def run_once(self, delay=60, seconds=10, tries=20): |
| 15 # disable screen locker | 15 # disable screen locker and powerd |
| 16 os.system('stop screen-locker') | 16 os.system('stop screen-locker') |
| 17 os.system('stop powerd') |
| 17 | 18 |
| 18 # disable screen blanking. Stopping screen-locker isn't | 19 # disable screen blanking. Stopping screen-locker isn't |
| 19 # synchronous :(. Add a sleep for now, till powerd comes around | 20 # synchronous :(. Add a sleep for now, till powerd comes around |
| 20 # and fixes all this for us. | 21 # and fixes all this for us. |
| 21 # TODO(davidjames): Power manager should support this feature directly | 22 # TODO(davidjames): Power manager should support this feature directly |
| 22 time.sleep(5) | 23 time.sleep(5) |
| 23 site_ui.xsystem('xset s off') | 24 site_ui.xsystem('xset s off') |
| 24 site_ui.xsystem('xset dpms 0 0 0') | 25 site_ui.xsystem('xset dpms 0 0 0') |
| 25 site_ui.xsystem('xset -dpms') | 26 site_ui.xsystem('xset -dpms') |
| 26 | 27 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 49 keyvals['w_bl_%d_rate' % i] = rate | 50 keyvals['w_bl_%d_rate' % i] = rate |
| 50 rates.append(rate) | 51 rates.append(rate) |
| 51 self.write_perf_keyval(keyvals) | 52 self.write_perf_keyval(keyvals) |
| 52 for i in range(1, len(levels)): | 53 for i in range(1, len(levels)): |
| 53 if rates[i] <= rates[i-1]: | 54 if rates[i] <= rates[i-1]: |
| 54 raise error.TestFail('Turning up the backlight ' \ | 55 raise error.TestFail('Turning up the backlight ' \ |
| 55 'should increase energy consumption') | 56 'should increase energy consumption') |
| 56 | 57 |
| 57 | 58 |
| 58 def cleanup(self): | 59 def cleanup(self): |
| 59 # Re-enable screen locker. This also re-enables dpms. | 60 # Re-enable screen locker and powerd. This also re-enables dpms. |
| 60 utils.system('start screen-locker') | 61 os.system('start powerd') |
| 62 os.system('start screen-locker') |
| 61 | 63 |
| OLD | NEW |