OLD | NEW |
| (Empty) |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 import time | |
6 from autotest_lib.client.bin import site_ui_test, site_utils | |
7 from autotest_lib.client.common_lib import error | |
8 | |
9 class desktopui_ScreenSaverUnlock(site_ui_test.UITest): | |
10 version = 1 | |
11 | |
12 | |
13 def run_once(self, is_control=False): | |
14 self.wait_for_screensaver() | |
15 self.xsystem('xscreensaver-command -lock') | |
16 | |
17 site_utils.poll_for_condition( | |
18 lambda: self.is_screensaver_locked(), | |
19 desc='screensaver lock') | |
20 | |
21 ax = self.get_autox() | |
22 | |
23 # Send a key and wait for the screensaver to wakeup and | |
24 # present the login dialog. | |
25 # TODO: a less brittle way to do this would be nice | |
26 ax.send_hotkey('Return') | |
27 time.sleep(2) | |
28 | |
29 if is_control: | |
30 # send an incorrect password | |
31 ax.send_text('_boguspassword_') | |
32 ax.send_hotkey('Return') | |
33 | |
34 # verify that the screen unlock attempt failed | |
35 try: | |
36 site_utils.poll_for_condition( | |
37 lambda: self.is_screensaver_unlocked(), | |
38 desc='screensaver unlock') | |
39 except error.TestError: | |
40 pass | |
41 else: | |
42 raise error.TestFail('screen saver unlocked with bogus password.
') | |
43 else: | |
44 # send the correct password | |
45 ax.send_text(self.password) | |
46 ax.send_hotkey('Return') | |
47 | |
48 # wait for screen to unlock | |
49 site_utils.poll_for_condition( | |
50 lambda: self.is_screensaver_unlocked(), | |
51 desc='screensaver unlock') | |
OLD | NEW |