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

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

Issue 2776223002: Adds UKM for autofill attributes in form_structure. (Closed)
Patch Set: Resolves merge conflicts with FORM_CONTAINS_UPI_VPA_HINT. Created 3 years, 9 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_structure_unittest.cc
diff --git a/components/autofill/core/browser/form_structure_unittest.cc b/components/autofill/core/browser/form_structure_unittest.cc
index 06f73a597b3c2ccede8a2fcb53faf93da9087b7d..17fb018e8dad3e3a9acbd4ad81e682cf14c56c0e 100644
--- a/components/autofill/core/browser/form_structure_unittest.cc
+++ b/components/autofill/core/browser/form_structure_unittest.cc
@@ -149,7 +149,7 @@ TEST_F(FormStructureTest, AutofillCount) {
// Only text and select fields that are heuristically matched are counted.
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_EQ(3U, form_structure->autofill_count());
// Add a field with should_autocomplete=false. This should not be considered a
@@ -161,7 +161,7 @@ TEST_F(FormStructureTest, AutofillCount) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_EQ(4U, form_structure->autofill_count());
}
@@ -196,7 +196,7 @@ TEST_F(FormStructureTest, IsAutofillable) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_FALSE(form_structure->IsAutofillable());
// We now have three text fields, but only two auto-fillable fields.
@@ -211,7 +211,7 @@ TEST_F(FormStructureTest, IsAutofillable) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_FALSE(form_structure->IsAutofillable());
// We now have three auto-fillable fields.
@@ -221,19 +221,19 @@ TEST_F(FormStructureTest, IsAutofillable) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
// The target cannot include http(s)://*/search...
form.action = GURL("http://google.com/search?q=hello");
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_FALSE(form_structure->IsAutofillable());
// But search can be in the URL.
form.action = GURL("http://search.com/?q=hello");
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
}
@@ -405,7 +405,7 @@ TEST_F(FormStructureTest, HeuristicsContactInfo) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
// Expect the correct number of fields.
@@ -462,7 +462,7 @@ TEST_F(FormStructureTest, HeuristicsAutocompleteAttribute) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
EXPECT_TRUE(form_structure->has_author_specified_types());
EXPECT_TRUE(form_structure->has_author_specified_upi_vpa_hint());
@@ -505,7 +505,7 @@ TEST_F(FormStructureTest, Heuristics_FormlessNonCheckoutForm) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
// Expect the correct number of fields.
@@ -521,7 +521,7 @@ TEST_F(FormStructureTest, Heuristics_FormlessNonCheckoutForm) {
form.is_form_tag = false;
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
// Expect the correct number of fields.
@@ -562,7 +562,7 @@ TEST_F(FormStructureTest, StripCommonNamePrefix) {
form.fields.push_back(field);
std::unique_ptr<FormStructure> form_structure(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
// Expect the correct number of fields.
@@ -602,7 +602,7 @@ TEST_F(FormStructureTest, StripCommonNamePrefix_SmallPrefix) {
form.fields.push_back(field);
std::unique_ptr<FormStructure> form_structure(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
// Expect the correct number of fields.
@@ -638,7 +638,7 @@ TEST_F(FormStructureTest, IsCompleteCreditCardForm_Minimal) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsCompleteCreditCardForm());
}
@@ -676,7 +676,7 @@ TEST_F(FormStructureTest, IsCompleteCreditCardForm_Full) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsCompleteCreditCardForm());
}
@@ -694,7 +694,7 @@ TEST_F(FormStructureTest, IsCompleteCreditCardForm_OnlyCCNumber) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_FALSE(form_structure->IsCompleteCreditCardForm());
}
@@ -735,7 +735,7 @@ TEST_F(FormStructureTest, IsCompleteCreditCardForm_AddressForm) {
field.name = base::string16();
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_FALSE(form_structure->IsCompleteCreditCardForm());
}
@@ -765,7 +765,7 @@ TEST_F(FormStructureTest, HeuristicsAutocompleteAttributePhoneTypes) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
// Expect the correct number of fields.
@@ -805,7 +805,7 @@ TEST_F(FormStructureTest,
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
EXPECT_TRUE(form_structure->ShouldBeCrowdsourced());
@@ -843,7 +843,7 @@ TEST_F(FormStructureTest,
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
EXPECT_TRUE(form_structure->ShouldBeCrowdsourced());
@@ -886,7 +886,7 @@ TEST_F(FormStructureTest,
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
EXPECT_TRUE(form_structure->ShouldBeCrowdsourced());
@@ -918,7 +918,7 @@ TEST_F(FormStructureTest,
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_FALSE(form_structure->IsAutofillable());
EXPECT_FALSE(form_structure->ShouldBeCrowdsourced());
@@ -953,7 +953,7 @@ TEST_F(FormStructureTest,
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_FALSE(form_structure->IsAutofillable());
EXPECT_FALSE(form_structure->ShouldBeCrowdsourced());
@@ -996,7 +996,7 @@ TEST_F(FormStructureTest, PasswordFormShouldBeCrowdsourced) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure.ShouldBeCrowdsourced());
}
@@ -1047,7 +1047,7 @@ TEST_F(FormStructureTest, HeuristicsAutocompleteAttributeWithSections) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure.IsAutofillable());
// Expect the correct number of fields.
@@ -1092,7 +1092,7 @@ TEST_F(FormStructureTest,
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(nullptr /* ukm_service */);
// Expect the correct number of fields.
ASSERT_EQ(6U, form_structure.field_count());
@@ -1121,7 +1121,7 @@ TEST_F(FormStructureTest, HeuristicsAutocompleteAttributeWithSectionsRepeated) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(nullptr /* ukm_service */);
// Expect the correct number of fields.
ASSERT_EQ(2U, form_structure.field_count());
@@ -1158,7 +1158,7 @@ TEST_F(FormStructureTest, HeuristicsDontOverrideAutocompleteAttributeSections) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(nullptr /* ukm_service */);
// Expect the correct number of fields.
ASSERT_EQ(4U, form_structure.field_count());
@@ -1222,7 +1222,7 @@ TEST_F(FormStructureTest, HeuristicsSample8) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(10U, form_structure->field_count());
ASSERT_EQ(9U, form_structure->autofill_count());
@@ -1288,7 +1288,7 @@ TEST_F(FormStructureTest, HeuristicsSample6) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(7U, form_structure->field_count());
ASSERT_EQ(6U, form_structure->autofill_count());
@@ -1353,7 +1353,7 @@ TEST_F(FormStructureTest, HeuristicsLabelsOnly) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(8U, form_structure->field_count());
ASSERT_EQ(7U, form_structure->autofill_count());
@@ -1410,7 +1410,7 @@ TEST_F(FormStructureTest, HeuristicsCreditCardInfo) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(6U, form_structure->field_count());
ASSERT_EQ(5U, form_structure->autofill_count());
@@ -1470,7 +1470,7 @@ TEST_F(FormStructureTest, HeuristicsCreditCardInfoWithUnknownCardField) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(7U, form_structure->field_count());
ASSERT_EQ(5U, form_structure->autofill_count());
@@ -1517,7 +1517,7 @@ TEST_F(FormStructureTest, ThreeAddressLines) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(4U, form_structure->autofill_count());
@@ -1557,7 +1557,7 @@ TEST_F(FormStructureTest, SurplusAddressLinesIgnored) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -1600,7 +1600,7 @@ TEST_F(FormStructureTest, ThreeAddressLinesExpedia) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(4U, form_structure->field_count());
EXPECT_EQ(4U, form_structure->autofill_count());
@@ -1638,7 +1638,7 @@ TEST_F(FormStructureTest, TwoAddressLinesEbay) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(3U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -1671,7 +1671,7 @@ TEST_F(FormStructureTest, HeuristicsStateWithProvince) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(3U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -1737,7 +1737,7 @@ TEST_F(FormStructureTest, HeuristicsWithBilling) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(11U, form_structure->field_count());
ASSERT_EQ(11U, form_structure->autofill_count());
@@ -1786,7 +1786,7 @@ TEST_F(FormStructureTest, ThreePartPhoneNumber) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(4U, form_structure->autofill_count());
@@ -1831,7 +1831,7 @@ TEST_F(FormStructureTest, HeuristicsInfernoCC) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
// Expect the correct number of fields.
@@ -1885,7 +1885,7 @@ TEST_F(FormStructureTest, HeuristicsInferCCNames_NamesNotFirst) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
// Expect the correct number of fields.
@@ -1943,7 +1943,7 @@ TEST_F(FormStructureTest, HeuristicsInferCCNames_NamesFirst) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
EXPECT_TRUE(form_structure->IsAutofillable());
// Expect the correct number of fields.
@@ -2126,7 +2126,7 @@ TEST_F(FormStructureTest, EncodeUploadRequest) {
std::vector<ServerFieldTypeSet> possible_field_types;
FormData form;
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
FormFieldData field;
field.form_control_type = "text";
@@ -2302,7 +2302,7 @@ TEST_F(FormStructureTest,
std::vector<ServerFieldTypeSet> possible_field_types;
FormData form;
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
FormFieldData field;
field.label = ASCIIToUTF16("First Name");
@@ -2441,7 +2441,7 @@ TEST_F(FormStructureTest, EncodeUploadRequest_WithAutocomplete) {
std::vector<ServerFieldTypeSet> possible_field_types;
FormData form;
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
FormFieldData field;
field.form_control_type = "text";
@@ -2512,7 +2512,7 @@ TEST_F(FormStructureTest, EncodeUploadRequest_ObservedSubmissionFalse) {
std::vector<ServerFieldTypeSet> possible_field_types;
FormData form;
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
FormFieldData field;
field.form_control_type = "text";
@@ -2581,7 +2581,7 @@ TEST_F(FormStructureTest, EncodeUploadRequest_WithLabels) {
std::vector<ServerFieldTypeSet> possible_field_types;
FormData form;
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
FormFieldData field;
field.form_control_type = "text";
@@ -2718,7 +2718,7 @@ TEST_F(FormStructureTest, EncodeUploadRequest_WithFormName) {
// Setting the form name which we expect to see in the upload.
form.name = ASCIIToUTF16("myform");
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
FormFieldData field;
field.form_control_type = "text";
@@ -2780,7 +2780,7 @@ TEST_F(FormStructureTest, EncodeUploadRequestPartialMetadata) {
std::vector<ServerFieldTypeSet> possible_field_types;
FormData form;
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
FormFieldData field;
field.form_control_type = "text";
@@ -2853,7 +2853,7 @@ TEST_F(FormStructureTest, EncodeUploadRequest_DisabledMetadataTrial) {
std::vector<ServerFieldTypeSet> possible_field_types;
FormData form;
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(nullptr /* ukm_service */);
FormFieldData field;
field.form_control_type = "text";
@@ -3781,7 +3781,7 @@ TEST_F(FormStructureTest, ParseQueryResponseAuthorDefinedTypes) {
FormStructure form_structure(form);
std::vector<FormStructure*> forms;
forms.push_back(&form_structure);
- forms.front()->DetermineHeuristicTypes();
+ forms.front()->DetermineHeuristicTypes(nullptr /* ukm_service */);
AutofillQueryResponseContents response;
response.add_field()->set_autofill_type(EMAIL_ADDRESS);
« no previous file with comments | « components/autofill/core/browser/form_structure.cc ('k') | components/autofill/core/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698