| OLD | NEW |
| 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 errno, logging, os, re, utils, signal, subprocess, time | 5 import errno, logging, os, re, utils, signal, subprocess, time |
| 6 from autotest_lib.client.bin import chromeos_constants, site_cryptohome | 6 from autotest_lib.client.bin import chromeos_constants, site_cryptohome |
| 7 from autotest_lib.client.bin import site_utils, test | 7 from autotest_lib.client.bin import site_utils, test |
| 8 from autotest_lib.client.common_lib import error, log_watcher, site_ui | 8 from autotest_lib.client.common_lib import error, log_watcher, site_ui |
| 9 | 9 |
| 10 _DEFAULT_TIMEOUT = 30 | 10 _DEFAULT_TIMEOUT = 30 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 Raises: | 213 Raises: |
| 214 TimeoutError: Login prompt didn't get up before timeout | 214 TimeoutError: Login prompt didn't get up before timeout |
| 215 """ | 215 """ |
| 216 site_utils.poll_for_condition( | 216 site_utils.poll_for_condition( |
| 217 lambda: os.access( | 217 lambda: os.access( |
| 218 chromeos_constants.LOGIN_PROMPT_READY_MAGIC_FILE, os.F_OK), | 218 chromeos_constants.LOGIN_PROMPT_READY_MAGIC_FILE, os.F_OK), |
| 219 TimeoutError('Timed out waiting for login prompt'), | 219 TimeoutError('Timed out waiting for login prompt'), |
| 220 timeout=timeout) | 220 timeout=timeout) |
| 221 | 221 |
| 222 | 222 |
| 223 def wait_for_screensaver(timeout=_DEFAULT_TIMEOUT): | |
| 224 """Wait until xscreensaver is responding. | |
| 225 | |
| 226 Args: | |
| 227 timeout: float number of seconds to wait | |
| 228 | |
| 229 Raises: | |
| 230 TimeoutError: xscreensaver didn't respond before timeout | |
| 231 """ | |
| 232 site_utils.poll_for_condition( | |
| 233 lambda: site_ui.xsystem('xscreensaver-command -version', | |
| 234 ignore_status=True) == 0, | |
| 235 TimeoutError('Timed out waiting for xscreensaver to respond'), | |
| 236 timeout=timeout) | |
| 237 | |
| 238 | |
| 239 def wait_for_window_manager(timeout=_DEFAULT_TIMEOUT): | 223 def wait_for_window_manager(timeout=_DEFAULT_TIMEOUT): |
| 240 """Wait until the window manager is running. | 224 """Wait until the window manager is running. |
| 241 | 225 |
| 242 Args: | 226 Args: |
| 243 timeout: float number of seconds to wait | 227 timeout: float number of seconds to wait |
| 244 | 228 |
| 245 Raises: | 229 Raises: |
| 246 TimeoutError: window manager didn't start before timeout | 230 TimeoutError: window manager didn't start before timeout |
| 247 """ | 231 """ |
| 248 site_utils.poll_for_condition( | 232 site_utils.poll_for_condition( |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 if logged_in(): | 292 if logged_in(): |
| 309 raise UnexpectedCondition('Already logged in') | 293 raise UnexpectedCondition('Already logged in') |
| 310 try: | 294 try: |
| 311 os.unlink(chromeos_constants.LOGIN_PROMPT_READY_MAGIC_FILE) | 295 os.unlink(chromeos_constants.LOGIN_PROMPT_READY_MAGIC_FILE) |
| 312 except OSError, e: | 296 except OSError, e: |
| 313 if e.errno != errno.ENOENT: | 297 if e.errno != errno.ENOENT: |
| 314 raise e | 298 raise e |
| 315 nuke_process_by_name(chromeos_constants.BROWSER, with_prejudice=True) | 299 nuke_process_by_name(chromeos_constants.BROWSER, with_prejudice=True) |
| 316 wait_for_browser() | 300 wait_for_browser() |
| 317 wait_for_login_prompt() | 301 wait_for_login_prompt() |
| OLD | NEW |