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 logging | 5 import logging |
6 from autotest_lib.client.common_lib import error | 6 from autotest_lib.client.common_lib import error |
7 from autotest_lib.client.cros import auth_server, ui_test | 7 from autotest_lib.client.cros import auth_server, cros_ui_test |
8 | 8 |
9 class login_LoginSuccess(ui_test.UITest): | 9 class login_LoginSuccess(cros_ui_test.UITest): |
10 version = 1 | 10 version = 1 |
11 | 11 |
12 def __creds_checker(self, handler, url_args): | 12 def __creds_checker(self, handler, url_args): |
13 logging.debug('checking %s == %s' % (self.username, | 13 logging.debug('checking %s == %s' % (self.username, |
14 url_args['Email'].value)) | 14 url_args['Email'].value)) |
15 if (self.username != url_args['Email'].value): | 15 if (self.username != url_args['Email'].value): |
16 raise error.TestError('Incorrect creds passed to ClientLogin') | 16 raise error.TestError('Incorrect creds passed to ClientLogin') |
17 self._authServer.client_login_responder(handler, url_args) | 17 self._authServer.client_login_responder(handler, url_args) |
18 | 18 |
19 | 19 |
20 def initialize(self, creds='$default'): | 20 def initialize(self, creds='$default'): |
21 super(login_LoginSuccess, self).initialize(creds) | 21 super(login_LoginSuccess, self).initialize(creds) |
22 | 22 |
23 | 23 |
24 def start_authserver(self): | 24 def start_authserver(self): |
25 self._authServer = auth_server.GoogleAuthServer( | 25 self._authServer = auth_server.GoogleAuthServer( |
26 cl_responder=self.__creds_checker) | 26 cl_responder=self.__creds_checker) |
27 self._authServer.run() | 27 self._authServer.run() |
28 self.use_local_dns() | 28 self.use_local_dns() |
29 | 29 |
30 | 30 |
| 31 def initialize(self, creds='$default'): |
| 32 super(login_LoginSuccess, self).initialize(creds) |
| 33 |
| 34 |
31 def ensure_login_complete(self): | 35 def ensure_login_complete(self): |
32 """Wait for login to complete, including cookie fetching.""" | 36 """Wait for login to complete, including cookie fetching.""" |
33 self._authServer.wait_for_client_login() | 37 self._authServer.wait_for_client_login() |
34 self._authServer.wait_for_issue_token() | 38 self._authServer.wait_for_issue_token() |
35 self._authServer.wait_for_test_over() | 39 self._authServer.wait_for_test_over() |
36 | 40 |
37 | 41 |
38 def run_once(self): | 42 def run_once(self): |
39 pass | 43 pass |
40 | 44 |
41 | 45 |
42 def cleanup(self): | 46 def cleanup(self): |
43 super(login_LoginSuccess, self).cleanup() | 47 super(login_LoginSuccess, self).cleanup() |
44 self.write_perf_keyval(self.get_auth_endpoint_misses()) | 48 self.write_perf_keyval(self.get_auth_endpoint_misses()) |
OLD | NEW |