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

Unified Diff: components/autofill/browser/form_structure_unittest.cc

Issue 13888008: Fix for forms with more than three address lines getting partially Autofilled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review revisions. Created 7 years, 8 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/browser/autofill_regex_constants.cc.utf8 ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/browser/form_structure_unittest.cc
diff --git a/components/autofill/browser/form_structure_unittest.cc b/components/autofill/browser/form_structure_unittest.cc
index 8691e8268b6094fa39f8e85a10cb868cba5a2ce5..b21f434ea566b0353f139285bf0f4a1aa049a9cc 100644
--- a/components/autofill/browser/form_structure_unittest.cc
+++ b/components/autofill/browser/form_structure_unittest.cc
@@ -1137,6 +1137,45 @@ TEST(FormStructureTest, BillingAndShippingAddresses) {
EXPECT_EQ(ADDRESS_BILLING_LINE2, form_structure->field(3)->heuristic_type());
}
+// Numbered address lines after line two are ignored.
+TEST(FormStructureTest, SurplusAddressLinesIgnored) {
+ scoped_ptr<FormStructure> form_structure;
+ FormData form;
+ form.method = ASCIIToUTF16("post");
+
+ FormFieldData field;
+ field.form_control_type = "text";
+
+ field.label = ASCIIToUTF16("Address Line1");
+ field.name = ASCIIToUTF16("shipping.address.addressLine1");
+ form.fields.push_back(field);
+
+ field.label = ASCIIToUTF16("Address Line2");
+ field.name = ASCIIToUTF16("shipping.address.addressLine2");
+ form.fields.push_back(field);
+
+ field.label = ASCIIToUTF16("Address Line3");
+ field.name = ASCIIToUTF16("billing.address.addressLine3");
+ form.fields.push_back(field);
+
+ field.label = ASCIIToUTF16("Address Line4");
+ field.name = ASCIIToUTF16("billing.address.addressLine4");
+ form.fields.push_back(field);
+
+ form_structure.reset(new FormStructure(form, std::string()));
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
+ ASSERT_EQ(4U, form_structure->field_count());
+ ASSERT_EQ(2U, form_structure->autofill_count());
+
+ // Address Line 1.
+ EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(0)->heuristic_type());
+ // Address Line 2.
+ EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(1)->heuristic_type());
+ // Address Line 3 (ignored).
+ EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(2)->heuristic_type());
+ // Address Line 4 (ignored).
+ EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(3)->heuristic_type());
+}
// This example comes from expedia.com where they use a "Suite" label to
// indicate a suite or apartment number. We interpret this as address line 2.
« no previous file with comments | « components/autofill/browser/autofill_regex_constants.cc.utf8 ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698