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

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

Issue 6675052: power_LoadTest: Add parameter for custom tasks (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: Fixed delay scaling, changed command names, cleanup Created 9 years, 8 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 utils 5 import 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 7 from autotest_lib.client.common_lib import error
8 8
9 def backlight_tool(args): 9 def backlight_tool(args):
10 cmd = 'backlight-tool %s' % args 10 cmd = 'backlight-tool %s' % args
11 return utils.system_output(cmd) 11 return utils.system_output(cmd)
12 12
13 class hardware_Backlight(test.test): 13 class hardware_Backlight(test.test):
14 version = 1 14 version = 1
15 15
16 def run_once(self): 16 def run_once(self):
17 try: 17 try:
18 brightness = int(backlight_tool("--get_brightness").rstrip()) 18 brightness = int(backlight_tool("--get_brightness").rstrip())
19 except error.CmdError, e: 19 except error.CmdError, e:
20 raise error.TestFail('Cannot get brightness with backlight-tool') 20 raise error.TestFail('Cannot get brightness with backlight-tool')
21 max_brightness = int(backlight_tool("--get_max_brightness").rstrip()) 21 max_brightness = int(backlight_tool("--get_max_brightness").rstrip())
22 logging.debug("max_brightness = %d" % max_brightness)
22 try: 23 try:
23 for i in range(max_brightness + 1): 24 for i in range(max_brightness + 1):
24 backlight_tool("--set_brightness %d" % i) 25 backlight_tool("--set_brightness %d" % i)
25 result = int(backlight_tool("--get_brightness").rstrip()) 26 result = int(backlight_tool("--get_brightness").rstrip())
27 logging.debug("result = %d" % result)
26 if i != result: 28 if i != result:
27 raise error.TestFail('Adjusting backlight should change ' \ 29 raise error.TestFail('Adjusting backlight should change ' \
28 'actual brightness') 30 'actual brightness')
29 finally: 31 finally:
30 backlight_tool("--set_brightness %d" % brightness) 32 backlight_tool("--set_brightness %d" % brightness)
OLDNEW
« no previous file with comments | « no previous file | client/site_tests/power_LoadTest/control » ('j') | client/site_tests/power_LoadTest/extension/background.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698