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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 timeout: float number of seconds to wait | 286 timeout: float number of seconds to wait |
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 try: | 297 try: |
297 os.unlink(chromeos_constants.LOGIN_PROMPT_READY_MAGIC_FILE) | 298 os.unlink(chromeos_constants.LOGIN_PROMPT_READY_MAGIC_FILE) |
298 except OSError, e: | 299 except OSError, e: |
299 if e.errno != errno.ENOENT: | 300 if e.errno != errno.ENOENT: |
300 raise e | 301 raise e |
301 nuke_process_by_name(chromeos_constants.BROWSER, with_prejudice=True) | 302 nuke_login_manager() |
302 wait_for_browser() | 303 site_utils.poll_for_condition( |
| 304 lambda: __session_manager_restarted(oldpid), |
| 305 TimeoutError('Timed out waiting for logout'), |
| 306 timeout) |
303 wait_for_login_prompt() | 307 wait_for_login_prompt() |
OLD | NEW |