Index: chrome/renderer/autofill/password_autofill_agent_browsertest.cc |
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc |
index 9813cad5bb41e65287e1dde15946f2a877a35b3d..5176220bd7c2aa0fe43168d928052c761e2fb26d 100644 |
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc |
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc |
@@ -281,6 +281,21 @@ TEST_F(PasswordAutofillAgentTest, NoInitialAutocompleteForFilledField) { |
CheckTextFieldsState("bogus", false, std::string(), false); |
} |
+// Tests that changing the username does not fill a field specifying |
+// autocomplete="off". |
+TEST_F(PasswordAutofillAgentTest, NoInitialAutocompleteForAutocompleteOff) { |
+ password_element_.setAttribute(WebString::fromUTF8("autocomplete"), |
+ WebString::fromUTF8("off")); |
+ |
+ // Simulate the browser sending back the login info, it triggers the |
+ // autocomplete. |
+ SimulateOnFillPasswordForm(fill_data_); |
+ |
+ // Only the username should have been autocompleted. |
+ // TODO(jcivelli): may be we should not event fill the username? |
+ CheckTextFieldsState(kAliceUsername, true, std::string(), false); |
+} |
+ |
TEST_F(PasswordAutofillAgentTest, NoAutocompleteForTextFieldPasswords) { |
const char kTextFieldPasswordFormHTML[] = |
"<FORM name='LoginTestForm' action='http://www.bidule.com'>" |