Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill/core/browser/personal_data_manager.h" | 5 #include "components/autofill/core/browser/personal_data_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 3679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3690 | 3690 |
| 3691 ASSERT_EQ(2U, personal_data_->GetCreditCards().size()); | 3691 ASSERT_EQ(2U, personal_data_->GetCreditCards().size()); |
| 3692 | 3692 |
| 3693 // Sublabel is expiration date when filling card number. The second card | 3693 // Sublabel is expiration date when filling card number. The second card |
| 3694 // doesn't have a number so it should not be included in the suggestions. | 3694 // doesn't have a number so it should not be included in the suggestions. |
| 3695 std::vector<Suggestion> suggestions = | 3695 std::vector<Suggestion> suggestions = |
| 3696 personal_data_->GetCreditCardSuggestions( | 3696 personal_data_->GetCreditCardSuggestions( |
| 3697 AutofillType(CREDIT_CARD_NUMBER), | 3697 AutofillType(CREDIT_CARD_NUMBER), |
| 3698 /* field_contents= */ base::string16()); | 3698 /* field_contents= */ base::string16()); |
| 3699 ASSERT_EQ(1U, suggestions.size()); | 3699 ASSERT_EQ(1U, suggestions.size()); |
| 3700 EXPECT_EQ(UTF8ToUTF16("Amex\xC2\xA0\xE2\x8B\xAF" | 3700 EXPECT_EQ(UTF8ToUTF16("Amex " |
| 3701 "\xE2\x80\xA2\xE2\x80\x86" | |
|
Mathieu
2016/12/02 21:19:47
what about using base::string16(kMidlineEllipsis)
csashi
2016/12/03 01:02:30
I assumed we intentionally did not want to referen
| |
| 3702 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3703 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3704 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3701 "8555"), | 3705 "8555"), |
| 3702 suggestions[0].value); | 3706 suggestions[0].value); |
| 3703 EXPECT_EQ(ASCIIToUTF16("04/99"), suggestions[0].label); | 3707 EXPECT_EQ(ASCIIToUTF16("04/99"), suggestions[0].label); |
| 3704 } | 3708 } |
| 3705 | 3709 |
| 3706 // Tests the suggestions of duplicate local and server credit cards. | 3710 // Tests the suggestions of duplicate local and server credit cards. |
| 3707 TEST_F(PersonalDataManagerTest, GetCreditCardSuggestions_ServerDuplicates) { | 3711 TEST_F(PersonalDataManagerTest, GetCreditCardSuggestions_ServerDuplicates) { |
| 3708 EnableWalletCardImport(); | 3712 EnableWalletCardImport(); |
| 3709 SetupReferenceLocalCreditCards(); | 3713 SetupReferenceLocalCreditCards(); |
| 3710 | 3714 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3754 /* field_contents= */ base::string16()); | 3758 /* field_contents= */ base::string16()); |
| 3755 ASSERT_EQ(4U, suggestions.size()); | 3759 ASSERT_EQ(4U, suggestions.size()); |
| 3756 EXPECT_EQ(ASCIIToUTF16("John Dillinger"), suggestions[0].value); | 3760 EXPECT_EQ(ASCIIToUTF16("John Dillinger"), suggestions[0].value); |
| 3757 EXPECT_EQ(ASCIIToUTF16("Clyde Barrow"), suggestions[1].value); | 3761 EXPECT_EQ(ASCIIToUTF16("Clyde Barrow"), suggestions[1].value); |
| 3758 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[2].value); | 3762 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[2].value); |
| 3759 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[3].value); | 3763 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[3].value); |
| 3760 | 3764 |
| 3761 suggestions = personal_data_->GetCreditCardSuggestions( | 3765 suggestions = personal_data_->GetCreditCardSuggestions( |
| 3762 AutofillType(CREDIT_CARD_NUMBER), /* field_contents= */ base::string16()); | 3766 AutofillType(CREDIT_CARD_NUMBER), /* field_contents= */ base::string16()); |
| 3763 ASSERT_EQ(4U, suggestions.size()); | 3767 ASSERT_EQ(4U, suggestions.size()); |
| 3764 EXPECT_EQ(UTF8ToUTF16("Visa\xC2\xA0\xE2\x8B\xAF" | 3768 EXPECT_EQ(UTF8ToUTF16("Visa " |
| 3769 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3770 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3771 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3772 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3765 "9012"), | 3773 "9012"), |
| 3766 suggestions[0].value); | 3774 suggestions[0].value); |
| 3767 EXPECT_EQ(UTF8ToUTF16("Amex\xC2\xA0\xE2\x8B\xAF" | 3775 EXPECT_EQ(UTF8ToUTF16("Amex " |
| 3776 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3777 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3778 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3779 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3768 "8555"), | 3780 "8555"), |
| 3769 suggestions[1].value); | 3781 suggestions[1].value); |
| 3770 EXPECT_EQ(UTF8ToUTF16("MasterCard\xC2\xA0\xE2\x8B\xAF" | 3782 EXPECT_EQ(UTF8ToUTF16("MasterCard " |
| 3783 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3784 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3785 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3786 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3771 "2109"), | 3787 "2109"), |
| 3772 suggestions[2].value); | 3788 suggestions[2].value); |
| 3773 EXPECT_EQ(UTF8ToUTF16("Visa\xC2\xA0\xE2\x8B\xAF" | 3789 EXPECT_EQ(UTF8ToUTF16("Visa " |
| 3790 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3791 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3792 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3793 "\xE2\x80\xA2\xE2\x80\x86" | |
| 3774 "2109"), | 3794 "2109"), |
| 3775 suggestions[3].value); | 3795 suggestions[3].value); |
| 3776 } | 3796 } |
| 3777 | 3797 |
| 3778 // Tests that a full server card can be a dupe of more than one local card. | 3798 // Tests that a full server card can be a dupe of more than one local card. |
| 3779 TEST_F(PersonalDataManagerTest, | 3799 TEST_F(PersonalDataManagerTest, |
| 3780 GetCreditCardSuggestions_ServerCardDuplicateOfMultipleLocalCards) { | 3800 GetCreditCardSuggestions_ServerCardDuplicateOfMultipleLocalCards) { |
| 3781 EnableWalletCardImport(); | 3801 EnableWalletCardImport(); |
| 3782 SetupReferenceLocalCreditCards(); | 3802 SetupReferenceLocalCreditCards(); |
| 3783 | 3803 |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5378 EnableAutofillProfileCleanup(); | 5398 EnableAutofillProfileCleanup(); |
| 5379 | 5399 |
| 5380 // The deduping routine should not be run. | 5400 // The deduping routine should not be run. |
| 5381 EXPECT_FALSE(personal_data_->ApplyDedupingRoutine()); | 5401 EXPECT_FALSE(personal_data_->ApplyDedupingRoutine()); |
| 5382 | 5402 |
| 5383 // The two duplicate profiles should still be present. | 5403 // The two duplicate profiles should still be present. |
| 5384 EXPECT_EQ(2U, personal_data_->GetProfiles().size()); | 5404 EXPECT_EQ(2U, personal_data_->GetProfiles().size()); |
| 5385 } | 5405 } |
| 5386 | 5406 |
| 5387 } // namespace autofill | 5407 } // namespace autofill |
| OLD | NEW |