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

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

Issue 1001043004: Revamp desktop Autofill settings, round 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittest Created 5 years, 9 months 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
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/guid.h" 6 #include "base/guid.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/autofill/core/browser/autofill_test_utils.h" 8 #include "components/autofill/core/browser/autofill_test_utils.h"
9 #include "components/autofill/core/browser/autofill_type.h" 9 #include "components/autofill/core/browser/autofill_type.h"
10 #include "components/autofill/core/browser/credit_card.h" 10 #include "components/autofill/core/browser/credit_card.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 "5100"), 114 "5100"),
115 obfuscated3); 115 obfuscated3);
116 116
117 // Case 4: Have everything. 117 // Case 4: Have everything.
118 CreditCard credit_card4(base::GenerateGUID(), "https://www.example.com/"); 118 CreditCard credit_card4(base::GenerateGUID(), "https://www.example.com/");
119 test::SetCreditCardInfo( 119 test::SetCreditCardInfo(
120 &credit_card4, "John Dillinger", "5105 1051 0510 5100", "01", "2010"); 120 &credit_card4, "John Dillinger", "5105 1051 0510 5100", "01", "2010");
121 base::string16 summary4 = credit_card4.Label(); 121 base::string16 summary4 = credit_card4.Label();
122 EXPECT_EQ(UTF8ToUTF16( 122 EXPECT_EQ(UTF8ToUTF16(
123 "MasterCard \xE2\x8B\xAF" 123 "MasterCard \xE2\x8B\xAF"
124 "5100, Exp: 01/2010"), 124 "5100, 01/2010"),
125 summary4); 125 summary4);
126 base::string16 obfuscated4 = credit_card4.TypeAndLastFourDigits(); 126 base::string16 obfuscated4 = credit_card4.TypeAndLastFourDigits();
127 EXPECT_EQ(UTF8ToUTF16( 127 EXPECT_EQ(UTF8ToUTF16(
128 "MasterCard \xE2\x8B\xAF" 128 "MasterCard \xE2\x8B\xAF"
129 "5100"), 129 "5100"),
130 obfuscated4); 130 obfuscated4);
131 131
132 // Case 5: Very long credit card 132 // Case 5: Very long credit card
133 CreditCard credit_card5(base::GenerateGUID(), "https://www.example.com/"); 133 CreditCard credit_card5(base::GenerateGUID(), "https://www.example.com/");
134 test::SetCreditCardInfo( 134 test::SetCreditCardInfo(
135 &credit_card5, 135 &credit_card5,
136 "John Dillinger", 136 "John Dillinger",
137 "0123456789 0123456789 0123456789 5105 1051 0510 5100", "01", "2010"); 137 "0123456789 0123456789 0123456789 5105 1051 0510 5100", "01", "2010");
138 base::string16 summary5 = credit_card5.Label(); 138 base::string16 summary5 = credit_card5.Label();
139 EXPECT_EQ(UTF8ToUTF16( 139 EXPECT_EQ(UTF8ToUTF16(
140 "Card \xE2\x8B\xAF" 140 "Card \xE2\x8B\xAF"
141 "5100, Exp: 01/2010"), 141 "5100, 01/2010"),
142 summary5); 142 summary5);
143 base::string16 obfuscated5 = credit_card5.TypeAndLastFourDigits(); 143 base::string16 obfuscated5 = credit_card5.TypeAndLastFourDigits();
144 EXPECT_EQ(UTF8ToUTF16( 144 EXPECT_EQ(UTF8ToUTF16(
145 "Card \xE2\x8B\xAF" 145 "Card \xE2\x8B\xAF"
146 "5100"), 146 "5100"),
147 obfuscated5); 147 obfuscated5);
148 } 148 }
149 149
150 TEST(CreditCardTest, AssignmentOperator) { 150 TEST(CreditCardTest, AssignmentOperator) {
151 CreditCard a(base::GenerateGUID(), "some origin"); 151 CreditCard a(base::GenerateGUID(), "some origin");
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 base::string16 card_number = base::ASCIIToUTF16("test"); 652 base::string16 card_number = base::ASCIIToUTF16("test");
653 int month = 1; 653 int month = 1;
654 int year = 3000; 654 int year = 3000;
655 CreditCard card(card_number, month, year); 655 CreditCard card(card_number, month, year);
656 EXPECT_EQ(card_number, card.number()); 656 EXPECT_EQ(card_number, card.number());
657 EXPECT_EQ(month, card.expiration_month()); 657 EXPECT_EQ(month, card.expiration_month());
658 EXPECT_EQ(year, card.expiration_year()); 658 EXPECT_EQ(year, card.expiration_year());
659 } 659 }
660 660
661 } // namespace autofill 661 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/credit_card.cc ('k') | components/autofill/core/browser/personal_data_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698