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

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

Issue 3159043: AutoFill doesn't fill address information on www.gorillaclothing.com (Closed)
Patch Set: Fix to line3 logic. Created 10 years, 4 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 | « chrome/browser/autofill/address_field.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/form_structure_unittest.cc
diff --git a/chrome/browser/autofill/form_structure_unittest.cc b/chrome/browser/autofill/form_structure_unittest.cc
index b2d0435b75b587386da526226cfdfb1c427028e0..14fe5169e3f94cf82c5c4ea5dd3e3a8a9dec77a4 100644
--- a/chrome/browser/autofill/form_structure_unittest.cc
+++ b/chrome/browser/autofill/form_structure_unittest.cc
@@ -421,7 +421,8 @@ TEST(FormStructureTest, HeuristicsSample8) {
// Zip.
EXPECT_EQ(ADDRESS_BILLING_ZIP, form_structure->field(6)->heuristic_type());
// Country.
- EXPECT_EQ(ADDRESS_BILLING_COUNTRY, form_structure->field(7)->heuristic_type());
+ EXPECT_EQ(ADDRESS_BILLING_COUNTRY,
+ form_structure->field(7)->heuristic_type());
// Phone.
EXPECT_EQ(PHONE_HOME_WHOLE_NUMBER,
form_structure->field(8)->heuristic_type());
@@ -741,6 +742,53 @@ TEST(FormStructureTest, ThreeAddressLines) {
EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(3)->heuristic_type());
}
+// This test verifies that "addressLine1" and "addressLine2" matches heuristics.
+// This occured in https://www.gorillaclothing.com/. http://crbug.com/52126.
+TEST(FormStructureTest, BillingAndShippingAddresses) {
+ scoped_ptr<FormStructure> form_structure;
+ FormData form;
+
+ form.method = ASCIIToUTF16("post");
+ form.fields.push_back(
+ webkit_glue::FormField(ASCIIToUTF16("Address Line1"),
+ ASCIIToUTF16("shipping.address.addressLine1"),
+ string16(),
+ ASCIIToUTF16("text"),
+ 0));
+ form.fields.push_back(
+ webkit_glue::FormField(ASCIIToUTF16("Address Line2"),
+ ASCIIToUTF16("shipping.address.addressLine2"),
+ string16(),
+ ASCIIToUTF16("text"),
+ 0));
+ form.fields.push_back(
+ webkit_glue::FormField(ASCIIToUTF16("Address Line1"),
+ ASCIIToUTF16("billing.address.addressLine1"),
+ string16(),
+ ASCIIToUTF16("text"),
+ 0));
+ form.fields.push_back(
+ webkit_glue::FormField(ASCIIToUTF16("Address Line2"),
+ ASCIIToUTF16("billing.address.addressLine2"),
+ string16(),
+ ASCIIToUTF16("text"),
+ 0));
+ form_structure.reset(new FormStructure(form));
+ EXPECT_TRUE(form_structure->IsAutoFillable());
+ ASSERT_EQ(4U, form_structure->field_count());
+ ASSERT_EQ(4U, 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 1.
+ EXPECT_EQ(ADDRESS_BILLING_LINE1, form_structure->field(2)->heuristic_type());
+ // Address Line 2.
+ EXPECT_EQ(ADDRESS_BILLING_LINE2, 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.
// And the following "Street address second line" we interpret as address line
« no previous file with comments | « chrome/browser/autofill/address_field.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698