Commit 8d57f9c3 authored by Mohamed Amir Yosef's avatar Mohamed Amir Yosef Committed by Commit Bot

Revert "[Passwords] Save CompromisedCredentials in the correct store"

This reverts commit a39032ce.

Reason for revert: Suspect to have caused egtest failures https://ci.chromium.org/p/chromium/builders/ci/ios-simulator-full-configs/26041

Original change's description:
> [Passwords] Save CompromisedCredentials in the correct store
> 
> Bug: 1108422
> Change-Id: I3a96f9d3a422590df5c0b0947e6b803c074ef9a0
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2372322
> Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
> Reviewed-by: Jan Wilken Dörrie <jdoerrie@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#801346}

TBR=jdoerrie@chromium.org,mamir@chromium.org

Change-Id: I93de62690d0d950243d48e36ad10d14fd866fb43
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1108422
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2375365Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801358}
parent 36fc288d
...@@ -216,10 +216,7 @@ void CompromisedCredentialsManager::SaveCompromisedCredential( ...@@ -216,10 +216,7 @@ void CompromisedCredentialsManager::SaveCompromisedCredential(
if (saved_password.password_value == credential.password() && if (saved_password.password_value == credential.password() &&
CanonicalizeUsername(saved_password.username_value) == CanonicalizeUsername(saved_password.username_value) ==
canonicalized_username) { canonicalized_username) {
PasswordStore& store = saved_password.IsUsingAccountStore() profile_store_->AddCompromisedCredentials({
? *account_store_
: *profile_store_;
store.AddCompromisedCredentials({
.signon_realm = saved_password.signon_realm, .signon_realm = saved_password.signon_realm,
.username = saved_password.username_value, .username = saved_password.username_value,
.create_time = base::Time::Now(), .create_time = base::Time::Now(),
......
...@@ -605,41 +605,4 @@ TEST_F(CompromisedCredentialsManagerWithTwoStoresTest, ...@@ -605,41 +605,4 @@ TEST_F(CompromisedCredentialsManagerWithTwoStoresTest,
base::ASCIIToUTF16(kPassword2))), base::ASCIIToUTF16(kPassword2))),
ElementsAreArray(account_store().stored_passwords().at(kExampleOrg))); ElementsAreArray(account_store().stored_passwords().at(kExampleOrg)));
} }
// Test verifies that saving LeakCheckCredential via provider adds expected
// compromised credential to the correct store.
TEST_F(CompromisedCredentialsManagerWithTwoStoresTest,
SaveCompromisedPassword) {
ASSERT_TRUE(profile_store().compromised_credentials().empty());
ASSERT_TRUE(account_store().compromised_credentials().empty());
// Add `kUsername1`,`kPassword1` to both stores.
// And add `kUsername1`,`kPassword2` to the account store only.
profile_store().AddLogin(
MakeSavedPassword(kExampleCom, kUsername1, kPassword1));
account_store().AddLogin(
MakeSavedPassword(kExampleOrg, kUsername1, kPassword1));
account_store().AddLogin(
MakeSavedPassword(kExampleCom, kUsername1, kPassword2));
RunUntilIdle();
// Mark `kUsername1`, `kPassword1` as compromised, a new entry should be
// added to both stores.
provider().SaveCompromisedCredential(
MakeLeakCredential(kUsername1, kPassword1));
RunUntilIdle();
EXPECT_EQ(1U, profile_store().compromised_credentials().size());
EXPECT_EQ(1U, account_store().compromised_credentials().size());
// Now, mark `kUsername1`, `kPassword2` as compromised, a new entry should be
// added only to the account store.
provider().SaveCompromisedCredential(
MakeLeakCredential(kUsername1, kPassword2));
RunUntilIdle();
EXPECT_EQ(1U, profile_store().compromised_credentials().size());
EXPECT_EQ(2U, account_store().compromised_credentials().size());
}
} // namespace password_manager } // namespace password_manager
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