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

Unified Diff: components/autofill/core/browser/credit_card_field_unittest.cc

Issue 1048363002: Autofill: Recognize more credit card date fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill_exp
Patch Set: nit, rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/browser/credit_card_field.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/credit_card_field_unittest.cc
diff --git a/components/autofill/core/browser/credit_card_field_unittest.cc b/components/autofill/core/browser/credit_card_field_unittest.cc
index ba54b5639e01987fb59f62fc1dea28bb6d120efc..1297175635ca0232899768344b4ea8e437d6bd9f 100644
--- a/components/autofill/core/browser/credit_card_field_unittest.cc
+++ b/components/autofill/core/browser/credit_card_field_unittest.cc
@@ -339,6 +339,37 @@ TEST_F(CreditCardFieldTest, ParseExpField2DigitYearDueToMaxLength) {
field_type_map_[ASCIIToUTF16("exp3")]);
}
+TEST_F(CreditCardFieldTest, ParseExpField4DigitYear) {
+ FormFieldData field;
+ field.form_control_type = "text";
+
+ field.label = ASCIIToUTF16("Name on Card");
+ field.name = ASCIIToUTF16("name_on_card");
+ list_.push_back(new AutofillField(field, ASCIIToUTF16("name1")));
+
+ field.label = ASCIIToUTF16("Card Number");
+ field.name = ASCIIToUTF16("card_number");
+ list_.push_back(new AutofillField(field, ASCIIToUTF16("number2")));
+
+ field.label = ASCIIToUTF16("MM / YYYY");
+ field.name = ASCIIToUTF16("cc_exp");
+ list_.push_back(new AutofillField(field, ASCIIToUTF16("exp3")));
+
+ Parse();
+ ASSERT_NE(nullptr, field_.get());
+ EXPECT_TRUE(ClassifyField());
+ ASSERT_TRUE(
+ field_type_map_.find(ASCIIToUTF16("name1")) != field_type_map_.end());
+ EXPECT_EQ(CREDIT_CARD_NAME, field_type_map_[ASCIIToUTF16("name1")]);
+ ASSERT_TRUE(
+ field_type_map_.find(ASCIIToUTF16("number2")) != field_type_map_.end());
+ EXPECT_EQ(CREDIT_CARD_NUMBER, field_type_map_[ASCIIToUTF16("number2")]);
+ ASSERT_TRUE(
+ field_type_map_.find(ASCIIToUTF16("exp3")) != field_type_map_.end());
+ EXPECT_EQ(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR,
+ field_type_map_[ASCIIToUTF16("exp3")]);
+}
+
TEST_F(CreditCardFieldTest, ParseCreditCardHolderNameWithCCFullName) {
FormFieldData field;
field.form_control_type = "text";
« no previous file with comments | « components/autofill/core/browser/credit_card_field.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698