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

Unified Diff: client/site_tests/desktopui_ScreenSaverUnlock/desktopui_ScreenSaverUnlock.py

Issue 1565001: test: Clean up site_login.py a bit. (Closed)
Patch Set: update one more call to attempt_logout() 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
Index: client/site_tests/desktopui_ScreenSaverUnlock/desktopui_ScreenSaverUnlock.py
diff --git a/client/site_tests/desktopui_ScreenSaverUnlock/desktopui_ScreenSaverUnlock.py b/client/site_tests/desktopui_ScreenSaverUnlock/desktopui_ScreenSaverUnlock.py
index 4a42398196b39d2ab3aae7770e1e218c26d8d52c..1ee7c77f87a7f5b3b56538aaa357cdcd105b3582 100644
--- a/client/site_tests/desktopui_ScreenSaverUnlock/desktopui_ScreenSaverUnlock.py
+++ b/client/site_tests/desktopui_ScreenSaverUnlock/desktopui_ScreenSaverUnlock.py
@@ -3,39 +3,29 @@
# found in the LICENSE file.
import logging, os, time, utils
-from autotest_lib.client.bin import site_login, test
+from autotest_lib.client.bin import site_login, site_ui_test, test
from autotest_lib.client.common_lib import error
from autotest_lib.client.bin import chromeos_constants
-class desktopui_ScreenSaverUnlock(test.test):
+class desktopui_ScreenSaverUnlock(site_ui_test.UITest):
version = 1
def system_as(self, cmd, user='chronos'):
utils.system('su %s -c \'%s\'' % (user, cmd))
- def setup(self):
- site_login.setup_autox(self)
-
def run_once(self):
- if site_login.logged_in():
- if not site_login.attempt_logout():
- raise error.TestFail('Could not terminate existing session')
-
- if not site_login.attempt_login(self, 'autox_script.json'):
- raise error.TestFail('Could not login')
-
- # first sleep to let the login finish and start xscreensaver
- time.sleep(10)
+ site_login.wait_for_screensaver()
self.system_as('DISPLAY=:0.0 xscreensaver-command -lock')
# some sleep to let the screen lock
+ # TODO: Sleeping is unreliable and slow. Do something better to
+ # wait for the screen to be locked.
time.sleep(5)
self.system_as('DISPLAY=:0.0 xscreensaver-command -time | ' +
'grep -q locked')
time.sleep(10)
- if not site_login.attempt_login(self, 'autox_unlock.json'):
- raise error.TestFail('Could not unlock screensaver')
+ site_login.attempt_login(self, 'autox_unlock.json')
# wait for screen to unlock
time.sleep(5)

Powered by Google App Engine
This is Rietveld 408576698