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 from autotest_lib.client.bin import site_login, test as bin_test | |
6 from autotest_lib.client.common_lib import error | |
7 | |
8 | |
9 class UITest(bin_test.test): | |
10 """ | |
11 Tests that require the user to be logged in should subclass this test | |
12 This script by default logs in using the default remote account, however, | |
13 tests can override this by setting script="your_script" in the control | |
14 file running the test | |
15 """ | |
16 version = 1 | |
17 | |
18 | |
19 def setup(self): | |
20 site_login.setup_autox(self) | |
21 | |
22 | |
23 def initialize(self, script='autox_script.json'): | |
24 # Clean up past state and assume logged out before logging in. | |
25 if site_login.logged_in(): | |
26 if not site_login.attempt_logout(timeout=10): | |
27 raise error.TestFail('Could not logout from previous session') | |
28 if not site_login.wait_for_browser(): | |
29 raise error.TestFail("Login manager did not restart") | |
30 | |
31 # Test account information embedded into json file. | |
32 if not site_login.attempt_login(self, script): | |
kmixter1
2010/03/26 02:38:45
would be nice if we waited for cryptohome here. I
Chris Masone
2010/03/26 02:42:20
waiting for cryptohome is no guarantee that Chrome
| |
33 raise error.TestFail('Login failed at the beginning of new session') | |
34 | |
35 | |
36 """ | |
37 Logs out when object is deleted | |
38 """ | |
39 def cleanup(self): | |
40 if not site_login.attempt_logout(): | |
41 raise error.TestFail('Could not logout at end of session') | |
kmixter1
2010/03/26 02:38:45
would be nice if we wait for the login manager her
| |
OLD | NEW |