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 logging, os, time, utils |
| 6 from autotest_lib.client.bin import site_login, test |
| 7 from autotest_lib.client.common_lib import error |
| 8 from autotest_lib.client.bin import chromeos_constants |
| 9 |
| 10 class desktopui_ScreenSaverUnlock(test.test): |
| 11 version = 1 |
| 12 |
| 13 def system_as(self, cmd, user='chronos'): |
| 14 utils.system('su %s -c \'%s\'' % (user, cmd)) |
| 15 |
| 16 def setup(self): |
| 17 site_login.setup_autox(self) |
| 18 |
| 19 def run_once(self): |
| 20 if site_login.logged_in(): |
| 21 if not site_login.attempt_logout(): |
| 22 raise error.TestFail('Could not terminate existing session') |
| 23 |
| 24 if not site_login.attempt_login(self, 'autox_script.json'): |
| 25 raise error.TestFail('Could not login') |
| 26 |
| 27 # first sleep to let the login finish and start xscreensaver |
| 28 time.sleep(10) |
| 29 self.system_as('DISPLAY=:0.0 xscreensaver-command -lock') |
| 30 |
| 31 # some sleep to let the screen lock |
| 32 time.sleep(5) |
| 33 self.system_as('DISPLAY=:0.0 xscreensaver-command -time | ' + |
| 34 'grep -q locked') |
| 35 |
| 36 time.sleep(10) |
| 37 if not site_login.attempt_login(self, 'autox_unlock.json'): |
| 38 raise error.TestFail('Could not unlock screensaver') |
| 39 |
| 40 # wait for screen to unlock |
| 41 time.sleep(5) |
| 42 self.system_as('DISPLAY=:0.0 xscreensaver-command -time | ' + |
| 43 'grep -q non-blanked') |
OLD | NEW |