Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1846)

Unified Diff: chrome/renderer/autofill/password_autofill_manager_unittest.cc

Issue 6896036: Autofill passwords after re-opening tab containing a login page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/autofill/password_autofill_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/autofill/password_autofill_manager_unittest.cc
diff --git a/chrome/renderer/autofill/password_autofill_manager_unittest.cc b/chrome/renderer/autofill/password_autofill_manager_unittest.cc
index 5d56c792ea41c81a090e785d64afa439fb1f1b8a..f221d2411cd049167e03779515c2443559b0633b 100644
--- a/chrome/renderer/autofill/password_autofill_manager_unittest.cc
+++ b/chrome/renderer/autofill/password_autofill_manager_unittest.cc
@@ -203,7 +203,7 @@ TEST_F(PasswordAutofillManagerTest, InitialAutocomplete) {
CheckTextFieldsState(kAliceUsername, true, kAlicePassword, true);
}
-// Tests that having a non-empty username precludes the autocomplete.
+// Tests that we correctly fill forms having an empty 'action' attribute.
TEST_F(PasswordAutofillManagerTest, InitialAutocompleteForEmptyAction) {
const char kEmptyActionFormHTML[] =
"<FORM name='LoginTestForm'>"
@@ -251,7 +251,7 @@ TEST_F(PasswordAutofillManagerTest, NoInitialAutocompleteForReadOnly) {
CheckTextFieldsState(kAliceUsername, true, "", false);
}
-// Tests that having a non-empty username precludes the autocomplete.
+// Tests that having a non-matching username precludes the autocomplete.
TEST_F(PasswordAutofillManagerTest, NoInitialAutocompleteForFilledField) {
username_element_.setValue(WebString::fromUTF8("bogus"));
@@ -263,6 +263,18 @@ TEST_F(PasswordAutofillManagerTest, NoInitialAutocompleteForFilledField) {
CheckTextFieldsState("bogus", false, "", false);
}
+// Tests that having a matching username does not preclude the autocomplete.
+TEST_F(PasswordAutofillManagerTest, InitialAutocompleteForMatchingFilledField) {
+ username_element_.setValue(WebString::fromUTF8(kAliceUsername));
+
+ // Simulate the browser sending back the login info, it triggers the
+ // autocomplete.
+ SimulateOnFillPasswordForm(fill_data_);
+
+ // The username and password should have been autocompleted.
+ CheckTextFieldsState(kAliceUsername, true, kAlicePassword, true);
+}
+
// Tests that editing the password clears the autocompleted password field.
TEST_F(PasswordAutofillManagerTest, PasswordClearOnEdit) {
// Simulate the browser sending back the login info, it triggers the
« no previous file with comments | « chrome/renderer/autofill/password_autofill_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698