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

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

Issue 1213005: Add test to check stateful partition contents (Closed)
Patch Set: use site_ui_test, add a few files, rename wait_for_login, and remove trailing spaces Created 10 years, 8 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
« no previous file with comments | « no previous file | client/bin/site_ui_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, site_cryptohome, 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):
11 test.job.setup_dep(['autox']) 11 test.job.setup_dep(['autox'])
12 # create a empty srcdir to prevent the error that checks .version file 12 # create a empty srcdir to prevent the error that checks .version file
13 if not os.path.exists(test.srcdir): 13 if not os.path.exists(test.srcdir):
14 os.mkdir(test.srcdir) 14 os.mkdir(test.srcdir)
15 15
16 16
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 while time.time() - start_time < timeout: 65 while time.time() - start_time < timeout:
66 # 0 is returned on success. 66 # 0 is returned on success.
67 if os.system('pgrep ^%s$' % chromeos_constants.BROWSER) == 0: 67 if os.system('pgrep ^%s$' % chromeos_constants.BROWSER) == 0:
68 break; 68 break;
69 time.sleep(1) 69 time.sleep(1)
70 else: 70 else:
71 return False 71 return False
72 return True 72 return True
73 73
74 74
75 def wait_for_cryptohome(timeout=10):
76 start_time = time.time()
77 while time.time() - start_time < timeout:
78 if site_cryptohome.is_mounted():
79 break;
80 time.sleep(1)
81 else:
82 return False
83 return True
84
85
75 def wait_for_screensaver(timeout=10, raise_error=True): 86 def wait_for_screensaver(timeout=10, raise_error=True):
76 # Wait until the screensaver starts 87 # Wait until the screensaver starts
77 start_time = time.time() 88 start_time = time.time()
78 while time.time() - start_time < timeout: 89 while time.time() - start_time < timeout:
79 if 0 == os.system(site_ui.xcommand('xscreensaver-command -version')): 90 if 0 == os.system(site_ui.xcommand('xscreensaver-command -version')):
80 break 91 break
81 time.sleep(1) 92 time.sleep(1)
82 else: 93 else:
83 if raise_error: 94 if raise_error:
84 raise error.TestFail('Unable to communicate with ' + 95 raise error.TestFail('Unable to communicate with ' +
(...skipping 10 matching lines...) Expand all
95 while time.time() - start_time < timeout: 106 while time.time() - start_time < timeout:
96 if os.system('pgrep ^%s$' % chromeos_constants.WINDOW_MANAGER) == 0: 107 if os.system('pgrep ^%s$' % chromeos_constants.WINDOW_MANAGER) == 0:
97 return True 108 return True
98 time.sleep(0.1) 109 time.sleep(0.1)
99 return False 110 return False
100 111
101 112
102 def nuke_login_manager(): 113 def nuke_login_manager():
103 nuke_process_by_name('session_manager') 114 nuke_process_by_name('session_manager')
104 wait_for_browser() 115 wait_for_browser()
105 116
106 117
107 def nuke_process_by_name(name, with_prejudice=False): 118 def nuke_process_by_name(name, with_prejudice=False):
108 pid = int(utils.system_output('pgrep -o ^%s$' % name)) 119 pid = int(utils.system_output('pgrep -o ^%s$' % name))
109 if with_prejudice: 120 if with_prejudice:
110 utils.nuke_pid(pid, [signal.SIGKILL]) 121 utils.nuke_pid(pid, [signal.SIGKILL])
111 else: 122 else:
112 utils.nuke_pid(pid) 123 utils.nuke_pid(pid)
OLDNEW
« no previous file with comments | « no previous file | client/bin/site_ui_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698