| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 std::vector<GURL> federations; | 640 std::vector<GURL> federations; |
| 641 | 641 |
| 642 EXPECT_CALL(*client_, NotifyUserAutoSigninBlockedOnFirstRunPtr(_)).Times(0); | 642 EXPECT_CALL(*client_, NotifyUserAutoSigninBlockedOnFirstRunPtr(_)).Times(0); |
| 643 dispatcher()->OnRequestCredential(kRequestId, true, false, federations); | 643 dispatcher()->OnRequestCredential(kRequestId, true, false, federations); |
| 644 | 644 |
| 645 ExpectZeroClickSignInFailure(); | 645 ExpectZeroClickSignInFailure(); |
| 646 } | 646 } |
| 647 | 647 |
| 648 TEST_F(CredentialManagerDispatcherTest, | 648 TEST_F(CredentialManagerDispatcherTest, |
| 649 CredentialManagerOnRequestCredentialFederatedMatch) { | 649 CredentialManagerOnRequestCredentialFederatedMatch) { |
| 650 form_.federation_url = GURL("https://example.com/"); | 650 form_.federation_origin = url::Origin(GURL("https://example.com/")); |
| 651 store_->AddLogin(form_); | 651 store_->AddLogin(form_); |
| 652 client_->set_first_run_seen(true); | 652 client_->set_first_run_seen(true); |
| 653 | 653 |
| 654 std::vector<GURL> federations; | 654 std::vector<GURL> federations; |
| 655 federations.push_back(GURL("https://example.com/")); | 655 federations.push_back(GURL("https://example.com/")); |
| 656 | 656 |
| 657 EXPECT_CALL(*client_, NotifyUserAutoSigninBlockedOnFirstRunPtr(_)).Times(0); | 657 EXPECT_CALL(*client_, NotifyUserAutoSigninBlockedOnFirstRunPtr(_)).Times(0); |
| 658 dispatcher()->OnRequestCredential(kRequestId, true, true, federations); | 658 dispatcher()->OnRequestCredential(kRequestId, true, true, federations); |
| 659 | 659 |
| 660 ExpectZeroClickSignInSuccess(CredentialType::CREDENTIAL_TYPE_FEDERATED); | 660 ExpectZeroClickSignInSuccess(CredentialType::CREDENTIAL_TYPE_FEDERATED); |
| 661 } | 661 } |
| 662 | 662 |
| 663 TEST_F(CredentialManagerDispatcherTest, | 663 TEST_F(CredentialManagerDispatcherTest, |
| 664 CredentialManagerOnRequestCredentialFederatedNoMatch) { | 664 CredentialManagerOnRequestCredentialFederatedNoMatch) { |
| 665 form_.federation_url = GURL("https://example.com/"); | 665 form_.federation_origin = url::Origin(GURL("https://example.com/")); |
| 666 store_->AddLogin(form_); | 666 store_->AddLogin(form_); |
| 667 client_->set_first_run_seen(true); | 667 client_->set_first_run_seen(true); |
| 668 | 668 |
| 669 std::vector<GURL> federations; | 669 std::vector<GURL> federations; |
| 670 federations.push_back(GURL("https://not-example.com/")); | 670 federations.push_back(GURL("https://not-example.com/")); |
| 671 | 671 |
| 672 EXPECT_CALL(*client_, NotifyUserAutoSigninBlockedOnFirstRunPtr(_)).Times(0); | 672 EXPECT_CALL(*client_, NotifyUserAutoSigninBlockedOnFirstRunPtr(_)).Times(0); |
| 673 dispatcher()->OnRequestCredential(kRequestId, true, true, federations); | 673 dispatcher()->OnRequestCredential(kRequestId, true, true, federations); |
| 674 | 674 |
| 675 ExpectZeroClickSignInFailure(); | 675 ExpectZeroClickSignInFailure(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 | 712 |
| 713 // We pass in 'false' for the 'include_passwords' argument to ensure that | 713 // We pass in 'false' for the 'include_passwords' argument to ensure that |
| 714 // password-type credentials are excluded as potential matches. | 714 // password-type credentials are excluded as potential matches. |
| 715 dispatcher()->OnRequestCredential(kRequestId, true, false, federations); | 715 dispatcher()->OnRequestCredential(kRequestId, true, false, federations); |
| 716 | 716 |
| 717 ExpectZeroClickSignInFailure(); | 717 ExpectZeroClickSignInFailure(); |
| 718 } | 718 } |
| 719 | 719 |
| 720 TEST_F(CredentialManagerDispatcherTest, | 720 TEST_F(CredentialManagerDispatcherTest, |
| 721 CredentialManagerOnRequestCredentialAffiliatedFederatedMatch) { | 721 CredentialManagerOnRequestCredentialAffiliatedFederatedMatch) { |
| 722 affiliated_form1_.federation_url = GURL("https://example.com/"); | 722 affiliated_form1_.federation_origin = |
| 723 url::Origin(GURL("https://example.com/")); |
| 723 store_->AddLogin(affiliated_form1_); | 724 store_->AddLogin(affiliated_form1_); |
| 724 client_->set_first_run_seen(true); | 725 client_->set_first_run_seen(true); |
| 725 auto mock_helper = make_scoped_ptr(new MockAffiliatedMatchHelper); | 726 auto mock_helper = make_scoped_ptr(new MockAffiliatedMatchHelper); |
| 726 store_->SetAffiliatedMatchHelper(std::move(mock_helper)); | 727 store_->SetAffiliatedMatchHelper(std::move(mock_helper)); |
| 727 | 728 |
| 728 std::vector<GURL> federations; | 729 std::vector<GURL> federations; |
| 729 federations.push_back(GURL("https://example.com/")); | 730 federations.push_back(GURL("https://example.com/")); |
| 730 | 731 |
| 731 std::vector<std::string> affiliated_realms; | 732 std::vector<std::string> affiliated_realms; |
| 732 affiliated_realms.push_back(kTestAndroidRealm1); | 733 affiliated_realms.push_back(kTestAndroidRealm1); |
| 733 static_cast<MockAffiliatedMatchHelper*>(store_->affiliated_match_helper()) | 734 static_cast<MockAffiliatedMatchHelper*>(store_->affiliated_match_helper()) |
| 734 ->ExpectCallToGetAffiliatedAndroidRealms( | 735 ->ExpectCallToGetAffiliatedAndroidRealms( |
| 735 dispatcher_->GetSynthesizedFormForOrigin(), affiliated_realms); | 736 dispatcher_->GetSynthesizedFormForOrigin(), affiliated_realms); |
| 736 | 737 |
| 737 dispatcher()->OnRequestCredential(kRequestId, true, true, federations); | 738 dispatcher()->OnRequestCredential(kRequestId, true, true, federations); |
| 738 | 739 |
| 739 ExpectZeroClickSignInSuccess(CredentialType::CREDENTIAL_TYPE_FEDERATED); | 740 ExpectZeroClickSignInSuccess(CredentialType::CREDENTIAL_TYPE_FEDERATED); |
| 740 } | 741 } |
| 741 | 742 |
| 742 TEST_F(CredentialManagerDispatcherTest, | 743 TEST_F(CredentialManagerDispatcherTest, |
| 743 CredentialManagerOnRequestCredentialAffiliatedFederatedNoMatch) { | 744 CredentialManagerOnRequestCredentialAffiliatedFederatedNoMatch) { |
| 744 affiliated_form1_.federation_url = GURL("https://example.com/"); | 745 affiliated_form1_.federation_origin = |
| 746 url::Origin(GURL("https://example.com/")); |
| 745 store_->AddLogin(affiliated_form1_); | 747 store_->AddLogin(affiliated_form1_); |
| 746 client_->set_first_run_seen(true); | 748 client_->set_first_run_seen(true); |
| 747 auto mock_helper = make_scoped_ptr(new MockAffiliatedMatchHelper); | 749 auto mock_helper = make_scoped_ptr(new MockAffiliatedMatchHelper); |
| 748 store_->SetAffiliatedMatchHelper(std::move(mock_helper)); | 750 store_->SetAffiliatedMatchHelper(std::move(mock_helper)); |
| 749 | 751 |
| 750 std::vector<GURL> federations; | 752 std::vector<GURL> federations; |
| 751 federations.push_back(GURL("https://not-example.com/")); | 753 federations.push_back(GURL("https://not-example.com/")); |
| 752 | 754 |
| 753 std::vector<std::string> affiliated_realms; | 755 std::vector<std::string> affiliated_realms; |
| 754 affiliated_realms.push_back(kTestAndroidRealm1); | 756 affiliated_realms.push_back(kTestAndroidRealm1); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 TEST_F(CredentialManagerDispatcherTest, GetSynthesizedFormForOrigin) { | 1105 TEST_F(CredentialManagerDispatcherTest, GetSynthesizedFormForOrigin) { |
| 1104 autofill::PasswordForm synthesized = | 1106 autofill::PasswordForm synthesized = |
| 1105 dispatcher_->GetSynthesizedFormForOrigin(); | 1107 dispatcher_->GetSynthesizedFormForOrigin(); |
| 1106 EXPECT_EQ(kTestWebOrigin, synthesized.origin.spec()); | 1108 EXPECT_EQ(kTestWebOrigin, synthesized.origin.spec()); |
| 1107 EXPECT_EQ(kTestWebOrigin, synthesized.signon_realm); | 1109 EXPECT_EQ(kTestWebOrigin, synthesized.signon_realm); |
| 1108 EXPECT_EQ(autofill::PasswordForm::SCHEME_HTML, synthesized.scheme); | 1110 EXPECT_EQ(autofill::PasswordForm::SCHEME_HTML, synthesized.scheme); |
| 1109 EXPECT_TRUE(synthesized.ssl_valid); | 1111 EXPECT_TRUE(synthesized.ssl_valid); |
| 1110 } | 1112 } |
| 1111 | 1113 |
| 1112 } // namespace password_manager | 1114 } // namespace password_manager |
| OLD | NEW |