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

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

Issue 5740004: Move site_chrome_test, site_logging, site_log_reader, site_crash_test into cros dir. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 11 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, shutil, sys, time 5 import logging, os, shutil, sys, time
6 from autotest_lib.client.bin import site_backchannel, utils 6 from autotest_lib.client.bin import site_backchannel, utils
7 from autotest_lib.client.common_lib import error, site_power_status 7 from autotest_lib.client.common_lib import error, site_power_status
8 from autotest_lib.client.cros import httpd, login, ui, ui_test 8 from autotest_lib.client.cros import cros_ui_test, httpd, login, ui
9 9
10 sys.path.append(os.environ.get('SYSROOT', '') + '/usr/local/lib/flimflam/test') 10 sys.path.append(os.environ.get('SYSROOT', '') + '/usr/local/lib/flimflam/test')
11 import flimflam 11 import flimflam
12 12
13 13
14 params_dict = { 14 params_dict = {
15 'test_time_ms': '_mseconds', 15 'test_time_ms': '_mseconds',
16 'should_scroll': '_should_scroll', 16 'should_scroll': '_should_scroll',
17 'should_scroll_up': '_should_scroll_up', 17 'should_scroll_up': '_should_scroll_up',
18 'scroll_loop': '_scroll_loop', 18 'scroll_loop': '_scroll_loop',
19 'scroll_interval_ms': '_scroll_interval_ms', 19 'scroll_interval_ms': '_scroll_interval_ms',
20 'scroll_by_pixels': '_scroll_by_pixels', 20 'scroll_by_pixels': '_scroll_by_pixels',
21 } 21 }
22 22
23 23
24 class power_LoadTest(ui_test.UITest): 24 class power_LoadTest(cros_ui_test.UITest):
25 version = 2 25 version = 2
26 26
27
27 def ensure_login_complete(self): 28 def ensure_login_complete(self):
28 """ 29 """
29 Override ui_test.UITest's ensure_login_complete. 30 Override cros_ui_test.UITest's ensure_login_complete.
30 Do not use auth server and local dns for our test. We need to be 31 Do not use auth server and local dns for our test. We need to be
31 able to reach the web. 32 able to reach the web.
32 """ 33 """
33 pass 34 pass
34 35
36
35 def initialize(self, creds='$default', percent_initial_charge_min=None, 37 def initialize(self, creds='$default', percent_initial_charge_min=None,
36 check_network=True, loop_time=3600, loop_count=1, 38 check_network=True, loop_time=3600, loop_count=1,
37 should_scroll='true', should_scroll_up='true', 39 should_scroll='true', should_scroll_up='true',
38 scroll_loop='false', scroll_interval_ms='10000', 40 scroll_loop='false', scroll_interval_ms='10000',
39 scroll_by_pixels='600', low_battery_threshold=3, 41 scroll_by_pixels='600', low_battery_threshold=3,
40 verbose=True, force_wifi=False, wifi_ap='', wifi_sec='none', 42 verbose=True, force_wifi=False, wifi_ap='', wifi_sec='none',
41 wifi_pw=''): 43 wifi_pw=''):
42 44
43 """ 45 """
44 percent_initial_charge_min: min battery charge at start of test 46 percent_initial_charge_min: min battery charge at start of test
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 139
138 140
139 self._usb_stats.refresh() 141 self._usb_stats.refresh()
140 self._cpufreq_stats.refresh() 142 self._cpufreq_stats.refresh()
141 self._cpuidle_stats.refresh() 143 self._cpuidle_stats.refresh()
142 self._power_status.refresh() 144 self._power_status.refresh()
143 145
144 self._ah_charge_start = self._power_status.battery[0].charge_now 146 self._ah_charge_start = self._power_status.battery[0].charge_now
145 self._wh_energy_start = self._power_status.battery[0].energy 147 self._wh_energy_start = self._power_status.battery[0].energy
146 148
147 # from ui_test.UITest.initialize, sans authserver & local dns. 149 # from cros_ui_test.UITest.initialize, sans authserver & local dns.
148 (self.username, self.password) = self._UITest__resolve_creds(creds) 150 (self.username, self.password) = self._UITest__resolve_creds(creds)
149 151
150 def run_once(self): 152 def run_once(self):
151 153
152 t0 = time.time() 154 t0 = time.time()
153 155
154 for i in range(self._loop_count): 156 for i in range(self._loop_count):
155 # the power test extension will report its status here 157 # the power test extension will report its status here
156 latch = self._testServer.add_wait_url('/status') 158 latch = self._testServer.add_wait_url('/status')
157 159
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 # set backlight level to 40% of max 323 # set backlight level to 40% of max
322 cmd = 'backlight-tool --set_brightness %d ' % ( 324 cmd = 'backlight-tool --set_brightness %d ' % (
323 int(self._max_backlight * 0.4)) 325 int(self._max_backlight * 0.4))
324 os.system(cmd) 326 os.system(cmd)
325 327
326 # record brightness level 328 # record brightness level
327 cmd = 'backlight-tool --get_brightness' 329 cmd = 'backlight-tool --get_brightness'
328 level = int(utils.system_output(cmd).rstrip()) 330 level = int(utils.system_output(cmd).rstrip())
329 logging.info('backlight level is %d' % level) 331 logging.info('backlight level is %d' % level)
330 self._tmp_keyvals['level_backlight_current'] = level 332 self._tmp_keyvals['level_backlight_current'] = level
OLDNEW
« no previous file with comments | « client/site_tests/power_Idle/power_Idle.py ('k') | client/site_tests/security_NetworkListeners/security_NetworkListeners.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698