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

Unified Diff: components/password_manager/content/browser/credential_manager_impl_unittest.cc

Issue 1962713002: Kill the autofill password manager in case 'store()' was called. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: components/password_manager/content/browser/credential_manager_impl_unittest.cc
diff --git a/components/password_manager/content/browser/credential_manager_impl_unittest.cc b/components/password_manager/content/browser/credential_manager_impl_unittest.cc
index cfd372840685025edfbe94abfa522cbc215e4918..94a9af8f033063b484e826b17fe6aad72c4fa041 100644
--- a/components/password_manager/content/browser/credential_manager_impl_unittest.cc
+++ b/components/password_manager/content/browser/credential_manager_impl_unittest.cc
@@ -58,6 +58,7 @@ class MockPasswordManagerClient : public StubPasswordManagerClient {
bool(const std::vector<autofill::PasswordForm*>& local_forms));
MOCK_METHOD1(NotifyUserCouldBeAutoSignedInPtr,
bool(autofill::PasswordForm* form));
+ MOCK_METHOD0(NotifyStorePasswordCalled, void());
MOCK_METHOD2(PromptUserToSavePasswordPtr,
void(PasswordFormManager*, CredentialSourceType type));
MOCK_METHOD4(PromptUserToChooseCredentialsPtr,
@@ -394,6 +395,7 @@ TEST_F(CredentialManagerImplTest, CredentialManagerOnStore) {
EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(
_, CredentialSourceType::CREDENTIAL_SOURCE_API))
.Times(testing::Exactly(1));
+ EXPECT_CALL(*client_, NotifyStorePasswordCalled());
bool called = false;
CallStore(info, base::Bind(&RespondCallback, &called));
@@ -424,13 +426,11 @@ TEST_F(CredentialManagerImplTest, CredentialManagerStoreOverwrite) {
// the password without prompting the user.
CredentialInfo info(form_, CredentialType::CREDENTIAL_TYPE_PASSWORD);
info.password = base::ASCIIToUTF16("Totally new password.");
+ EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(_, _)).Times(0);
+ EXPECT_CALL(*client_, NotifyStorePasswordCalled());
bool called = false;
CallStore(info, base::Bind(&RespondCallback, &called));
- EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(
- _, CredentialSourceType::CREDENTIAL_SOURCE_API))
- .Times(testing::Exactly(0));
-
// Allow the PasswordFormManager to talk to the password store, determine
// the form is a match for an existing form, and update the PasswordStore.
RunAllPendingTasks();
@@ -457,6 +457,7 @@ TEST_F(CredentialManagerImplTest, CredentialManagerStoreOverwriteZeroClick) {
// the credential without prompting the user.
CredentialInfo info(form_, CredentialType::CREDENTIAL_TYPE_PASSWORD);
bool called = false;
+ EXPECT_CALL(*client_, NotifyStorePasswordCalled());
CallStore(info, base::Bind(&RespondCallback, &called));
// Allow the PasswordFormManager to talk to the password store, determine
@@ -484,6 +485,7 @@ TEST_F(CredentialManagerImplTest,
// the credential without prompting the user.
CredentialInfo info(form_, CredentialType::CREDENTIAL_TYPE_FEDERATED);
bool called = false;
+ EXPECT_CALL(*client_, NotifyStorePasswordCalled());
CallStore(info, base::Bind(&RespondCallback, &called));
// Allow the PasswordFormManager to talk to the password store, determine
@@ -537,6 +539,7 @@ TEST_F(CredentialManagerImplTest,
EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(
_, CredentialSourceType::CREDENTIAL_SOURCE_API))
.Times(testing::Exactly(0));
+ EXPECT_CALL(*client_, NotifyStorePasswordCalled()).Times(0);
bool called = false;
CallStore(info, base::Bind(&RespondCallback, &called));

Powered by Google App Engine
This is Rietveld 408576698