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 # Must be imported before pyauto |
7 import pyauto | 7 import pyauto |
8 | 8 |
9 import re | |
Nirnimesh
2010/11/10 07:53:10
move these before pyauto imports, then leave a lin
venkataramana1
2010/11/23 02:14:27
Done.
| |
10 import logging | |
9 | 11 |
10 class PasswordTest(pyauto.PyUITest): | 12 class PasswordTest(pyauto.PyUITest): |
11 """Tests that passwords work correctly""" | 13 """Tests that passwords work correctly""" |
12 | 14 |
13 def Debug(self): | 15 def Debug(self): |
14 """Test method for experimentation. | 16 """Test method for experimentation. |
15 | 17 |
16 This method will not run automatically. | 18 This method will not run automatically. |
17 """ | 19 """ |
18 while True: | 20 while True: |
(...skipping 15 matching lines...) Expand all Loading... | |
34 'signon_realm': 'https://www.example.com/', | 36 'signon_realm': 'https://www.example.com/', |
35 'time': 1279650942.0, | 37 'time': 1279650942.0, |
36 'origin_url': 'https://www.example.com/login', | 38 'origin_url': 'https://www.example.com/login', |
37 'username_element': 'username', | 39 'username_element': 'username', |
38 'password_element': 'password', | 40 'password_element': 'password', |
39 'submit_element': 'submit', | 41 'submit_element': 'submit', |
40 'action_target': 'https://www.example.com/login/', | 42 'action_target': 'https://www.example.com/login/', |
41 'blacklist': False } | 43 'blacklist': False } |
42 self.assertTrue(self.AddSavedPassword(password1)) | 44 self.assertTrue(self.AddSavedPassword(password1)) |
43 self.assertEquals(self.GetSavedPasswords(), [password1]) | 45 self.assertEquals(self.GetSavedPasswords(), [password1]) |
46 | |
47 def testInfoBarDisappearByNavigatingPage(self): | |
Nirnimesh
2010/11/10 07:53:10
Why are these tests in this file instead of infoba
venkataramana1
2010/11/23 02:14:27
Done.
| |
48 """Test that Password info is dismissed by navigating to different page.""" | |
49 self.NavigateToURL('https://www.google.com/accounts/ServiceLogin') | |
50 | |
Nirnimesh
2010/11/10 07:53:10
A bulk of the login function in this and next test
venkataramana1
2010/11/23 02:14:27
Done.
| |
51 # We need to replace username/passwd values later | |
52 self.ExecuteJavascript( | |
53 'document.getElementById("Email").value = "xxxx"; ' | |
54 'window.domAutomationController.send("done")') | |
55 | |
56 self.ExecuteJavascript( | |
57 'document.getElementById("Passwd").value = "xxxx"; ' | |
58 'window.domAutomationController.send("done")') | |
59 | |
60 self.ExecuteJavascript( | |
61 'document.getElementById("gaia_loginform").submit(); ' | |
62 'window.domAutomationController.send("done")') | |
63 | |
64 self.assertTrue(self.WaitUntil( | |
65 lambda: re.search('Inbox', self.GetActiveTabTitle()))) | |
66 self.WaitForInfobarCount(1) | |
67 self.assertTrue(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) | |
68 self.NavigateToURL("http://www.google.com") | |
69 self.assertTrue(self.WaitUntil( | |
70 lambda: re.search('Google', self.GetActiveTabTitle()))) | |
71 self.WaitForInfobarCount(0) | |
72 logging.info('--------------- %s ' % str(self.GetBrowserInfo()['windows'][0] | |
Nirnimesh
2010/11/10 07:53:10
remove this
venkataramana1
2010/11/23 02:14:27
Done.
| |
73 ['tabs'][0]['infobars'])) | |
74 self.assertEqual('Google', self.GetActiveTabTitle()) | |
75 self.assertFalse(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) | |
44 | 76 |
45 | 77 |
78 def testInfoBarDisappearByReload(self): | |
79 """Test that Password info bar disappears by the page reload.""" | |
80 self.NavigateToURL('http://www.gmail.com') | |
81 | |
82 # We need to replace username/passwd values later | |
83 self.ExecuteJavascript( | |
84 'document.getElementById("Email").value = "xxxx"; ' | |
85 ' window.domAutomationController.send("done")') | |
86 self.ExecuteJavascript( | |
87 'document.getElementById("Passwd").value = "xxxx"; ' | |
88 'window.domAutomationController.send("done")') | |
89 self.ExecuteJavascript( | |
90 'document.getElementById("gaia_loginform").submit(); ' | |
91 'window.domAutomationController.send("done")') | |
92 self.assertTrue(self.WaitUntil( | |
93 lambda: re.search('Inbox', self.GetActiveTabTitle()))) | |
94 self.WaitForInfobarCount(1) | |
95 self.assertTrue(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) | |
96 self.GetBrowserWindow(0).GetTab(0).Reload() | |
97 self.assertTrue(self.WaitUntil( | |
98 lambda: re.search('Google', self.GetActiveTabTitle()))) | |
99 self.WaitForInfobarCount(0) | |
100 logging.info('--------------- %s ' % str(self.GetBrowserInfo()['windows'][0] | |
Nirnimesh
2010/11/10 07:53:10
remove this
venkataramana1
2010/11/23 02:14:27
Done.
| |
101 ['tabs'][0]['infobars'])) | |
102 self.assertFalse(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) | |
103 | |
104 def testRemoveAllPasswords(self): | |
Nirnimesh
2010/11/10 07:53:10
remove this test for now.
venkataramana1
2010/11/23 02:14:27
Done.
| |
105 """Clear All passwords using Clear Browsing Profile.""" | |
106 self.testSavePassword() | |
107 self.ClearBrowsingData(['PASSWORDS'],'EVERYTHING') | |
108 #self.assertEquals(0, len(self.GetSavedPasswords())) | |
109 | |
46 if __name__ == '__main__': | 110 if __name__ == '__main__': |
47 pyauto_functional.Main() | 111 pyauto_functional.Main() |
OLD | NEW |