Chromium Code Reviews| 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 and powerd | 15 # disable powerd |
| 16 os.system('stop screen-locker') | |
| 17 os.system('stop powerd') | 16 os.system('stop powerd') |
| 18 | 17 |
| 19 # disable screen blanking. Stopping screen-locker isn't | 18 # disable screen blanking. Stopping screen-locker isn't |
| 20 # synchronous :(. Add a sleep for now, till powerd comes around | 19 # synchronous :(. Add a sleep for now, till powerd comes around |
| 21 # and fixes all this for us. | 20 # and fixes all this for us. |
| 22 # TODO(davidjames): Power manager should support this feature directly | 21 # TODO(davidjames): Power manager should support this feature directly |
| 23 time.sleep(5) | 22 time.sleep(5) |
| 24 site_ui.xsystem('xset s off') | 23 site_ui.xsystem('LD_LIBRARY_PATH=/usr/local/lib ' + 'xset s off') |
| 25 site_ui.xsystem('xset dpms 0 0 0') | 24 site_ui.xsystem('LD_LIBRARY_PATH=/usr/local/lib ' + 'xset dpms 0 0 0') |
| 26 site_ui.xsystem('xset -dpms') | 25 site_ui.xsystem('LD_LIBRARY_PATH=/usr/local/lib ' + 'xset -dpms') |
|
Sameer Nanda
2010/08/25 20:48:48
The three xset calls can be taken out now since po
| |
| 27 | 26 |
| 28 status = site_power_status.get_status() | 27 status = site_power_status.get_status() |
| 29 if status.linepower[0].online: | 28 if status.linepower[0].online: |
| 30 raise error.TestFail('Machine must be unplugged') | 29 raise error.TestFail('Machine must be unplugged') |
| 31 | 30 |
| 32 cmd = 'backlight-tool --get_max_brightness' | 31 cmd = 'backlight-tool --get_max_brightness' |
| 33 max_brightness = int(utils.system_output(cmd).rstrip()) | 32 max_brightness = int(utils.system_output(cmd).rstrip()) |
| 34 if max_brightness < 4: | 33 if max_brightness < 4: |
| 35 raise error.TestFail('Must have at least 5 backlight levels') | 34 raise error.TestFail('Must have at least 5 backlight levels') |
| 36 keyvals = {} | 35 keyvals = {} |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 52 self.write_perf_keyval(keyvals) | 51 self.write_perf_keyval(keyvals) |
| 53 for i in range(1, len(levels)): | 52 for i in range(1, len(levels)): |
| 54 if rates[i] <= rates[i-1]: | 53 if rates[i] <= rates[i-1]: |
| 55 raise error.TestFail('Turning up the backlight ' \ | 54 raise error.TestFail('Turning up the backlight ' \ |
| 56 'should increase energy consumption') | 55 'should increase energy consumption') |
| 57 | 56 |
| 58 | 57 |
| 59 def cleanup(self): | 58 def cleanup(self): |
| 60 # Re-enable screen locker and powerd. This also re-enables dpms. | 59 # Re-enable screen locker and powerd. This also re-enables dpms. |
| 61 os.system('start powerd') | 60 os.system('start powerd') |
| 62 os.system('start screen-locker') | |
| 63 | 61 |
| OLD | NEW |