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

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

Issue 17341006: [Password Autofill] Don't fill fields with autocomplete="off". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « no previous file | components/autofill/content/renderer/password_autofill_agent.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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'>"
« no previous file with comments | « no previous file | components/autofill/content/renderer/password_autofill_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698