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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 | 287 |
288 Raises: | 288 Raises: |
289 UnexpectedCondition: called while already logged in | 289 UnexpectedCondition: called while already logged in |
290 TimeoutError: chrome didn't start before timeout | 290 TimeoutError: chrome didn't start before timeout |
291 """ | 291 """ |
292 if logged_in(): | 292 if logged_in(): |
293 raise UnexpectedCondition('Already logged in') | 293 raise UnexpectedCondition('Already logged in') |
294 wait_for_browser() | 294 wait_for_browser() |
295 wait_for_login_prompt() | 295 wait_for_login_prompt() |
296 oldpid = __get_session_manager_pid() | 296 oldpid = __get_session_manager_pid() |
297 | |
298 # Clear breadcrumb that shows we've emitted login-prompt-ready. | |
297 try: | 299 try: |
298 os.unlink(chromeos_constants.LOGIN_PROMPT_READY_MAGIC_FILE) | 300 os.unlink(chromeos_constants.LOGIN_PROMPT_READY_MAGIC_FILE) |
299 except OSError, e: | 301 except OSError, e: |
300 if e.errno != errno.ENOENT: | 302 if e.errno != errno.ENOENT: |
301 raise e | 303 raise e |
304 | |
305 # Clear old log files. | |
306 logpath = chromeos_constants.CHROME_LOG_DIR | |
307 try: | |
308 for file in os.listdir(logpath): | |
309 fullpath = os.path.join(logpath, file) | |
310 if os.path.isfile(fullpath): | |
311 os.unlink(os.path.join(logpath, file)) | |
rginda
2010/09/09 21:01:31
fullpath, no?
| |
312 | |
313 except (IOError, OSError) as error: | |
314 logging.error(error) | |
315 | |
316 # Restart the UI. | |
302 nuke_login_manager() | 317 nuke_login_manager() |
303 site_utils.poll_for_condition( | 318 site_utils.poll_for_condition( |
304 lambda: __session_manager_restarted(oldpid), | 319 lambda: __session_manager_restarted(oldpid), |
305 TimeoutError('Timed out waiting for logout'), | 320 TimeoutError('Timed out waiting for logout'), |
306 timeout) | 321 timeout) |
307 wait_for_login_prompt() | 322 wait_for_login_prompt() |
OLD | NEW |