Commit 0d1273c6 authored by Mohamed Amir Yosef's avatar Mohamed Amir Yosef Committed by Commit Bot

[Passwords] Clear moving_blocked_for_list before moving to account store

Bug: 1032992
Change-Id: I37e14d4a6b7fa9747d1509b4c1a5e594ad23ba23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144147Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759172}
parent 0768f7b1
...@@ -237,7 +237,9 @@ void MultiStorePasswordSaveManager::MoveCredentialsToAccountStore() { ...@@ -237,7 +237,9 @@ void MultiStorePasswordSaveManager::MoveCredentialsToAccountStore() {
// store, 1) to avoid unnecessary sync cycles, 2) to avoid potential // store, 1) to avoid unnecessary sync cycles, 2) to avoid potential
// last_used_date update. // last_used_date update.
if (!AccountStoreMatchesContainForm(account_store_matches, *match)) { if (!AccountStoreMatchesContainForm(account_store_matches, *match)) {
account_store_form_saver_->Save(*match, account_store_matches, PasswordForm match_copy = *match;
match_copy.moving_blocked_for_list.clear();
account_store_form_saver_->Save(match_copy, account_store_matches,
/*old_password=*/base::string16()); /*old_password=*/base::string16());
} }
form_saver_->Remove(*match); form_saver_->Remove(*match);
......
...@@ -670,6 +670,8 @@ TEST_F(MultiStorePasswordSaveManagerTest, ...@@ -670,6 +670,8 @@ TEST_F(MultiStorePasswordSaveManagerTest,
MoveCredentialsFromProfileToAccountStoreWhenExistsOnlyInProfileStore) { MoveCredentialsFromProfileToAccountStoreWhenExistsOnlyInProfileStore) {
PasswordForm saved_match_in_profile_store(saved_match_); PasswordForm saved_match_in_profile_store(saved_match_);
saved_match_in_profile_store.in_store = PasswordForm::Store::kProfileStore; saved_match_in_profile_store.in_store = PasswordForm::Store::kProfileStore;
saved_match_in_profile_store.moving_blocked_for_list.push_back(
autofill::GaiaIdHash::FromGaiaId("user@gmail.com"));
SetNonFederatedAndNotifyFetchCompleted({&saved_match_in_profile_store}); SetNonFederatedAndNotifyFetchCompleted({&saved_match_in_profile_store});
password_save_manager()->CreatePendingCredentials( password_save_manager()->CreatePendingCredentials(
...@@ -677,9 +679,13 @@ TEST_F(MultiStorePasswordSaveManagerTest, ...@@ -677,9 +679,13 @@ TEST_F(MultiStorePasswordSaveManagerTest,
/*is_http_auth=*/false, /*is_http_auth=*/false,
/*is_credential_api_save=*/false); /*is_credential_api_save=*/false);
PasswordForm saved_match_without_moving_blocked_list(
saved_match_in_profile_store);
saved_match_without_moving_blocked_list.moving_blocked_for_list.clear();
EXPECT_CALL(*mock_profile_form_saver(), Remove(saved_match_in_profile_store)); EXPECT_CALL(*mock_profile_form_saver(), Remove(saved_match_in_profile_store));
EXPECT_CALL(*mock_account_form_saver(), EXPECT_CALL(*mock_account_form_saver(),
Save(saved_match_in_profile_store, _, _)); Save(saved_match_without_moving_blocked_list, _, _));
password_save_manager()->MoveCredentialsToAccountStore(); password_save_manager()->MoveCredentialsToAccountStore();
} }
......
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