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

Unified Diff: client/bin/site_login.py

Issue 1203002: add ScreenSaverUnlock autotest and teach ScreenSaverRunning to log in (Closed)
Patch Set: fix copyright year in control file, again 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | client/common_lib/site_ui.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/bin/site_login.py
diff --git a/client/bin/site_login.py b/client/bin/site_login.py
index f1ef5a19b3021e56b1a6372fea6082499eec4eed..0da53494877d5728adb524d33a4be3c519615437 100644
--- a/client/bin/site_login.py
+++ b/client/bin/site_login.py
@@ -13,11 +13,13 @@ def setup_autox(test):
if not os.path.exists(test.srcdir):
os.mkdir(test.srcdir)
+
def logged_in():
# this file is created when the session_manager emits start-user-session
# and removed when the session_manager emits stop-user-session
return os.path.exists(chromeos_constants.LOGGED_IN_MAGIC_FILE)
+
def attempt_login(test, script_file, timeout = 10):
dep = 'autox'
dep_dir = os.path.join(test.autodir, 'deps', dep)
@@ -41,6 +43,7 @@ def attempt_login(test, script_file, timeout = 10):
return False
return True
+
def attempt_logout(timeout = 10):
# Gracefully exiting chrome causes the user's session to end.
utils.system('pkill -TERM ^%s$' % chromeos_constants.BROWSER)
@@ -53,6 +56,7 @@ def attempt_logout(timeout = 10):
return False
return True
+
def wait_for_browser(timeout = 10):
# Wait until the login manager is back up before trying to use it.
# I don't use utils.system here because I don't want to fail
@@ -66,6 +70,24 @@ def wait_for_browser(timeout = 10):
return False
return True
+
+def wait_for_screensaver(timeout = 10, raise_error = True):
+ # Wait until the screensaver starts
+ start_time = time.time()
+ while time.time() - start_time < timeout:
+ if 0 == os.system(site_ui.xcommand('xscreensaver-command -version')):
+ break
+ time.sleep(1)
+ else:
+ if raise_error:
+ raise error.TestFail('Unable to communicate with ' +
+ 'xscreensaver after %i seconds' %
+ time.time() - start_time)
+ return False
+
+ return True
+
+
def nuke_login_manager():
nuke_process_by_name('session_manager')
wait_for_browser()
« no previous file with comments | « no previous file | client/common_lib/site_ui.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698