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, utils, time | 5 import os, utils, time |
6 from autotest_lib.client.bin import chromeos_constants | 6 from autotest_lib.client.bin import chromeos_constants |
7 from autotest_lib.client.bin import site_cryptohome, site_login, test | 7 from autotest_lib.client.bin import site_cryptohome, site_login, test |
8 from autotest_lib.client.common_lib import error | 8 from autotest_lib.client.common_lib import error |
9 | 9 |
10 class login_CryptohomeMounted(test.test): | 10 class login_CryptohomeMounted(test.test): |
11 version = 1 | 11 version = 1 |
12 | 12 |
13 def setup(self): | 13 def setup(self): |
14 site_login.setup_autox(self) | 14 site_login.setup_autox(self) |
15 | 15 |
16 def run_once(self, script='autox_script.json', is_control=False): | 16 def run_once(self, script='autox_script.json', is_control=False): |
17 logged_in = site_login.logged_in() | 17 # Make sure that we're logged out initially -- this test is run |
| 18 # multiple times, and we don't want to reuse the previous instance's |
| 19 # session. |
| 20 if site_login.logged_in(): |
| 21 site_login.attempt_logout() |
18 | 22 |
19 if not logged_in: | 23 # Test account information embedded into json file. |
20 # Test account information embedded into json file. | 24 site_login.attempt_login(self, script) |
21 if not site_login.attempt_login(self, script): | |
22 raise error.TestFail('Could not login') | |
23 | 25 |
24 if (not is_control and | 26 if (not is_control and |
25 not site_cryptohome.is_mounted(allow_fail=is_control)): | 27 not site_cryptohome.is_mounted(allow_fail=is_control)): |
26 raise error.TestFail('CryptohomeIsMounted should return %s' % | 28 raise error.TestFail('CryptohomeIsMounted should return %s' % |
27 (not is_control)) | 29 (not is_control)) |
28 | 30 |
29 # If we started logged out, log back out. | 31 site_login.attempt_logout() |
30 if not logged_in: | |
31 if not site_login.attempt_logout(): | |
32 raise error.TestError('Could not log out') | |
OLD | NEW |