| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import subprocess | 7 import subprocess |
| 8 | 8 |
| 9 import pyauto_functional # Must be imported before pyauto | 9 import pyauto_functional # Must be imported before pyauto |
| 10 import pyauto | 10 import pyauto |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 pyauto.PyUITest.setUp(self) | 24 pyauto.PyUITest.setUp(self) |
| 25 | 25 |
| 26 def _ValidCredentials(self, account_type='test_google_account'): | 26 def _ValidCredentials(self, account_type='test_google_account'): |
| 27 """Obtains a valid username and password from a data file. | 27 """Obtains a valid username and password from a data file. |
| 28 | 28 |
| 29 Returns: | 29 Returns: |
| 30 A dictionary with the keys 'username' and 'password' | 30 A dictionary with the keys 'username' and 'password' |
| 31 """ | 31 """ |
| 32 return self.GetPrivateInfo()[account_type] | 32 return self.GetPrivateInfo()[account_type] |
| 33 | 33 |
| 34 def testExecuteJavascriptInOOBEWebUI(self): |
| 35 """Test that javascript can be executed at the login page.""" |
| 36 msg = 'test success' |
| 37 ret = self.ExecuteJavascriptInOOBEWebUI( |
| 38 'window.domAutomationController.send("%s");' % msg) |
| 39 self.assertEqual(ret, msg) |
| 40 |
| 34 def testGoodLogin(self): | 41 def testGoodLogin(self): |
| 35 """Test that login is successful with valid credentials.""" | 42 """Test that login is successful with valid credentials.""" |
| 36 credentials = self._ValidCredentials() | 43 credentials = self._ValidCredentials() |
| 37 self.Login(credentials['username'], credentials['password']) | 44 self.Login(credentials['username'], credentials['password']) |
| 38 login_info = self.GetLoginInfo() | 45 login_info = self.GetLoginInfo() |
| 39 self.assertTrue(login_info['is_logged_in'], msg='Login failed.') | 46 self.assertTrue(login_info['is_logged_in'], msg='Login failed.') |
| 40 | 47 |
| 41 def testBadUsername(self): | 48 def testBadUsername(self): |
| 42 """Test that login fails when passed an invalid username.""" | 49 """Test that login fails when passed an invalid username.""" |
| 43 self.Login('doesnotexist@fakedomain.org', 'badpassword') | 50 self.Login('doesnotexist@fakedomain.org', 'badpassword') |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 self.testGoodLogin() | 148 self.testGoodLogin() |
| 142 self.Logout() | 149 self.Logout() |
| 143 self.testBadPassword() | 150 self.testBadPassword() |
| 144 self.testLoginAsGuest() | 151 self.testLoginAsGuest() |
| 145 self.Logout() | 152 self.Logout() |
| 146 self.testLoginToCreateNewAccount() | 153 self.testLoginToCreateNewAccount() |
| 147 | 154 |
| 148 | 155 |
| 149 if __name__ == '__main__': | 156 if __name__ == '__main__': |
| 150 pyauto_functional.Main() | 157 pyauto_functional.Main() |
| OLD | NEW |