Index: chrome/browser/autofill/credit_card_unittest.cc |
=================================================================== |
--- chrome/browser/autofill/credit_card_unittest.cc (revision 42370) |
+++ chrome/browser/autofill/credit_card_unittest.cc (working copy) |
@@ -12,11 +12,13 @@ |
// Tests credit card summary string generation. This test simulates a variety |
// of different possible summary strings. Variations occur based on the |
// existence of credit card number, month, and year fields. |
-TEST(CreditCardTest, PreviewSummaryString) { |
+TEST(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { |
// Case 0: empty credit card. |
CreditCard credit_card0(string16(), 0); |
string16 summary0 = credit_card0.PreviewSummary(); |
EXPECT_EQ(summary0, string16()); |
+ string16 obfuscated0 = credit_card0.ObfuscatedNumber(); |
+ EXPECT_EQ(obfuscated0, string16()); |
// Case 00: Empty credit card with empty strings. |
CreditCard credit_card00(string16(), 0); |
@@ -33,6 +35,8 @@ |
"Indianapolis"); |
string16 summary00 = credit_card00.PreviewSummary(); |
EXPECT_EQ(summary00, string16()); |
+ string16 obfuscated00 = credit_card00.ObfuscatedNumber(); |
+ EXPECT_EQ(obfuscated00, string16()); |
// Case 1: No credit card number. |
CreditCard credit_card1(string16(), 0); |
@@ -49,6 +53,8 @@ |
"Indianapolis"); |
string16 summary1 = credit_card1.PreviewSummary(); |
EXPECT_EQ(summary1, string16()); |
+ string16 obfuscated1 = credit_card1.ObfuscatedNumber(); |
+ EXPECT_EQ(obfuscated1, string16()); |
// Case 2: No month. |
CreditCard credit_card2(string16(), 0); |
@@ -65,6 +71,8 @@ |
"Indianapolis"); |
string16 summary2 = credit_card2.PreviewSummary(); |
EXPECT_EQ(summary2, string16(ASCIIToUTF16("************9012"))); |
+ string16 obfuscated2 = credit_card2.ObfuscatedNumber(); |
+ EXPECT_EQ(obfuscated2, string16(ASCIIToUTF16("************9012"))); |
// Case 3: No year. |
CreditCard credit_card3(string16(), 0); |
@@ -81,6 +89,8 @@ |
"Indianapolis"); |
string16 summary3 = credit_card3.PreviewSummary(); |
EXPECT_EQ(summary3, string16(ASCIIToUTF16("************9012"))); |
+ string16 obfuscated3 = credit_card3.ObfuscatedNumber(); |
+ EXPECT_EQ(obfuscated3, string16(ASCIIToUTF16("************9012"))); |
// Case 4: Have everything. |
CreditCard credit_card4(string16(), 0); |
@@ -97,6 +107,8 @@ |
"Indianapolis"); |
string16 summary4 = credit_card4.PreviewSummary(); |
EXPECT_EQ(summary4, string16(ASCIIToUTF16("************9012, Exp: 01/2010"))); |
+ string16 obfuscated4 = credit_card4.ObfuscatedNumber(); |
+ EXPECT_EQ(obfuscated4, string16(ASCIIToUTF16("************9012"))); |
} |
} // namespace |