Commit a4fd001d authored by Jaeyong Bae's avatar Jaeyong Bae Committed by Commit Bot

[Passwords] Fix extra prompt to save credentials on reload

PasswordFormManager is not fully updated on credentials save
and PasswordFormManager::pending_credentials_ has the state before manual save.
So, we have to update PasswordFormManager when fetch completed.

Bug: 904427
Change-Id: I3c2f0af7db909d25ded412a5780a93006d1d24da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1984787
Commit-Queue: Vadym Doroshenko <dvadym@chromium.org>
Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732015}
parent a10f7630
...@@ -566,6 +566,9 @@ void PasswordFormManager::OnFetchCompleted() { ...@@ -566,6 +566,9 @@ void PasswordFormManager::OnFetchCompleted() {
return; return;
} }
if (is_submitted_)
CreatePendingCredentials();
if (IsHttpAuth()) { if (IsHttpAuth()) {
// No server prediction for http auth, so no need to wait. // No server prediction for http auth, so no need to wait.
FillHttpAuth(); FillHttpAuth();
......
...@@ -725,6 +725,14 @@ TEST_P(PasswordFormManagerTest, CreatePendingCredentialsEmptyStore) { ...@@ -725,6 +725,14 @@ TEST_P(PasswordFormManagerTest, CreatePendingCredentialsEmptyStore) {
EXPECT_GE(pending_credentials.date_last_used, kNow); EXPECT_GE(pending_credentials.date_last_used, kNow);
} }
// Tests creating pending credentials when fetch completed
TEST_P(PasswordFormManagerTest, CreatePendingCredentialsWhenFetchCompleted) {
form_manager_->set_wait_for_server_predictions_for_filling(false);
form_manager_->ProvisionallySave(submitted_form_, &driver_, nullptr);
SetNonFederatedAndNotifyFetchCompleted({&parsed_submitted_form_});
EXPECT_FALSE(form_manager_->IsNewLogin());
}
// Tests creating pending credentials when new credentials are submitted and the // Tests creating pending credentials when new credentials are submitted and the
// store has another credentials saved. // store has another credentials saved.
TEST_P(PasswordFormManagerTest, CreatePendingCredentialsNewCredentials) { TEST_P(PasswordFormManagerTest, CreatePendingCredentialsNewCredentials) {
......
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