Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: components/autofill/core/browser/personal_data_manager_unittest.cc

Issue 2534413006: [Credit Card] Uses 4 dots in ellipsis (Closed)
Patch Set: Updates Java tests with new format for masked card numbers Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/autofill/core/browser/credit_card_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "testing/gtest/include/gtest/gtest.h" 54 #include "testing/gtest/include/gtest/gtest.h"
55 55
56 using base::ASCIIToUTF16; 56 using base::ASCIIToUTF16;
57 using base::UTF8ToUTF16; 57 using base::UTF8ToUTF16;
58 58
59 namespace autofill { 59 namespace autofill {
60 namespace { 60 namespace {
61 61
62 enum UserMode { USER_MODE_NORMAL, USER_MODE_INCOGNITO }; 62 enum UserMode { USER_MODE_NORMAL, USER_MODE_INCOGNITO };
63 63
64 const std::string kUTF8MidlineEllipsis =
65 " "
66 "\xE2\x80\xA2\xE2\x80\x86"
67 "\xE2\x80\xA2\xE2\x80\x86"
68 "\xE2\x80\xA2\xE2\x80\x86"
69 "\xE2\x80\xA2\xE2\x80\x86";
70
64 ACTION(QuitMainMessageLoop) { 71 ACTION(QuitMainMessageLoop) {
65 base::MessageLoop::current()->QuitWhenIdle(); 72 base::MessageLoop::current()->QuitWhenIdle();
66 } 73 }
67 74
68 class PersonalDataLoadedObserverMock : public PersonalDataManagerObserver { 75 class PersonalDataLoadedObserverMock : public PersonalDataManagerObserver {
69 public: 76 public:
70 PersonalDataLoadedObserverMock() {} 77 PersonalDataLoadedObserverMock() {}
71 virtual ~PersonalDataLoadedObserverMock() {} 78 virtual ~PersonalDataLoadedObserverMock() {}
72 79
73 MOCK_METHOD0(OnPersonalDataChanged, void()); 80 MOCK_METHOD0(OnPersonalDataChanged, void());
(...skipping 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after
3690 3697
3691 ASSERT_EQ(2U, personal_data_->GetCreditCards().size()); 3698 ASSERT_EQ(2U, personal_data_->GetCreditCards().size());
3692 3699
3693 // Sublabel is expiration date when filling card number. The second card 3700 // 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. 3701 // doesn't have a number so it should not be included in the suggestions.
3695 std::vector<Suggestion> suggestions = 3702 std::vector<Suggestion> suggestions =
3696 personal_data_->GetCreditCardSuggestions( 3703 personal_data_->GetCreditCardSuggestions(
3697 AutofillType(CREDIT_CARD_NUMBER), 3704 AutofillType(CREDIT_CARD_NUMBER),
3698 /* field_contents= */ base::string16()); 3705 /* field_contents= */ base::string16());
3699 ASSERT_EQ(1U, suggestions.size()); 3706 ASSERT_EQ(1U, suggestions.size());
3700 EXPECT_EQ(UTF8ToUTF16("Amex\xC2\xA0\xE2\x8B\xAF" 3707 EXPECT_EQ(UTF8ToUTF16("Amex" + kUTF8MidlineEllipsis + "8555"),
3701 "8555"),
3702 suggestions[0].value); 3708 suggestions[0].value);
3703 EXPECT_EQ(ASCIIToUTF16("04/99"), suggestions[0].label); 3709 EXPECT_EQ(ASCIIToUTF16("04/99"), suggestions[0].label);
3704 } 3710 }
3705 3711
3706 // Tests the suggestions of duplicate local and server credit cards. 3712 // Tests the suggestions of duplicate local and server credit cards.
3707 TEST_F(PersonalDataManagerTest, GetCreditCardSuggestions_ServerDuplicates) { 3713 TEST_F(PersonalDataManagerTest, GetCreditCardSuggestions_ServerDuplicates) {
3708 EnableWalletCardImport(); 3714 EnableWalletCardImport();
3709 SetupReferenceLocalCreditCards(); 3715 SetupReferenceLocalCreditCards();
3710 3716
3711 // Add some server cards. If there are local dupes, the locals should be 3717 // Add some server cards. If there are local dupes, the locals should be
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3754 /* field_contents= */ base::string16()); 3760 /* field_contents= */ base::string16());
3755 ASSERT_EQ(4U, suggestions.size()); 3761 ASSERT_EQ(4U, suggestions.size());
3756 EXPECT_EQ(ASCIIToUTF16("John Dillinger"), suggestions[0].value); 3762 EXPECT_EQ(ASCIIToUTF16("John Dillinger"), suggestions[0].value);
3757 EXPECT_EQ(ASCIIToUTF16("Clyde Barrow"), suggestions[1].value); 3763 EXPECT_EQ(ASCIIToUTF16("Clyde Barrow"), suggestions[1].value);
3758 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[2].value); 3764 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[2].value);
3759 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[3].value); 3765 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[3].value);
3760 3766
3761 suggestions = personal_data_->GetCreditCardSuggestions( 3767 suggestions = personal_data_->GetCreditCardSuggestions(
3762 AutofillType(CREDIT_CARD_NUMBER), /* field_contents= */ base::string16()); 3768 AutofillType(CREDIT_CARD_NUMBER), /* field_contents= */ base::string16());
3763 ASSERT_EQ(4U, suggestions.size()); 3769 ASSERT_EQ(4U, suggestions.size());
3764 EXPECT_EQ(UTF8ToUTF16("Visa\xC2\xA0\xE2\x8B\xAF" 3770 EXPECT_EQ(UTF8ToUTF16("Visa" + kUTF8MidlineEllipsis + "9012"),
3765 "9012"),
3766 suggestions[0].value); 3771 suggestions[0].value);
3767 EXPECT_EQ(UTF8ToUTF16("Amex\xC2\xA0\xE2\x8B\xAF" 3772 EXPECT_EQ(UTF8ToUTF16("Amex" + kUTF8MidlineEllipsis + "8555"),
3768 "8555"),
3769 suggestions[1].value); 3773 suggestions[1].value);
3770 EXPECT_EQ(UTF8ToUTF16("MasterCard\xC2\xA0\xE2\x8B\xAF" 3774 EXPECT_EQ(UTF8ToUTF16("MasterCard" + kUTF8MidlineEllipsis + "2109"),
3771 "2109"),
3772 suggestions[2].value); 3775 suggestions[2].value);
3773 EXPECT_EQ(UTF8ToUTF16("Visa\xC2\xA0\xE2\x8B\xAF" 3776 EXPECT_EQ(UTF8ToUTF16("Visa" + kUTF8MidlineEllipsis + "2109"),
3774 "2109"),
3775 suggestions[3].value); 3777 suggestions[3].value);
3776 } 3778 }
3777 3779
3778 // Tests that a full server card can be a dupe of more than one local card. 3780 // Tests that a full server card can be a dupe of more than one local card.
3779 TEST_F(PersonalDataManagerTest, 3781 TEST_F(PersonalDataManagerTest,
3780 GetCreditCardSuggestions_ServerCardDuplicateOfMultipleLocalCards) { 3782 GetCreditCardSuggestions_ServerCardDuplicateOfMultipleLocalCards) {
3781 EnableWalletCardImport(); 3783 EnableWalletCardImport();
3782 SetupReferenceLocalCreditCards(); 3784 SetupReferenceLocalCreditCards();
3783 3785
3784 // Add a duplicate server card. 3786 // Add a duplicate server card.
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
5378 EnableAutofillProfileCleanup(); 5380 EnableAutofillProfileCleanup();
5379 5381
5380 // The deduping routine should not be run. 5382 // The deduping routine should not be run.
5381 EXPECT_FALSE(personal_data_->ApplyDedupingRoutine()); 5383 EXPECT_FALSE(personal_data_->ApplyDedupingRoutine());
5382 5384
5383 // The two duplicate profiles should still be present. 5385 // The two duplicate profiles should still be present.
5384 EXPECT_EQ(2U, personal_data_->GetProfiles().size()); 5386 EXPECT_EQ(2U, personal_data_->GetProfiles().size());
5385 } 5387 }
5386 5388
5387 } // namespace autofill 5389 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/credit_card_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698