test: Clean up site_login.py a bit.
This has overlap with rginda's
http://codereview.chromium.org/1534001, but there's
one part that I prefer from my change: making all
of these wait_ functions throw exceptions when they
time out, which cuts down on a bunch of code that
would otherwise need to be duplicated across all of
our tests.
I also ran into a bunch of races in UI tests when I
reduced the polling timeout, so I've tried to fix
those too.
BUG=none
TEST=ran the tests, both logged-in and logged-out
Review URL: http://codereview.chromium.org/1565001
diff --git a/client/bin/site_ui_test.py b/client/bin/site_ui_test.py
index cbef8bc..e860877 100644
--- a/client/bin/site_ui_test.py
+++ b/client/bin/site_ui_test.py
@@ -23,19 +23,12 @@
def initialize(self, script='autox_script.json'):
# Clean up past state and assume logged out before logging in.
if site_login.logged_in():
- if not site_login.attempt_logout(timeout=10):
- raise error.TestFail('Could not logout from previous session')
- if not site_login.wait_for_browser():
- raise error.TestFail("Login manager did not restart")
+ site_login.attempt_logout()
# Test account information embedded into json file.
- if not site_login.attempt_login(self, script):
- raise error.TestFail('Login failed at the beginning of new session')
+ site_login.attempt_login(self, script)
+ site_login.wait_for_initial_chrome_window()
-
- """
- Logs out when object is deleted
- """
def cleanup(self):
- if not site_login.attempt_logout():
- raise error.TestFail('Could not logout at end of session')
+ """Logs out when object is deleted"""
+ site_login.attempt_logout()