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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 EXPECT_TRUE(message); | 254 EXPECT_TRUE(message); |
255 process()->sink().ClearMessages(); | 255 process()->sink().ClearMessages(); |
256 | 256 |
257 RunAllPendingTasks(); | 257 RunAllPendingTasks(); |
258 | 258 |
259 EXPECT_FALSE(client_->did_prompt_user_to_save()); | 259 EXPECT_FALSE(client_->did_prompt_user_to_save()); |
260 EXPECT_FALSE(client_->pending_manager()); | 260 EXPECT_FALSE(client_->pending_manager()); |
261 } | 261 } |
262 | 262 |
263 TEST_F(CredentialManagerDispatcherTest, CredentialManagerOnNotifySignedOut) { | 263 TEST_F(CredentialManagerDispatcherTest, CredentialManagerOnNotifySignedOut) { |
| 264 store_->AddLogin(form_); |
| 265 store_->AddLogin(cross_origin_form_); |
| 266 RunAllPendingTasks(); |
| 267 |
| 268 TestPasswordStore::PasswordMap passwords = store_->stored_passwords(); |
| 269 EXPECT_EQ(2U, passwords.size()); |
| 270 EXPECT_EQ(1U, passwords[form_.signon_realm].size()); |
| 271 EXPECT_EQ(1U, passwords[cross_origin_form_.signon_realm].size()); |
| 272 EXPECT_FALSE(passwords[form_.signon_realm][0].skip_zero_click); |
| 273 EXPECT_FALSE(passwords[cross_origin_form_.signon_realm][0].skip_zero_click); |
| 274 |
264 dispatcher()->OnNotifySignedOut(kRequestId); | 275 dispatcher()->OnNotifySignedOut(kRequestId); |
| 276 RunAllPendingTasks(); |
265 | 277 |
266 const uint32 kMsgID = CredentialManagerMsg_AcknowledgeSignedOut::ID; | 278 const uint32 kMsgID = CredentialManagerMsg_AcknowledgeSignedOut::ID; |
267 const IPC::Message* message = | 279 const IPC::Message* message = |
268 process()->sink().GetFirstMessageMatching(kMsgID); | 280 process()->sink().GetFirstMessageMatching(kMsgID); |
269 EXPECT_TRUE(message); | 281 EXPECT_TRUE(message); |
270 process()->sink().ClearMessages(); | 282 process()->sink().ClearMessages(); |
| 283 |
| 284 passwords = store_->stored_passwords(); |
| 285 EXPECT_EQ(2U, passwords.size()); |
| 286 EXPECT_EQ(1U, passwords[form_.signon_realm].size()); |
| 287 EXPECT_EQ(1U, passwords[cross_origin_form_.signon_realm].size()); |
| 288 EXPECT_TRUE(passwords[form_.signon_realm][0].skip_zero_click); |
| 289 EXPECT_FALSE(passwords[cross_origin_form_.signon_realm][0].skip_zero_click); |
271 } | 290 } |
272 | 291 |
273 TEST_F(CredentialManagerDispatcherTest, | 292 TEST_F(CredentialManagerDispatcherTest, |
274 CredentialManagerOnRequestCredentialWithEmptyPasswordStore) { | 293 CredentialManagerOnRequestCredentialWithEmptyPasswordStore) { |
275 std::vector<GURL> federations; | 294 std::vector<GURL> federations; |
276 dispatcher()->OnRequestCredential(kRequestId, false, federations); | 295 dispatcher()->OnRequestCredential(kRequestId, false, federations); |
277 | 296 |
278 RunAllPendingTasks(); | 297 RunAllPendingTasks(); |
279 | 298 |
280 const uint32 kMsgID = CredentialManagerMsg_SendCredential::ID; | 299 const uint32 kMsgID = CredentialManagerMsg_SendCredential::ID; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 const IPC::Message* message = | 452 const IPC::Message* message = |
434 process()->sink().GetFirstMessageMatching(kMsgID); | 453 process()->sink().GetFirstMessageMatching(kMsgID); |
435 ASSERT_TRUE(message); | 454 ASSERT_TRUE(message); |
436 CredentialManagerMsg_SendCredential::Param param; | 455 CredentialManagerMsg_SendCredential::Param param; |
437 CredentialManagerMsg_SendCredential::Read(message, ¶m); | 456 CredentialManagerMsg_SendCredential::Read(message, ¶m); |
438 EXPECT_EQ(CredentialType::CREDENTIAL_TYPE_EMPTY, get<1>(param).type); | 457 EXPECT_EQ(CredentialType::CREDENTIAL_TYPE_EMPTY, get<1>(param).type); |
439 EXPECT_FALSE(client_->did_prompt_user_to_choose()); | 458 EXPECT_FALSE(client_->did_prompt_user_to_choose()); |
440 } | 459 } |
441 | 460 |
442 } // namespace password_manager | 461 } // namespace password_manager |
OLD | NEW |