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

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

Issue 2906383003: Teach PasswordAutofillAgent sometimes match prefixes of usernames (Closed)
Patch Set: dvadym@ comments Created 3 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
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 15619b6161c35330fd4c4d9d1c56be7506e3b61d..475e450dc48baf98f311a024a2830a1186c24770 100644
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -717,6 +717,19 @@ TEST_F(PasswordAutofillAgentTest,
UTF16ToUTF8(password3_), true);
}
+// Fill a password field if the stored username is a prefix of username in
+// read-only field.
+TEST_F(PasswordAutofillAgentTest,
+ AutocompletePasswordForReadonlyUsernamePrefixMatched) {
vabr (Chromium) 2017/06/12 18:56:58 Could you please also add a negative test? For exa
melandory 2017/06/19 10:53:48 Done
+ base::string16 username_at = username3_ + base::UTF8ToUTF16("@example.com");
+ username_element_.SetValue(WebString::FromUTF16(username3_));
+ SetElementReadOnly(username_element_, true);
+
+ // Filled even though username is not the preferred match.
vabr (Chromium) 2017/06/12 18:56:58 nit: "preferred match" is a sort of a term, used i
melandory 2017/06/19 10:53:48 Done.
+ SimulateOnFillPasswordForm(fill_data_);
+ CheckTextFieldsState(UTF16ToUTF8(username3_), false, UTF16ToUTF8(password3_),
+ true);
+}
// If a username field is empty and readonly, don't autofill.
TEST_F(PasswordAutofillAgentTest,
NoAutocompletePasswordForReadonlyUsernameUnmatched) {

Powered by Google App Engine
This is Rietveld 408576698