OLD | NEW |
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 os, time | 5 import os, time |
6 from autotest_lib.client.bin import site_cryptohome, site_login, test | 6 from autotest_lib.client.bin import site_cryptohome, site_ui_test |
7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
8 | 8 |
9 class login_CryptohomeUnmounted(test.test): | 9 class login_CryptohomeUnmounted(site_ui_test.UITest): |
10 version = 1 | 10 version = 1 |
11 | 11 |
12 def setup(self): | 12 def run_once(self, is_control=False): |
13 site_login.setup_autox(self) | |
14 | |
15 def run_once(self, script = 'autox_script.json', is_control = False): | |
16 logged_in = site_login.logged_in() | |
17 | |
18 # Require that the cryptohome is mounted before testing that | |
19 # logging out will unmount it. This requires logging in. | |
20 if not logged_in: | |
21 site_login.attempt_login(self, script) | |
22 | |
23 if not site_cryptohome.is_mounted(allow_fail = is_control): | 13 if not site_cryptohome.is_mounted(allow_fail = is_control): |
24 raise error.TestFail('Expected cryptohome to be mounted') | 14 raise error.TestFail('Expected cryptohome to be mounted') |
25 | 15 |
26 site_login.attempt_logout() | 16 self.logout() |
27 | 17 |
28 # allow the command to fail, so we can handle the error here | 18 # allow the command to fail, so we can handle the error here |
29 if site_cryptohome.is_mounted(allow_fail = True): | 19 if site_cryptohome.is_mounted(allow_fail = True): |
30 raise error.TestFail('Expected cryptohome NOT to be mounted') | 20 raise error.TestFail('Expected cryptohome NOT to be mounted') |
31 | |
32 # If we started logged in, reset the state. | |
33 if logged_in: | |
34 site_login.attempt_login(self, script) | |
OLD | NEW |