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 os | 6 import os |
7 | 7 |
8 import pyauto_functional # Must be imported before pyauto | 8 import pyauto_functional # Must be imported before pyauto |
9 import pyauto | 9 import pyauto |
10 import test_utils | 10 import test_utils |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 'action_target': action_target, | 47 'action_target': action_target, |
48 'blacklist': blacklist} | 48 'blacklist': blacklist} |
49 | 49 |
50 def testSavePassword(self): | 50 def testSavePassword(self): |
51 """Test saving a password and getting saved passwords.""" | 51 """Test saving a password and getting saved passwords.""" |
52 password1 = self._ConstructPasswordDictionary( | 52 password1 = self._ConstructPasswordDictionary( |
53 'user@example.com', 'test.password', | 53 'user@example.com', 'test.password', |
54 'https://www.example.com/', 'https://www.example.com/login', | 54 'https://www.example.com/', 'https://www.example.com/login', |
55 'username', 'password', 'https://www.example.com/login/') | 55 'username', 'password', 'https://www.example.com/login/') |
56 self.assertTrue(self.AddSavedPassword(password1)) | 56 self.assertTrue(self.AddSavedPassword(password1)) |
57 self.assertEquals(self.GetSavedPasswords(), [password1]) | 57 # There may be multiple logins for the same 'signon_realm', since other |
Nirnimesh
2011/05/10 19:25:52
Wouldn't tests begin with a clean profile?
dennis_jeffrey
2011/05/17 01:40:21
Yes, this is true in Windows and ChromeOS (the onl
| |
58 # tests in this file use them. We need to look for the particular login | |
59 # used by this test when verifiying. | |
60 saved_password = [x for x in self.GetSavedPasswords() | |
61 if x['signon_realm'] == 'https://www.example.com/' and | |
62 x['username_value'] == 'user@example.com'] | |
63 self.assertEquals(saved_password, [password1]) | |
58 | 64 |
59 def testRemovePasswords(self): | 65 def testRemovePasswords(self): |
60 """Verify that saved passwords can be removed.""" | 66 """Verify that saved passwords can be removed.""" |
61 password1 = self._ConstructPasswordDictionary( | 67 password1 = self._ConstructPasswordDictionary( |
62 'user1@example.com', 'test1.password', | 68 'user1@example.com', 'test1.password', |
63 'https://www.example.com/', 'https://www.example.com/login', | 69 'https://www.example.com/', 'https://www.example.com/login', |
64 'username1', 'password', 'https://www.example.com/login/') | 70 'username1', 'password', 'https://www.example.com/login/') |
65 password2 = self._ConstructPasswordDictionary( | 71 password2 = self._ConstructPasswordDictionary( |
66 'user2@example.com', 'test2.password', | 72 'user2@example.com', 'test2.password', |
67 'https://www.example.com/', 'https://www.example.com/login', | 73 'https://www.example.com/', 'https://www.example.com/login', |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 self.ExecuteJavascript(set_focus, 0, 0) | 273 self.ExecuteJavascript(set_focus, 0, 0) |
268 self._SendCharToPopulateField('t', tab_index=0, windex=0) | 274 self._SendCharToPopulateField('t', tab_index=0, windex=0) |
269 passwd_value = self.GetDOMValue('document.getElementById("Passwd").value') | 275 passwd_value = self.GetDOMValue('document.getElementById("Passwd").value') |
270 self.assertFalse(passwd_value, | 276 self.assertFalse(passwd_value, |
271 msg='Password field not empty for new username.') | 277 msg='Password field not empty for new username.') |
272 test_utils.ClearPasswords(self) | 278 test_utils.ClearPasswords(self) |
273 | 279 |
274 | 280 |
275 if __name__ == '__main__': | 281 if __name__ == '__main__': |
276 pyauto_functional.Main() | 282 pyauto_functional.Main() |
OLD | NEW |