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_impl.h" | 5 #include "components/password_manager/content/browser/credential_manager_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 EXPECT_CALL(*client_, NotifyStorePasswordCalled()); | 401 EXPECT_CALL(*client_, NotifyStorePasswordCalled()); |
402 | 402 |
403 bool called = false; | 403 bool called = false; |
404 CallStore(info, base::Bind(&RespondCallback, &called)); | 404 CallStore(info, base::Bind(&RespondCallback, &called)); |
405 | 405 |
406 // Allow the PasswordFormManager to talk to the password store, determine | 406 // Allow the PasswordFormManager to talk to the password store, determine |
407 // that the form is new, and set it as pending. | 407 // that the form is new, and set it as pending. |
408 RunAllPendingTasks(); | 408 RunAllPendingTasks(); |
409 | 409 |
410 EXPECT_TRUE(called); | 410 EXPECT_TRUE(called); |
411 EXPECT_TRUE(client_->pending_manager()->HasCompletedMatching()); | 411 EXPECT_EQ(FormFetcher::State::NOT_WAITING, |
| 412 client_->pending_manager()->form_fetcher()->GetState()); |
412 | 413 |
413 autofill::PasswordForm new_form = | 414 autofill::PasswordForm new_form = |
414 client_->pending_manager()->pending_credentials(); | 415 client_->pending_manager()->pending_credentials(); |
415 EXPECT_EQ(form_.username_value, new_form.username_value); | 416 EXPECT_EQ(form_.username_value, new_form.username_value); |
416 EXPECT_EQ(form_.display_name, new_form.display_name); | 417 EXPECT_EQ(form_.display_name, new_form.display_name); |
417 EXPECT_EQ(form_.password_value, new_form.password_value); | 418 EXPECT_EQ(form_.password_value, new_form.password_value); |
418 EXPECT_EQ(form_.origin, new_form.origin); | 419 EXPECT_EQ(form_.origin, new_form.origin); |
419 EXPECT_EQ(form_.signon_realm, new_form.signon_realm); | 420 EXPECT_EQ(form_.signon_realm, new_form.signon_realm); |
420 EXPECT_TRUE(new_form.federation_origin.unique()); | 421 EXPECT_TRUE(new_form.federation_origin.unique()); |
421 EXPECT_EQ(form_.icon_url, new_form.icon_url); | 422 EXPECT_EQ(form_.icon_url, new_form.icon_url); |
(...skipping 12 matching lines...) Expand all Loading... |
434 form_.password_value = base::string16(); | 435 form_.password_value = base::string16(); |
435 form_.signon_realm = "federation://example.com/google.com"; | 436 form_.signon_realm = "federation://example.com/google.com"; |
436 CredentialInfo info(form_, CredentialType::CREDENTIAL_TYPE_FEDERATED); | 437 CredentialInfo info(form_, CredentialType::CREDENTIAL_TYPE_FEDERATED); |
437 CallStore(info, base::Bind(&RespondCallback, &called)); | 438 CallStore(info, base::Bind(&RespondCallback, &called)); |
438 | 439 |
439 // Allow the PasswordFormManager to talk to the password store, determine | 440 // Allow the PasswordFormManager to talk to the password store, determine |
440 // that the form is new, and set it as pending. | 441 // that the form is new, and set it as pending. |
441 RunAllPendingTasks(); | 442 RunAllPendingTasks(); |
442 | 443 |
443 EXPECT_TRUE(called); | 444 EXPECT_TRUE(called); |
444 EXPECT_TRUE(client_->pending_manager()->HasCompletedMatching()); | 445 EXPECT_EQ(FormFetcher::State::NOT_WAITING, |
| 446 client_->pending_manager()->form_fetcher()->GetState()); |
445 | 447 |
446 autofill::PasswordForm new_form = | 448 autofill::PasswordForm new_form = |
447 client_->pending_manager()->pending_credentials(); | 449 client_->pending_manager()->pending_credentials(); |
448 EXPECT_EQ(form_.username_value, new_form.username_value); | 450 EXPECT_EQ(form_.username_value, new_form.username_value); |
449 EXPECT_EQ(form_.display_name, new_form.display_name); | 451 EXPECT_EQ(form_.display_name, new_form.display_name); |
450 EXPECT_EQ(form_.password_value, new_form.password_value); | 452 EXPECT_EQ(form_.password_value, new_form.password_value); |
451 EXPECT_EQ(form_.origin, new_form.origin); | 453 EXPECT_EQ(form_.origin, new_form.origin); |
452 EXPECT_EQ(form_.signon_realm, new_form.signon_realm); | 454 EXPECT_EQ(form_.signon_realm, new_form.signon_realm); |
453 EXPECT_EQ(form_.federation_origin, new_form.federation_origin); | 455 EXPECT_EQ(form_.federation_origin, new_form.federation_origin); |
454 EXPECT_EQ(form_.icon_url, new_form.icon_url); | 456 EXPECT_EQ(form_.icon_url, new_form.icon_url); |
(...skipping 17 matching lines...) Expand all Loading... |
472 EXPECT_CALL(*client_, NotifyStorePasswordCalled()); | 474 EXPECT_CALL(*client_, NotifyStorePasswordCalled()); |
473 | 475 |
474 bool called = false; | 476 bool called = false; |
475 CallStore(info, base::Bind(&RespondCallback, &called)); | 477 CallStore(info, base::Bind(&RespondCallback, &called)); |
476 | 478 |
477 // Allow the PasswordFormManager to talk to the password store, determine | 479 // Allow the PasswordFormManager to talk to the password store, determine |
478 // that the form is new, and set it as pending. | 480 // that the form is new, and set it as pending. |
479 RunAllPendingTasks(); | 481 RunAllPendingTasks(); |
480 | 482 |
481 EXPECT_TRUE(called); | 483 EXPECT_TRUE(called); |
482 EXPECT_TRUE(client_->pending_manager()->HasCompletedMatching()); | 484 EXPECT_EQ(FormFetcher::State::NOT_WAITING, |
| 485 client_->pending_manager()->form_fetcher()->GetState()); |
483 client_->pending_manager()->Save(); | 486 client_->pending_manager()->Save(); |
484 | 487 |
485 RunAllPendingTasks(); | 488 RunAllPendingTasks(); |
486 TestPasswordStore::PasswordMap passwords = store_->stored_passwords(); | 489 TestPasswordStore::PasswordMap passwords = store_->stored_passwords(); |
487 EXPECT_THAT(passwords["https://example.com/"], ElementsAre(form_)); | 490 EXPECT_THAT(passwords["https://example.com/"], ElementsAre(form_)); |
488 federated.date_created = | 491 federated.date_created = |
489 passwords["federation://example.com/google.com"][0].date_created; | 492 passwords["federation://example.com/google.com"][0].date_created; |
490 EXPECT_THAT(passwords["federation://example.com/google.com"], | 493 EXPECT_THAT(passwords["federation://example.com/google.com"], |
491 ElementsAre(federated)); | 494 ElementsAre(federated)); |
492 } | 495 } |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 _, CredentialSourceType::CREDENTIAL_SOURCE_API)); | 1459 _, CredentialSourceType::CREDENTIAL_SOURCE_API)); |
1457 CallStore(info, base::Bind(&RespondCallback, &called)); | 1460 CallStore(info, base::Bind(&RespondCallback, &called)); |
1458 // Allow the PasswordFormManager to talk to the password store | 1461 // Allow the PasswordFormManager to talk to the password store |
1459 RunAllPendingTasks(); | 1462 RunAllPendingTasks(); |
1460 | 1463 |
1461 ASSERT_TRUE(client_->pending_manager()); | 1464 ASSERT_TRUE(client_->pending_manager()); |
1462 EXPECT_TRUE(client_->pending_manager()->IsBlacklisted()); | 1465 EXPECT_TRUE(client_->pending_manager()->IsBlacklisted()); |
1463 } | 1466 } |
1464 | 1467 |
1465 } // namespace password_manager | 1468 } // namespace password_manager |
OLD | NEW |