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

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

Issue 853523004: Autofill: Set requirements for number of recognized fields in an autofillable form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, change variable name Created 5 years, 11 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
Index: components/autofill/core/browser/form_field_unittest.cc
diff --git a/components/autofill/core/browser/form_field_unittest.cc b/components/autofill/core/browser/form_field_unittest.cc
index 763d77631727abdeff0723d1f5d99e2a015dc034..f13c1d134bb7586c17b486834d45132c44fdfff1 100644
--- a/components/autofill/core/browser/form_field_unittest.cc
+++ b/components/autofill/core/browser/form_field_unittest.cc
@@ -135,15 +135,24 @@ TEST(FormFieldTest, ParseFormFields) {
field_data.label = ASCIIToUTF16("Is PO Box");
fields.push_back(new AutofillField(field_data, field_data.label));
- // reset is_checkable to false.
+ // reset |is_checkable| to false.
field_data.is_checkable = false;
+
field_data.label = ASCIIToUTF16("Address line2");
fields.push_back(new AutofillField(field_data, field_data.label));
ServerFieldTypeMap field_type_map;
- FormField::ParseFormFields(fields.get(), &field_type_map);
+ FormField::ParseFormFields(fields.get(), true, &field_type_map);
+ // Does not parse since there are only 2 recognized fields.
+ ASSERT_EQ(0U, field_type_map.size());
+
+ field_data.label = ASCIIToUTF16("City");
+ fields.push_back(new AutofillField(field_data, field_data.label));
+
// Checkable element shouldn't interfere with inference of Address line2.
- EXPECT_EQ(2U, field_type_map.size());
+ field_type_map.clear();
+ FormField::ParseFormFields(fields.get(), true, &field_type_map);
+ ASSERT_EQ(3U, field_type_map.size());
EXPECT_EQ(ADDRESS_HOME_LINE1,
field_type_map.find(ASCIIToUTF16("Address line1"))->second);

Powered by Google App Engine
This is Rietveld 408576698