OLD | NEW |
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2011 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, time | 5 import logging, os, shutil, time |
6 from autotest_lib.client.bin import utils | 6 from autotest_lib.client.bin import 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 backchannel, cros_ui, cros_ui_test | 8 from autotest_lib.client.cros import backchannel, cros_ui, cros_ui_test |
9 from autotest_lib.client.cros import httpd, login | 9 from autotest_lib.client.cros import httpd, login |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 # specified WiFi AP. | 83 # specified WiFi AP. |
84 if self._force_wifi: | 84 if self._force_wifi: |
85 # If backchannel is already running, don't run it again. | 85 # If backchannel is already running, don't run it again. |
86 if not backchannel.setup(): | 86 if not backchannel.setup(): |
87 raise error.TestError('Could not setup Backchannel network.') | 87 raise error.TestError('Could not setup Backchannel network.') |
88 | 88 |
89 # Note: FlimFlam is flaky after Backchannel setup sometimes. It may | 89 # Note: FlimFlam is flaky after Backchannel setup sometimes. It may |
90 # take several tries for WiFi to connect. More experimentation with | 90 # take several tries for WiFi to connect. More experimentation with |
91 # the retry settings here may be necessary if this becomes a source | 91 # the retry settings here may be necessary if this becomes a source |
92 # of test flakiness in the future. | 92 # of test flakiness in the future. |
93 if not flimflam.FlimFlam().ConnectService(retry=True, | 93 if not flimflam.FlimFlam().ConnectService(retries=3, |
| 94 retry=True, |
94 service_type='wifi', | 95 service_type='wifi', |
95 ssid=wifi_ap, | 96 ssid=wifi_ap, |
96 security=wifi_sec, | 97 security=wifi_sec, |
97 passphrase=wifi_pw, | 98 passphrase=wifi_pw, |
98 mode='managed')[0]: | 99 mode='managed')[0]: |
99 raise error.TestError('Could not connect to WiFi network.') | 100 raise error.TestError('Could not connect to WiFi network.') |
100 | 101 |
101 if check_network and backchannel.is_network_iface_running('eth0'): | 102 if check_network and backchannel.is_network_iface_running('eth0'): |
102 raise error.TestError( | 103 raise error.TestError( |
103 'Ethernet interface is active. Please remove Ethernet cable') | 104 'Ethernet interface is active. Please remove Ethernet cable') |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 # set backlight level to 40% of max | 317 # set backlight level to 40% of max |
317 cmd = 'backlight-tool --set_brightness %d ' % ( | 318 cmd = 'backlight-tool --set_brightness %d ' % ( |
318 int(self._max_backlight * 0.4)) | 319 int(self._max_backlight * 0.4)) |
319 os.system(cmd) | 320 os.system(cmd) |
320 | 321 |
321 # record brightness level | 322 # record brightness level |
322 cmd = 'backlight-tool --get_brightness' | 323 cmd = 'backlight-tool --get_brightness' |
323 level = int(utils.system_output(cmd).rstrip()) | 324 level = int(utils.system_output(cmd).rstrip()) |
324 logging.info('backlight level is %d' % level) | 325 logging.info('backlight level is %d' % level) |
325 self._tmp_keyvals['level_backlight_current'] = level | 326 self._tmp_keyvals['level_backlight_current'] = level |
OLD | NEW |