diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 18:15:49 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 18:15:49 +0000 |
commit | 0a6d4ce8805679d6350dd4ce596d53dcd25837f4 (patch) | |
tree | da37fc5daad3efde77ba17f931f4a0fd035f95a1 /chrome | |
parent | ad30e06240980b8355ad1669c4d97d34ddbf473b (diff) | |
download | chromium_src-0a6d4ce8805679d6350dd4ce596d53dcd25837f4.zip chromium_src-0a6d4ce8805679d6350dd4ce596d53dcd25837f4.tar.gz chromium_src-0a6d4ce8805679d6350dd4ce596d53dcd25837f4.tar.bz2 |
Revert 43627 - AutoFill credit card field filling, with nameoncard field.
Enables credit card filling when "Name on Card" field is present. This adds
to existing method of clicking on card number to fill.
BUG=38320
TEST=CreditCardFieldTest, FormStructureTest, manual testing with cc.html (attached).
Review URL: http://codereview.chromium.org/1518017
TBR=dhollowa@chromium.org
Review URL: http://codereview.chromium.org/1605011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/autofill/credit_card_field.cc | 7 | ||||
-rw-r--r-- | chrome/browser/autofill/form_structure_unittest.cc | 76 |
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 |