OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/password_manager/content/browser/credential_manager_dispatc
her.h" | 5 #include "components/password_manager/content/browser/credential_manager_dispatc
her.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 protected: | 207 protected: |
208 autofill::PasswordForm form_; | 208 autofill::PasswordForm form_; |
209 autofill::PasswordForm origin_path_form_; | 209 autofill::PasswordForm origin_path_form_; |
210 autofill::PasswordForm cross_origin_form_; | 210 autofill::PasswordForm cross_origin_form_; |
211 scoped_refptr<TestPasswordStore> store_; | 211 scoped_refptr<TestPasswordStore> store_; |
212 scoped_ptr<MockPasswordManagerClient> client_; | 212 scoped_ptr<MockPasswordManagerClient> client_; |
213 StubPasswordManagerDriver stub_driver_; | 213 StubPasswordManagerDriver stub_driver_; |
214 scoped_ptr<CredentialManagerDispatcher> dispatcher_; | 214 scoped_ptr<CredentialManagerDispatcher> dispatcher_; |
215 }; | 215 }; |
216 | 216 |
217 TEST_F(CredentialManagerDispatcherTest, CredentialManagerOnNotifyFailedSignIn) { | |
218 CredentialInfo info; | |
219 info.type = CredentialType::CREDENTIAL_TYPE_PASSWORD; | |
220 dispatcher()->OnNotifyFailedSignIn(kRequestId, info); | |
221 | |
222 const uint32 kMsgID = CredentialManagerMsg_AcknowledgeFailedSignIn::ID; | |
223 const IPC::Message* message = | |
224 process()->sink().GetFirstMessageMatching(kMsgID); | |
225 EXPECT_TRUE(message); | |
226 process()->sink().ClearMessages(); | |
227 } | |
228 | |
229 TEST_F(CredentialManagerDispatcherTest, CredentialManagerOnNotifySignedIn) { | 217 TEST_F(CredentialManagerDispatcherTest, CredentialManagerOnNotifySignedIn) { |
230 CredentialInfo info( | 218 CredentialInfo info( |
231 form_, password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD); | 219 form_, password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD); |
232 EXPECT_CALL( | 220 EXPECT_CALL( |
233 *client_, | 221 *client_, |
234 PromptUserToSavePasswordPtr( | 222 PromptUserToSavePasswordPtr( |
235 _, password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API)) | 223 _, password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API)) |
236 .Times(testing::Exactly(1)); | 224 .Times(testing::Exactly(1)); |
237 | 225 |
238 dispatcher()->OnNotifySignedIn(kRequestId, info); | 226 dispatcher()->OnNotifySignedIn(kRequestId, info); |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 const uint32 kMsgID = CredentialManagerMsg_SendCredential::ID; | 611 const uint32 kMsgID = CredentialManagerMsg_SendCredential::ID; |
624 const IPC::Message* message = | 612 const IPC::Message* message = |
625 process()->sink().GetFirstMessageMatching(kMsgID); | 613 process()->sink().GetFirstMessageMatching(kMsgID); |
626 ASSERT_TRUE(message); | 614 ASSERT_TRUE(message); |
627 CredentialManagerMsg_SendCredential::Param param; | 615 CredentialManagerMsg_SendCredential::Param param; |
628 CredentialManagerMsg_SendCredential::Read(message, ¶m); | 616 CredentialManagerMsg_SendCredential::Read(message, ¶m); |
629 EXPECT_EQ(CredentialType::CREDENTIAL_TYPE_EMPTY, base::get<1>(param).type); | 617 EXPECT_EQ(CredentialType::CREDENTIAL_TYPE_EMPTY, base::get<1>(param).type); |
630 } | 618 } |
631 | 619 |
632 } // namespace password_manager | 620 } // namespace password_manager |
OLD | NEW |