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

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

Issue 2949533002: Test for the autofill login for the form without username field.
Patch Set: 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
« no previous file with comments | « no previous file | 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_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..e09e2892dca80f0ad9beac77b2df78dc65604a49 100644
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -727,6 +727,20 @@ TEST_F(PasswordAutofillAgentTest,
CheckTextFieldsState(std::string(), false, std::string(), false);
}
+// If there is no username field and the saved credentials contain an empty
+// username, then the password is filled.
+TEST_F(PasswordAutofillAgentTest, AutocompletePasswordForNoUsername) {
+ // Load a form with no username and update test data.
+ LoadHTML(kVisibleFormWithNoUsernameHTML);
+ UpdateOnlyPasswordElement();
+ UpdateOriginForHTML(kVisibleFormWithNoUsernameHTML);
+
+ SimulateOnFillPasswordForm(fill_data_);
vabr (Chromium) 2017/06/19 13:03:36 Instead of fill_data_, you might need to make a co
+ EXPECT_TRUE(password_element_.IsAutofilled());
+ EXPECT_EQ(UTF16ToUTF8(password_for_empty_username_),
+ password_element_.Value().Utf8());
+}
+
// Tests that having a non-matching username precludes the autocomplete.
TEST_F(PasswordAutofillAgentTest, NoAutocompleteForFilledFieldUnmatched) {
username_element_.SetValue(WebString::FromUTF8("bogus"));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698