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

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

Issue 1968443002: Kill the autofill password manager in case 'store()' was called. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
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_dispatcher_unittest.cc
diff --git a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
index 259d43bd05116f57a6d894935aae35d9cdf3eb9b..16fa3b3ac5d077b21749ad09ef8d94e5043865b0 100644
--- a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
+++ b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
@@ -60,6 +60,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,
@@ -339,6 +340,7 @@ TEST_F(CredentialManagerDispatcherTest, CredentialManagerOnStore) {
EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(
_, CredentialSourceType::CREDENTIAL_SOURCE_API))
.Times(testing::Exactly(1));
+ EXPECT_CALL(*client_, NotifyStorePasswordCalled());
dispatcher()->OnStore(kRequestId, info);
@@ -373,12 +375,10 @@ TEST_F(CredentialManagerDispatcherTest, 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());
dispatcher()->OnStore(kRequestId, info);
- EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(
- _, CredentialSourceType::CREDENTIAL_SOURCE_API))
- .Times(testing::Exactly(0));
-
const uint32_t kMsgID = CredentialManagerMsg_AcknowledgeStore::ID;
const IPC::Message* message =
process()->sink().GetFirstMessageMatching(kMsgID);
@@ -409,6 +409,7 @@ TEST_F(CredentialManagerDispatcherTest,
// Calling 'OnStore' with a credential that matches |form_| should update
// the credential without prompting the user.
CredentialInfo info(form_, CredentialType::CREDENTIAL_TYPE_PASSWORD);
+ EXPECT_CALL(*client_, NotifyStorePasswordCalled());
dispatcher()->OnStore(kRequestId, info);
process()->sink().ClearMessages();
@@ -436,6 +437,7 @@ TEST_F(CredentialManagerDispatcherTest,
// Calling 'OnStore' with a credential that matches |form_| should update
// the credential without prompting the user.
CredentialInfo info(form_, CredentialType::CREDENTIAL_TYPE_FEDERATED);
+ EXPECT_CALL(*client_, NotifyStorePasswordCalled());
dispatcher()->OnStore(kRequestId, info);
process()->sink().ClearMessages();
@@ -489,6 +491,7 @@ TEST_F(CredentialManagerDispatcherTest,
EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(
_, CredentialSourceType::CREDENTIAL_SOURCE_API))
.Times(testing::Exactly(0));
+ EXPECT_CALL(*client_, NotifyStorePasswordCalled()).Times(0);
dispatcher()->OnStore(kRequestId, info);

Powered by Google App Engine
This is Rietveld 408576698