Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: client/site_tests/desktopui_FailedLogin/desktopui_FailedLogin.py

Issue 1565001: test: Clean up site_login.py a bit. (Closed)
Patch Set: update one more call to attempt_logout() Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_login, test 6 from autotest_lib.client.bin import site_login, test
7 from autotest_lib.client.common_lib import error 7 from autotest_lib.client.common_lib import error
8 8
9 class desktopui_FailedLogin(test.test): 9 class desktopui_FailedLogin(test.test):
10 version = 1 10 version = 1
11 11
12 def setup(self): 12 def setup(self):
13 site_login.setup_autox(self) 13 site_login.setup_autox(self)
14 14
15 def run_once(self, script): 15 def run_once(self, script):
16 logged_in = site_login.logged_in()
17
18 # Can't test login while logged in, so logout. 16 # Can't test login while logged in, so logout.
19 if logged_in: 17 if site_login.logged_in():
20 if not site_login.attempt_logout(): 18 site_login.attempt_logout()
21 raise error.TestFail('Could not terminate existing session')
22 if not site_login.wait_for_browser():
23 raise error.TestFail("Login manager didn't come back")
24 19
25 # Test account information embedded into json file. 20 # Test account information embedded into json file.
26 # TODO(cmasone): find better way to determine login has failed. 21 # TODO(cmasone): find better way to determine login has failed.
27 if site_login.attempt_login(self, script): 22 try:
23 site_login.attempt_login(self, script)
24 except site_login.TimeoutError:
25 pass
26 else:
28 raise error.TestFail('Should not have logged in') 27 raise error.TestFail('Should not have logged in')
29 28
30 # Re-set to a good state 29 # Re-set to a good state
31 site_login.nuke_login_manager() 30 site_login.nuke_login_manager()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698