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

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

Issue 3163034: revive power_Backlight test (Closed) Base URL: http://src.chromium.org/git/autotest.git
Patch Set: Created 10 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698