Commit ffddb8da authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Passwords: Re-fill fields when the autofill suggestions are updated

Bug: 1016712
Change-Id: Iaf86d87d3f53c6446199897f4a2482c49ef5ff2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1900996Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713372}
parent 3173f7c7
......@@ -3900,9 +3900,8 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
EXPECT_EQ(base::ASCIIToUTF16("user"), controller->GetElidedValueAt(0));
EXPECT_NE(base::ASCIIToUTF16("admin"), controller->GetElidedValueAt(1));
// TODO(crbug.com/1004777): Here the username_field should get re-filled with
// "user" instead of "admin".
// WaitForElementValue("username_field", "user");
// The username_field should get re-filled with "user" instead of "admin".
WaitForElementValue("username_field", "user");
// Delete all the credentials.
password_store->RemoveLogin(user_form);
......
......@@ -1558,6 +1558,7 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
possible_email_domain) ||
fill_data.username_may_use_prefilled_placeholder);
if (!username_element.Value().IsEmpty() &&
username_element.GetAutofillState() == WebAutofillState::kNotFilled &&
!prefilled_placeholder_username) {
// Username is filled with content that was not on a list of known
// placeholder texts (e.g. "username or email") nor there is server-side
......@@ -1605,8 +1606,10 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
// Input matches the username, fill in required values.
if (!username_element.IsNull() && IsElementEditable(username_element)) {
if (!username.empty() && (username_element.Value().IsEmpty() ||
prefilled_placeholder_username)) {
if (!username.empty() &&
(username_element.Value().IsEmpty() ||
username_element.GetAutofillState() != WebAutofillState::kNotFilled ||
prefilled_placeholder_username)) {
AutofillField(username, username_element);
if (prefilled_placeholder_username) {
LogPrefilledUsernameFillOutcome(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment