OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 pyauto_functional # Must be imported before pyauto | 6 import pyauto_functional |
7 import pyauto | 7 import pyauto |
8 import test_utils | 8 import test_utils |
9 | 9 |
10 | 10 |
11 class PasswordTest(pyauto.PyUITest): | 11 class PasswordTest(pyauto.PyUITest): |
12 """Tests that passwords work correctly""" | 12 """Tests that passwords work correctly""" |
13 | 13 |
14 def Debug(self): | 14 def Debug(self): |
15 """Test method for experimentation. | 15 """Test method for experimentation. |
16 | 16 |
(...skipping 19 matching lines...) Expand all Loading... | |
36 'time': 1279650942.0, | 36 'time': 1279650942.0, |
37 'origin_url': 'https://www.example.com/login', | 37 'origin_url': 'https://www.example.com/login', |
38 'username_element': 'username', | 38 'username_element': 'username', |
39 'password_element': 'password', | 39 'password_element': 'password', |
40 'submit_element': 'submit', | 40 'submit_element': 'submit', |
41 'action_target': 'https://www.example.com/login/', | 41 'action_target': 'https://www.example.com/login/', |
42 'blacklist': False } | 42 'blacklist': False } |
43 self.assertTrue(self.AddSavedPassword(password1)) | 43 self.assertTrue(self.AddSavedPassword(password1)) |
44 self.assertEquals(self.GetSavedPasswords(), [password1]) | 44 self.assertEquals(self.GetSavedPasswords(), [password1]) |
45 | 45 |
46 def testDisplayAndSavePasswordInfobar(self): | 46 def testInfoBarDisappearByNavigatingPage(self): |
Nirnimesh
2010/12/10 05:03:29
This old test looked useful to me as well. It migh
| |
47 """Verify password infobar displays and able to save password.""" | 47 """Test that Password infobar is dismissed by navigating to |
48 url_https = 'https://www.google.com/accounts/' | 48 different page.""" |
49 url_logout = 'https://www.google.com/accounts/Logout' | 49 |
50 url = 'https://www.google.com/accounts/Login?hl=en' | |
50 creds = self.GetPrivateInfo()['test_google_account'] | 51 creds = self.GetPrivateInfo()['test_google_account'] |
51 username = creds['username'] | |
52 password = creds['password'] | |
53 test_utils.GoogleAccountsLogin(self, ['url'], username, password) | |
54 # Wait until page completes loading. | |
55 self.WaitUntil( | |
56 lambda: self.GetDOMValue('document.readyState'), 'complete') | |
57 self.assertTrue(self.WaitForInfobarCount(1), | |
58 'Did not get save password infobar') | |
59 infobar = self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars'] | |
60 self.assertEqual(infobar[0]['type'], 'confirm_infobar') | |
61 self.PerformActionOnInfobar('accept', infobar_index=0) | |
62 self.NavigateToURL(url_logout) | |
63 self.NavigateToURL(url_https) | |
64 test_utils.VerifyGoogleAccountCredsFilled(self, username, password) | |
65 self.ExecuteJavascript('document.getElementById("gaia_loginform").submit();' | |
66 'window.domAutomationController.send("done")') | |
67 test_utils.ClearPasswords(self) | |
68 | 52 |
53 # Login to Google a/c | |
54 test_utils.GoogleAccountsLogin(self, url, creds['username'], | |
55 creds['password']) | |
56 | |
57 # Wait for the infobar to appear | |
58 self.assertTrue(self.WaitForInfobarCount(1)) | |
59 self.assertTrue(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) | |
60 self.NavigateToURL('chrome://history') | |
61 self.assertTrue(self.WaitForInfobarCount(0)) | |
62 # To make sure user is navigated to History page. | |
63 self.assertEqual('History', self.GetActiveTabTitle()) | |
64 self.assertFalse(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) | |
69 | 65 |
66 def testInfoBarDisappearByReload(self): | |
67 """Test that Password infobar disappears by the page reload.""" | |
68 | |
69 url = 'https://www.google.com/accounts/Login?hl=en' | |
70 creds = self.GetPrivateInfo()['test_google_account'] | |
71 | |
72 # Login to Google a/c | |
73 test_utils.GoogleAccountsLogin(self, url, creds['username'], | |
74 creds['password']) | |
75 | |
76 # Wait for the infobar to appear | |
77 self.assertTrue(self.WaitForInfobarCount(1)) | |
78 self.assertTrue(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) | |
79 self.GetBrowserWindow(0).GetTab(0).Reload() | |
80 self.assertTrue(self.WaitForInfobarCount(0)) | |
81 self.assertFalse(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) | |
82 | |
70 if __name__ == '__main__': | 83 if __name__ == '__main__': |
71 pyauto_functional.Main() | 84 pyauto_functional.Main() |
OLD | NEW |