blob: e86087763acf3c6b49eeecba2f30391c144b7a3f [file] [log] [blame]
Chris Sosad6d09422010-03-25 17:17:46 -07001# 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
5from autotest_lib.client.bin import site_login, test as bin_test
6from autotest_lib.client.common_lib import error
Ken Mixter2e32fd42010-03-28 19:25:51 -07007
Chris Sosad6d09422010-03-25 17:17:46 -07008
9class 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
Ken Mixter2e32fd42010-03-28 19:25:51 -070017
18
Chris Sosad6d09422010-03-25 17:17:46 -070019 def setup(self):
20 site_login.setup_autox(self)
Ken Mixter2e32fd42010-03-28 19:25:51 -070021
22
Chris Sosad6d09422010-03-25 17:17:46 -070023 def initialize(self, script='autox_script.json'):
Ken Mixter2e32fd42010-03-28 19:25:51 -070024 # Clean up past state and assume logged out before logging in.
Chris Sosad6d09422010-03-25 17:17:46 -070025 if site_login.logged_in():
Daniel Erat3e3f7f42010-03-29 17:19:14 -070026 site_login.attempt_logout()
Chris Sosad6d09422010-03-25 17:17:46 -070027
28 # Test account information embedded into json file.
Daniel Erat3e3f7f42010-03-29 17:19:14 -070029 site_login.attempt_login(self, script)
30 site_login.wait_for_initial_chrome_window()
Chris Sosad6d09422010-03-25 17:17:46 -070031
Chris Sosad6d09422010-03-25 17:17:46 -070032 def cleanup(self):
Daniel Erat3e3f7f42010-03-29 17:19:14 -070033 """Logs out when object is deleted"""
34 site_login.attempt_logout()