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

Side by Side Diff: client/bin/site_login.py

Issue 1371003: test: Add desktopui_WindowManagerFocusNewWindows. (Closed)
Patch Set: (sort of) handle the case where we need to log in Created 10 years, 9 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
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, utils, signal, time 5 import logging, os, utils, signal, time
6 from autotest_lib.client.bin import chromeos_constants, test 6 from autotest_lib.client.bin import chromeos_constants, test
7 from autotest_lib.client.common_lib import error, site_ui 7 from autotest_lib.client.common_lib import error, site_ui
8 8
9 9
10 def setup_autox(test): 10 def setup_autox(test):
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 else: 81 else:
82 if raise_error: 82 if raise_error:
83 raise error.TestFail('Unable to communicate with ' + 83 raise error.TestFail('Unable to communicate with ' +
84 'xscreensaver after %i seconds' % 84 'xscreensaver after %i seconds' %
85 time.time() - start_time) 85 time.time() - start_time)
86 return False 86 return False
87 87
88 return True 88 return True
89 89
90 90
91 def wait_for_window_manager(timeout=20):
92 """Wait until the window manager is running."""
93 start_time = time.time()
94 while time.time() - start_time < timeout:
95 if os.system('pgrep ^%s$' % chromeos_constants.WINDOW_MANAGER) == 0:
96 return True
97 time.sleep(0.1)
98 return False
99
100
91 def nuke_login_manager(): 101 def nuke_login_manager():
92 nuke_process_by_name('session_manager') 102 nuke_process_by_name('session_manager')
93 wait_for_browser() 103 wait_for_browser()
94 104
95 def nuke_process_by_name(name, with_prejudice=False): 105 def nuke_process_by_name(name, with_prejudice=False):
96 pid = int(utils.system_output('pgrep -o ^%s$' % name)) 106 pid = int(utils.system_output('pgrep -o ^%s$' % name))
97 if with_prejudice: 107 if with_prejudice:
98 utils.nuke_pid(pid, [signal.SIGKILL]) 108 utils.nuke_pid(pid, [signal.SIGKILL])
99 else: 109 else:
100 utils.nuke_pid(pid) 110 utils.nuke_pid(pid)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698