summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autofill/credit_card_field.cc7
-rw-r--r--chrome/browser/autofill/form_structure_unittest.cc76
2 files changed, 2 insertions, 81 deletions
diff --git a/chrome/browser/autofill/credit_card_field.cc b/chrome/browser/autofill/credit_card_field.cc
index 95f2f5b..b79467d 100644
--- a/chrome/browser/autofill/credit_card_field.cc
+++ b/chrome/browser/autofill/credit_card_field.cc
@@ -61,7 +61,7 @@ CreditCardField* CreditCardField::Parse(
} else {
if (fields == 0 || credit_card_field.expiration_month_) {
// at beginning or end
- name_pattern = ASCIIToUTF16("card holder|name on card|nameoncard");
+ name_pattern = ASCIIToUTF16("card holder|name on card");
} else {
name_pattern = ASCIIToUTF16("name");
}
@@ -152,10 +152,7 @@ CreditCardField* CreditCardField::Parse(
// Some pages (e.g. ExpediaBilling.html) have a "card description"
// field; we parse this field but ignore it.
- // We also ignore any other fields within a credit card block that
- // start with "card", under the assumption that they are related to
- // the credit card section being processed but are uninteresting to us.
- if (ParseText(&q, ASCIIToUTF16("^card")))
+ if (ParseText(&q, ASCIIToUTF16("card description")))
continue;
break;
diff --git a/chrome/browser/autofill/form_structure_unittest.cc b/chrome/browser/autofill/form_structure_unittest.cc
index 87f440c..cfc535a 100644
--- a/chrome/browser/autofill/form_structure_unittest.cc
+++ b/chrome/browser/autofill/form_structure_unittest.cc
@@ -507,80 +507,4 @@ TEST(FormStructureTest, HeuristicsCreditCardInfo) {
form_structure->field(4)->heuristic_type());
}
-TEST(FormStructureTest, HeuristicsCreditCardInfoWithUnknownCardField) {
- scoped_ptr<FormStructure> form_structure;
- webkit_glue::FormFieldValues values;
-
- values.method = ASCIIToUTF16("post");
- values.elements.push_back(webkit_glue::FormField(string16(),
- ASCIIToUTF16("nameoncard"),
- string16(),
- ASCIIToUTF16("text")));
- // This is not a field we know how to process. But we should skip over it
- // and process the other fields in the card block.
- values.elements.push_back(webkit_glue::FormField(ASCIIToUTF16("Card Type"),
- ASCIIToUTF16("card_type"),
- string16(),
- ASCIIToUTF16("text")));
- values.elements.push_back(webkit_glue::FormField(ASCIIToUTF16("Card Number"),
- ASCIIToUTF16("card_number"),
- string16(),
- ASCIIToUTF16("text")));
- values.elements.push_back(webkit_glue::FormField(ASCIIToUTF16("Exp Month"),
- ASCIIToUTF16("ccmonth"),
- string16(),
- ASCIIToUTF16("text")));
- values.elements.push_back(webkit_glue::FormField(ASCIIToUTF16("Exp Year"),
- ASCIIToUTF16("ccyear"),
- string16(),
- ASCIIToUTF16("text")));
- values.elements.push_back(webkit_glue::FormField(ASCIIToUTF16("Verification"),
- ASCIIToUTF16("verification"),
- string16(),
- ASCIIToUTF16("text")));
- values.elements.push_back(webkit_glue::FormField(string16(),
- ASCIIToUTF16("Submit"),
- string16(),
- ASCIIToUTF16("submit")));
- form_structure.reset(new FormStructure(values));
- EXPECT_TRUE(form_structure->IsAutoFillable());
-
- // Expect the correct number of fields.
- ASSERT_EQ(6UL, form_structure->field_count());
-
- // Check that heuristics are initialized as UNKNOWN_TYPE.
- std::vector<AutoFillField*>::const_iterator iter;
- size_t i;
- for (iter = form_structure->begin(), i = 0;
- iter != form_structure->end();
- ++iter, ++i) {
- // Expect last element to be NULL.
- if (i == form_structure->field_count()) {
- ASSERT_EQ(static_cast<AutoFillField*>(NULL), *iter);
- } else {
- ASSERT_NE(static_cast<AutoFillField*>(NULL), *iter);
- EXPECT_EQ(UNKNOWN_TYPE, (*iter)->heuristic_type());
- }
- }
-
- // Compute heuristic types.
- form_structure->GetHeuristicAutoFillTypes();
- ASSERT_EQ(6U, form_structure->field_count());
-
- // Credit card name.
- EXPECT_EQ(CREDIT_CARD_NAME, form_structure->field(0)->heuristic_type());
- // Credit card type, which is an unknown type.
- EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(1)->heuristic_type());
- // Credit card number.
- EXPECT_EQ(CREDIT_CARD_NUMBER, form_structure->field(2)->heuristic_type());
- // Credit card expiration month.
- EXPECT_EQ(CREDIT_CARD_EXP_MONTH, form_structure->field(3)->heuristic_type());
- // Credit card expiration year.
- EXPECT_EQ(CREDIT_CARD_EXP_4_DIGIT_YEAR,
- form_structure->field(4)->heuristic_type());
- // Credit card cvc.
- EXPECT_EQ(CREDIT_CARD_VERIFICATION_CODE,
- form_structure->field(5)->heuristic_type());
-}
-
} // namespace