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

Unified Diff: client/bin/site_ui_test.py

Issue 1363002: Add session object so that we have one class that control logged in session (Closed)
Patch Set: Fix comments Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: client/bin/site_ui_test.py
diff --git a/client/bin/site_ui_test.py b/client/bin/site_ui_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..a73bd462dbb05e41500aae1bcd04c3b6c3e00197
--- /dev/null
+++ b/client/bin/site_ui_test.py
@@ -0,0 +1,41 @@
+# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from autotest_lib.client.bin import site_login, test as bin_test
+from autotest_lib.client.common_lib import error
+
+
+class UITest(bin_test.test):
+ """
+ Tests that require the user to be logged in should subclass this test
+ This script by default logs in using the default remote account, however,
+ tests can override this by setting script="your_script" in the control
+ file running the test
+ """
+ version = 1
+
+
+ def setup(self):
+ site_login.setup_autox(self)
+
+
+ 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")
+
+ # Test account information embedded into json file.
+ 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
+ raise error.TestFail('Login failed at the beginning of new session')
+
+
+ """
+ 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')
kmixter1 2010/03/26 02:38:45 would be nice if we wait for the login manager her

Powered by Google App Engine
This is Rietveld 408576698