Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: client/site_tests/power_Backlight/power_Backlight.py

Issue 6627029: Refactor site_power_status, power_strip modules into client/cros. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 5 import logging, os, time
6 from autotest_lib.client.bin import test, utils 6 from autotest_lib.client.bin import test, utils
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 cros_ui 8 from autotest_lib.client.cros import cros_ui, power_status
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 powerd 15 # disable powerd
16 os.system('stop powerd') 16 os.system('stop powerd')
17 17
18 # disable screen blanking. Stopping screen-locker isn't 18 # disable screen blanking. Stopping screen-locker isn't
19 # synchronous :(. Add a sleep for now, till powerd comes around 19 # synchronous :(. Add a sleep for now, till powerd comes around
20 # and fixes all this for us. 20 # and fixes all this for us.
21 # TODO(davidjames): Power manager should support this feature directly 21 # TODO(davidjames): Power manager should support this feature directly
22 time.sleep(5) 22 time.sleep(5)
23 cros_ui.xsystem('LD_LIBRARY_PATH=/usr/local/lib ' + 'xset s off') 23 cros_ui.xsystem('LD_LIBRARY_PATH=/usr/local/lib ' + 'xset s off')
24 cros_ui.xsystem('LD_LIBRARY_PATH=/usr/local/lib ' + 'xset dpms 0 0 0') 24 cros_ui.xsystem('LD_LIBRARY_PATH=/usr/local/lib ' + 'xset dpms 0 0 0')
25 cros_ui.xsystem('LD_LIBRARY_PATH=/usr/local/lib ' + 'xset -dpms') 25 cros_ui.xsystem('LD_LIBRARY_PATH=/usr/local/lib ' + 'xset -dpms')
26 26
27 status = site_power_status.get_status() 27 status = power_status.get_status()
28 if status.linepower[0].online: 28 if status.linepower[0].online:
29 raise error.TestFail('Machine must be unplugged') 29 raise error.TestFail('Machine must be unplugged')
30 30
31 cmd = 'backlight-tool --get_max_brightness' 31 cmd = 'backlight-tool --get_max_brightness'
32 max_brightness = int(utils.system_output(cmd).rstrip()) 32 max_brightness = int(utils.system_output(cmd).rstrip())
33 if max_brightness < 4: 33 if max_brightness < 4:
34 raise error.TestFail('Must have at least 5 backlight levels') 34 raise error.TestFail('Must have at least 5 backlight levels')
35 keyvals = {} 35 keyvals = {}
36 rates = [] 36 rates = []
37 37
(...skipping 12 matching lines...) Expand all
50 self.write_perf_keyval(keyvals) 50 self.write_perf_keyval(keyvals)
51 for i in range(1, len(levels)): 51 for i in range(1, len(levels)):
52 if rates[i] <= rates[i-1]: 52 if rates[i] <= rates[i-1]:
53 raise error.TestFail('Turning up the backlight ' \ 53 raise error.TestFail('Turning up the backlight ' \
54 'should increase energy consumption') 54 'should increase energy consumption')
55 55
56 56
57 def cleanup(self): 57 def cleanup(self):
58 # Re-enable screen locker and powerd. This also re-enables dpms. 58 # Re-enable screen locker and powerd. This also re-enables dpms.
59 os.system('start powerd') 59 os.system('start powerd')
OLDNEW
« no previous file with comments | « client/site_tests/power_ARMSettings/power_ARMSettings.py ('k') | client/site_tests/power_BatteryCharge/control » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698