summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-26 21:53:29 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-26 21:53:29 +0000
commitdfd1818d0dd1350549243c615b2cf585e675afde (patch)
treeb209833f8bb4ec18b6a3a8175a92a9f4a86478c9 /chrome/browser/autofill
parented1213b31516a2af396ee9e0a0ba9f22e1e1427e (diff)
downloadchromium_src-dfd1818d0dd1350549243c615b2cf585e675afde.zip
chromium_src-dfd1818d0dd1350549243c615b2cf585e675afde.tar.gz
chromium_src-dfd1818d0dd1350549243c615b2cf585e675afde.tar.bz2
[Autofill] Add metrics measuring developer engagement, in terms of implementation of the autocomplete types spec.
BUG=157809 TEST=unit_tests --gtest_filter=AutofillMetricsTest.* Review URL: https://chromiumcodereview.appspot.com/11265019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164422 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r--chrome/browser/autofill/autofill_manager.cc4
-rw-r--r--chrome/browser/autofill/autofill_manager.h3
-rw-r--r--chrome/browser/autofill/autofill_manager_unittest.cc4
-rw-r--r--chrome/browser/autofill/autofill_metrics.cc8
-rw-r--r--chrome/browser/autofill/autofill_metrics.h13
-rw-r--r--chrome/browser/autofill/autofill_metrics_unittest.cc105
-rw-r--r--chrome/browser/autofill/form_structure.cc12
-rw-r--r--chrome/browser/autofill/form_structure.h2
-rw-r--r--chrome/browser/autofill/form_structure_unittest.cc80
-rw-r--r--chrome/browser/autofill/personal_data_manager_unittest.cc76
10 files changed, 227 insertions, 80 deletions
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 517d909..f9dfd82 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -1082,7 +1082,7 @@ bool AutofillManager::UpdateCachedForm(const FormData& live_form,
// Add the new or updated form to our cache.
form_structures_.push_back(new FormStructure(live_form));
*updated_form = *form_structures_.rbegin();
- (*updated_form)->DetermineHeuristicTypes();
+ (*updated_form)->DetermineHeuristicTypes(*metric_logger_);
// If we have cached data, propagate it to the updated form.
if (cached_form) {
@@ -1325,7 +1325,7 @@ void AutofillManager::ParseForms(const std::vector<FormData>& forms) {
if (!form_structure->ShouldBeParsed(false))
continue;
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(*metric_logger_);
// Set aside forms with method GET or author-specified types, so that they
// are not included in the query to the server.
diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h
index 345b68b..4be3a4f5 100644
--- a/chrome/browser/autofill/autofill_manager.h
+++ b/chrome/browser/autofill/autofill_manager.h
@@ -396,6 +396,8 @@ class AutofillManager : public content::NotificationObserver,
DeterminePossibleFieldTypesForUploadStressTest);
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AddressSuggestionsCount);
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtPageLoad);
+ FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, DeveloperEngagement);
+ FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration);
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest,
NoQualityMetricsForNonAutofillableForms);
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetrics);
@@ -408,7 +410,6 @@ class AutofillManager : public content::NotificationObserver,
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest,
UserHappinessFormLoadAndSubmission);
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction);
- FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration);
DISALLOW_COPY_AND_ASSIGN(AutofillManager);
};
diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc
index 9950c8d..ea51a584 100644
--- a/chrome/browser/autofill/autofill_manager_unittest.cc
+++ b/chrome/browser/autofill/autofill_manager_unittest.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/autofill/autocomplete_history_manager.h"
#include "chrome/browser/autofill/autofill_common_test.h"
#include "chrome/browser/autofill/autofill_manager.h"
+#include "chrome/browser/autofill/autofill_metrics.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/credit_card.h"
#include "chrome/browser/autofill/personal_data_manager.h"
@@ -2526,7 +2527,8 @@ TEST_F(AutofillManagerTest, FormSubmittedServerTypes) {
// Simulate having seen this form on page load.
// |form_structure| will be owned by |autofill_manager_|.
TestFormStructure* form_structure = new TestFormStructure(form);
- form_structure->DetermineHeuristicTypes();
+ AutofillMetrics metrics_logger; // ignored
+ form_structure->DetermineHeuristicTypes(metrics_logger);
// Clear the heuristic types, and instead set the appropriate server types.
std::vector<AutofillFieldType> heuristic_types, server_types;
diff --git a/chrome/browser/autofill/autofill_metrics.cc b/chrome/browser/autofill/autofill_metrics.cc
index 960c7a6..20f5506 100644
--- a/chrome/browser/autofill/autofill_metrics.cc
+++ b/chrome/browser/autofill/autofill_metrics.cc
@@ -258,6 +258,14 @@ void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric) const {
NUM_INFO_BAR_METRICS);
}
+void AutofillMetrics::LogDeveloperEngagementMetric(
+ DeveloperEngagementMetric metric) const {
+ DCHECK(metric < NUM_DEVELOPER_ENGAGEMENT_METRICS);
+
+ UMA_HISTOGRAM_ENUMERATION("Autofill.DeveloperEngagement", metric,
+ NUM_DEVELOPER_ENGAGEMENT_METRICS);
+}
+
void AutofillMetrics::LogHeuristicTypePrediction(
FieldTypeQualityMetric metric,
AutofillFieldType field_type,
diff --git a/chrome/browser/autofill/autofill_metrics.h b/chrome/browser/autofill/autofill_metrics.h
index 888336b..f270c7a 100644
--- a/chrome/browser/autofill/autofill_metrics.h
+++ b/chrome/browser/autofill/autofill_metrics.h
@@ -17,6 +17,16 @@ class TimeDelta;
class AutofillMetrics {
public:
+ enum DeveloperEngagementMetric {
+ // Parsed a form that is potentially autofillable.
+ FILLABLE_FORM_PARSED = 0,
+ // Parsed a form that is potentially autofillable and contains at least one
+ // web developer-specified field type hint, a la
+ // http://is.gd/whatwg_autocomplete
+ FILLABLE_FORM_CONTAINS_TYPE_HINTS,
+ NUM_DEVELOPER_ENGAGEMENT_METRICS
+ };
+
enum InfoBarMetric {
INFOBAR_SHOWN = 0, // We showed an infobar, e.g. prompting to save credit
// card info.
@@ -124,6 +134,9 @@ class AutofillMetrics {
virtual void LogCreditCardInfoBarMetric(InfoBarMetric metric) const;
+ virtual void LogDeveloperEngagementMetric(
+ DeveloperEngagementMetric metric) const;
+
virtual void LogHeuristicTypePrediction(
FieldTypeQualityMetric metric,
AutofillFieldType field_type,
diff --git a/chrome/browser/autofill/autofill_metrics_unittest.cc b/chrome/browser/autofill/autofill_metrics_unittest.cc
index cb0be78..28891d3 100644
--- a/chrome/browser/autofill/autofill_metrics_unittest.cc
+++ b/chrome/browser/autofill/autofill_metrics_unittest.cc
@@ -41,6 +41,8 @@ class MockAutofillMetrics : public AutofillMetrics {
public:
MockAutofillMetrics() {}
MOCK_CONST_METHOD1(LogCreditCardInfoBarMetric, void(InfoBarMetric metric));
+ MOCK_CONST_METHOD1(LogDeveloperEngagementMetric,
+ void(DeveloperEngagementMetric metric));
MOCK_CONST_METHOD3(LogHeuristicTypePrediction,
void(FieldTypeQualityMetric metric,
AutofillFieldType field_type,
@@ -274,6 +276,8 @@ class AutofillMetricsTest : public ChromeRenderViewHostTestHarness {
TestPersonalDataManager personal_data_;
private:
+ std::string default_gmock_verbosity_level_;
+
DISALLOW_COPY_AND_ASSIGN(AutofillMetricsTest);
};
@@ -302,9 +306,21 @@ void AutofillMetricsTest::SetUp() {
&personal_data_);
file_thread_.Start();
+
+ // Ignore any metrics that we haven't explicitly set expectations for.
+ // If we don't override the verbosity level, we'll get lots of log spew from
+ // mocked functions that aren't relevant to a test but happen to be called
+ // during the test's execution.
+ // CAUTION: This is a global variable. So as to not affect other tests, this
+ // _must_ be restored to its original value at the end of the test.
+ default_gmock_verbosity_level_ = ::testing::FLAGS_gmock_verbose;
+ ::testing::FLAGS_gmock_verbose = "error";
}
void AutofillMetricsTest::TearDown() {
+ // Restore the global Gmock verbosity level to its default value.
+ ::testing::FLAGS_gmock_verbose = default_gmock_verbosity_level_;
+
// Order of destruction is important as AutofillManager relies on
// PersonalDataManager to be around when it gets destroyed. Also, a real
// AutofillManager is tied to the lifetime of the WebContents, so it must
@@ -573,7 +589,6 @@ TEST_F(AutofillMetricsTest, QualityMetricsForFailure) {
// Establish our expectations.
- ::testing::FLAGS_gmock_verbose = "error";
::testing::InSequence dummy;
EXPECT_CALL(*autofill_manager_->metric_logger(),
LogServerExperimentIdForUpload(std::string()));
@@ -755,6 +770,84 @@ TEST_F(AutofillMetricsTest, SaneMetricsWithCacheMismatch) {
TimeTicks::Now()));
}
+// Verify that we correctly log metrics regarding developer engagement.
+TEST_F(AutofillMetricsTest, DeveloperEngagement) {
+ // Start with a non-fillable form.
+ FormData form;
+ form.name = ASCIIToUTF16("TestForm");
+ form.method = ASCIIToUTF16("POST");
+ form.origin = GURL("http://example.com/form.html");
+ form.action = GURL("http://example.com/submit.html");
+
+ FormFieldData field;
+ autofill_test::CreateTestFormField("Name", "name", "", "text", &field);
+ form.fields.push_back(field);
+ autofill_test::CreateTestFormField("Email", "email", "", "text", &field);
+ form.fields.push_back(field);
+
+ std::vector<FormData> forms(1, form);
+
+ // Ensure no metrics are logged when loading a non-fillable form.
+ {
+ EXPECT_CALL(*autofill_manager_->metric_logger(),
+ LogDeveloperEngagementMetric(_)).Times(0);
+ autofill_manager_->OnFormsSeen(forms, TimeTicks());
+ autofill_manager_->Reset();
+ Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
+ }
+
+ // Add another field to the form, so that it becomes fillable.
+ autofill_test::CreateTestFormField("Phone", "phone", "", "text", &field);
+ forms.back().fields.push_back(field);
+
+ // Expect only the "form parsed" metric to be logged; no metrics about
+ // author-specified field type hints.
+ {
+ EXPECT_CALL(
+ *autofill_manager_->metric_logger(),
+ LogDeveloperEngagementMetric(
+ AutofillMetrics::FILLABLE_FORM_PARSED)).Times(1);
+ EXPECT_CALL(
+ *autofill_manager_->metric_logger(),
+ LogDeveloperEngagementMetric(
+ AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS)).Times(0);
+ autofill_manager_->OnFormsSeen(forms, TimeTicks());
+ autofill_manager_->Reset();
+ Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
+ }
+
+ // Add some fields with an author-specified field type to the form.
+ // We need to add at least three fields, because a form must have at least
+ // three fillable fields to be considered to be autofillable; and if at least
+ // one field specifies an explicit type hint, we don't apply any of our usual
+ // local heuristics to detect field types in the rest of the form.
+ autofill_test::CreateTestFormField("", "", "", "text", &field);
+ field.autocomplete_attribute = "given-name";
+ forms.back().fields.push_back(field);
+ autofill_test::CreateTestFormField("", "", "", "text", &field);
+ field.autocomplete_attribute = "email";
+ forms.back().fields.push_back(field);
+ autofill_test::CreateTestFormField("", "", "", "text", &field);
+ field.autocomplete_attribute = "street-address";
+ forms.back().fields.push_back(field);
+
+ // Expect both the "form parsed" metric and the author-specified field type
+ // hints metric to be logged.
+ {
+ EXPECT_CALL(
+ *autofill_manager_->metric_logger(),
+ LogDeveloperEngagementMetric(
+ AutofillMetrics::FILLABLE_FORM_PARSED)).Times(1);
+ EXPECT_CALL(
+ *autofill_manager_->metric_logger(),
+ LogDeveloperEngagementMetric(
+ AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS)).Times(1);
+ autofill_manager_->OnFormsSeen(forms, TimeTicks());
+ autofill_manager_->Reset();
+ Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
+ }
+}
+
// Test that we don't log quality metrics for non-autofillable forms.
TEST_F(AutofillMetricsTest, NoQualityMetricsForNonAutofillableForms) {
// Forms must include at least three fields to be auto-fillable.
@@ -976,7 +1069,6 @@ TEST_F(AutofillMetricsTest, AddressSuggestionsCount) {
std::string());
// Establish our expectations.
- ::testing::FLAGS_gmock_verbose = "error";
::testing::InSequence dummy;
EXPECT_CALL(*autofill_manager_->metric_logger(),
LogAddressSuggestionsCount(2)).Times(1);
@@ -1022,7 +1114,6 @@ TEST_F(AutofillMetricsTest, AddressSuggestionsCount) {
// Test that we log whether Autofill is enabled when filling a form.
TEST_F(AutofillMetricsTest, AutofillIsEnabledAtPageLoad) {
// Establish our expectations.
- ::testing::FLAGS_gmock_verbose = "error";
::testing::InSequence dummy;
EXPECT_CALL(*autofill_manager_->metric_logger(),
LogIsAutofillEnabledAtPageLoad(true)).Times(1);
@@ -1388,11 +1479,6 @@ TEST_F(AutofillMetricsTest, FormFillDuration) {
form.fields[1].value = ASCIIToUTF16("theking@gmail.com");
form.fields[2].value = ASCIIToUTF16("12345678901");
- // Ignore any non-timing metrics.
- // CAUTION: This is a global variable. So as to not affect other tests, this
- // _must_ be restored to "warning" at the end of the test.
- ::testing::FLAGS_gmock_verbose = "error";
-
// Expect only form load metrics to be logged if the form is submitted without
// user interaction.
{
@@ -1475,7 +1561,4 @@ TEST_F(AutofillMetricsTest, FormFillDuration) {
autofill_manager_->Reset();
Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
}
-
- // Restore the global Gmock verbosity level to its default value.
- ::testing::FLAGS_gmock_verbose = "warning";
}
diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc
index 36eaf69..048a04a 100644
--- a/chrome/browser/autofill/form_structure.cc
+++ b/chrome/browser/autofill/form_structure.cc
@@ -259,7 +259,8 @@ FormStructure::FormStructure(const FormData& form)
FormStructure::~FormStructure() {}
-void FormStructure::DetermineHeuristicTypes() {
+void FormStructure::DetermineHeuristicTypes(
+ const AutofillMetrics& metric_logger) {
// First, try to detect field types based on each field's |autocomplete|
// attribute value. If there is at least one form field that specifies an
// autocomplete type hint, don't try to apply other heuristics to match fields
@@ -281,6 +282,15 @@ void FormStructure::DetermineHeuristicTypes() {
UpdateAutofillCount();
IdentifySections(has_author_specified_sections);
+
+ if (IsAutofillable(true)) {
+ metric_logger.LogDeveloperEngagementMetric(
+ AutofillMetrics::FILLABLE_FORM_PARSED);
+ if (has_author_specified_types_) {
+ metric_logger.LogDeveloperEngagementMetric(
+ AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS);
+ }
+ }
}
bool FormStructure::EncodeUploadRequest(
diff --git a/chrome/browser/autofill/form_structure.h b/chrome/browser/autofill/form_structure.h
index 39db109..92936f0 100644
--- a/chrome/browser/autofill/form_structure.h
+++ b/chrome/browser/autofill/form_structure.h
@@ -48,7 +48,7 @@ class FormStructure {
// Runs several heuristics against the form fields to determine their possible
// types.
- void DetermineHeuristicTypes();
+ void DetermineHeuristicTypes(const AutofillMetrics& metric_logger);
// Encodes the XML upload request from this FormStructure.
bool EncodeUploadRequest(const FieldTypeSet& available_field_types,
diff --git a/chrome/browser/autofill/form_structure_unittest.cc b/chrome/browser/autofill/form_structure_unittest.cc
index 687c829..a1524194 100644
--- a/chrome/browser/autofill/form_structure_unittest.cc
+++ b/chrome/browser/autofill/form_structure_unittest.cc
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/autofill/form_structure.h"
+
#include "base/memory/scoped_ptr.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/autofill/form_structure.h"
+#include "chrome/browser/autofill/autofill_metrics.h"
#include "chrome/common/form_data.h"
#include "chrome/common/form_field_data.h"
#include "googleurl/src/gurl.h"
@@ -14,6 +16,20 @@
using WebKit::WebInputElement;
+namespace {
+
+// Unlike the base AutofillMetrics, exposes copy and assignment constructors,
+// which are handy for briefer test code. The AutofillMetrics class is
+// stateless, so this is safe.
+class TestAutofillMetrics : public AutofillMetrics {
+ public:
+ TestAutofillMetrics() {}
+ virtual ~TestAutofillMetrics() {}
+};
+
+} // anonymous namespace
+
+
namespace content {
std::ostream& operator<<(std::ostream& os, const FormData& form) {
@@ -97,7 +113,7 @@ TEST(FormStructureTest, AutofillCount) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
// Only text and select fields that are heuristically matched are counted.
EXPECT_EQ(1U, form_structure.autofill_count());
@@ -136,7 +152,7 @@ TEST(FormStructureTest, IsAutofillable) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_FALSE(form_structure->IsAutofillable(true));
// We now have three text fields, but only two auto-fillable fields.
@@ -151,7 +167,7 @@ TEST(FormStructureTest, IsAutofillable) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_FALSE(form_structure->IsAutofillable(true));
// We now have three auto-fillable fields.
@@ -161,14 +177,14 @@ TEST(FormStructureTest, IsAutofillable) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
// The method must be 'post', though we can intentionally ignore this
// criterion for the sake of providing a helpful warning message to the user.
form.method = ASCIIToUTF16("get");
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_FALSE(form_structure->IsAutofillable(true));
EXPECT_TRUE(form_structure->IsAutofillable(false));
@@ -176,13 +192,13 @@ TEST(FormStructureTest, IsAutofillable) {
form.method = ASCIIToUTF16("post");
form.action = GURL("http://google.com/search?q=hello");
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_FALSE(form_structure->IsAutofillable(true));
// 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(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
}
@@ -303,7 +319,7 @@ TEST(FormStructureTest, HeuristicsContactInfo) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
// Expect the correct number of fields.
@@ -354,7 +370,7 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttribute) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
// Expect the correct number of fields.
@@ -392,7 +408,7 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttributePhoneTypes) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
// Expect the correct number of fields.
@@ -433,7 +449,7 @@ TEST(FormStructureTest, AutocompleteAttributeOverridesOtherHeuristics) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
EXPECT_TRUE(form_structure->ShouldBeCrowdsourced());
@@ -447,7 +463,7 @@ TEST(FormStructureTest, AutocompleteAttributeOverridesOtherHeuristics) {
// Now update the first form field to include an 'autocomplete' attribute.
form.fields.front().autocomplete_attribute = "x-other";
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_FALSE(form_structure->IsAutofillable(true));
EXPECT_FALSE(form_structure->ShouldBeCrowdsourced());
@@ -507,7 +523,7 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttributeWithSections) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure.IsAutofillable(true));
// Expect the correct number of fields.
@@ -552,7 +568,7 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttributeWithSectionsDegenerate) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
// Expect the correct number of fields.
ASSERT_EQ(6U, form_structure.field_count());
@@ -582,7 +598,7 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttributeWithSectionsRepeated) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
// Expect the correct number of fields.
ASSERT_EQ(2U, form_structure.field_count());
@@ -620,7 +636,7 @@ TEST(FormStructureTest, HeuristicsDontOverrideAutocompleteAttributeSections) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
// Expect the correct number of fields.
ASSERT_EQ(4U, form_structure.field_count());
@@ -685,7 +701,7 @@ TEST(FormStructureTest, HeuristicsSample8) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(10U, form_structure->field_count());
ASSERT_EQ(9U, form_structure->autofill_count());
@@ -753,7 +769,7 @@ TEST(FormStructureTest, HeuristicsSample6) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(7U, form_structure->field_count());
ASSERT_EQ(6U, form_structure->autofill_count());
@@ -819,7 +835,7 @@ TEST(FormStructureTest, HeuristicsLabelsOnly) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(8U, form_structure->field_count());
ASSERT_EQ(7U, form_structure->autofill_count());
@@ -877,7 +893,7 @@ TEST(FormStructureTest, HeuristicsCreditCardInfo) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(6U, form_structure->field_count());
ASSERT_EQ(4U, form_structure->autofill_count());
@@ -937,7 +953,7 @@ TEST(FormStructureTest, HeuristicsCreditCardInfoWithUnknownCardField) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(7U, form_structure->field_count());
ASSERT_EQ(4U, form_structure->autofill_count());
@@ -984,7 +1000,7 @@ TEST(FormStructureTest, ThreeAddressLines) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -1026,7 +1042,7 @@ TEST(FormStructureTest, BillingAndShippingAddresses) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(4U, form_structure->autofill_count());
@@ -1072,7 +1088,7 @@ TEST(FormStructureTest, ThreeAddressLinesExpedia) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(4U, form_structure->field_count());
EXPECT_EQ(3U, form_structure->autofill_count());
@@ -1111,7 +1127,7 @@ TEST(FormStructureTest, TwoAddressLinesEbay) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(3U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -1145,7 +1161,7 @@ TEST(FormStructureTest, HeuristicsStateWithProvince) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(3U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -1212,7 +1228,7 @@ TEST(FormStructureTest, HeuristicsWithBilling) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(11U, form_structure->field_count());
ASSERT_EQ(11U, form_structure->autofill_count());
@@ -1263,7 +1279,7 @@ TEST(FormStructureTest, ThreePartPhoneNumber) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -1309,7 +1325,7 @@ TEST(FormStructureTest, HeuristicsInfernoCC) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
// Expect the correct number of fields.
@@ -1362,7 +1378,7 @@ TEST(FormStructureTest, CVCCodeClash) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(form_structure->IsAutofillable(true));
// Expect the correct number of fields.
@@ -1501,7 +1517,7 @@ TEST(FormStructureTest, EncodeUploadRequest) {
FormData form;
form.method = ASCIIToUTF16("post");
form_structure.reset(new FormStructure(form));
- form_structure->DetermineHeuristicTypes();
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
FormFieldData field;
field.form_control_type = "text";
diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc
index c20624e..7342ca1 100644
--- a/chrome/browser/autofill/personal_data_manager_unittest.cc
+++ b/chrome/browser/autofill/personal_data_manager_unittest.cc
@@ -10,6 +10,7 @@
#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_common_test.h"
+#include "chrome/browser/autofill/autofill_metrics.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/form_structure.h"
#include "chrome/browser/autofill/personal_data_manager.h"
@@ -31,6 +32,8 @@
using content::BrowserThread;
+namespace {
+
ACTION(QuitUIMessageLoop) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
MessageLoop::current()->Quit();
@@ -44,6 +47,17 @@ class PersonalDataLoadedObserverMock : public PersonalDataManagerObserver {
MOCK_METHOD0(OnPersonalDataChanged, void());
};
+// Unlike the base AutofillMetrics, exposes copy and assignment constructors,
+// which are handy for briefer test code. The AutofillMetrics class is
+// stateless, so this is safe.
+class TestAutofillMetrics : public AutofillMetrics {
+ public:
+ TestAutofillMetrics() {}
+ virtual ~TestAutofillMetrics() {}
+};
+
+} // anonymous namespace
+
class PersonalDataManagerTest : public testing::Test {
protected:
PersonalDataManagerTest()
@@ -505,7 +519,7 @@ TEST_F(PersonalDataManagerTest, ImportFormData) {
"Zip:", "zip", "94102", "text", &field);
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure,
&imported_credit_card));
@@ -550,7 +564,7 @@ TEST_F(PersonalDataManagerTest, ImportFormDataBadEmail) {
"Zip:", "zip", "94102", "text", &field);
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_FALSE(personal_data_->ImportFormData(form_structure,
&imported_credit_card));
@@ -573,7 +587,7 @@ TEST_F(PersonalDataManagerTest, ImportFormDataNotEnoughFilledFields) {
"Card number:", "card_number", "4111 1111 1111 1111", "text", &field);
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_FALSE(personal_data_->ImportFormData(form_structure,
&imported_credit_card));
@@ -619,7 +633,7 @@ TEST_F(PersonalDataManagerTest, ImportPhoneNumberSplitAcrossMultipleFields) {
"Zip:", "zip", "94102", "text", &field);
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure,
&imported_credit_card));
@@ -702,7 +716,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -746,7 +760,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
ASSERT_FALSE(imported_credit_card);
@@ -793,7 +807,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoProfilesWithMultiValue) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -837,7 +851,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoProfilesWithMultiValue) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
ASSERT_FALSE(imported_credit_card);
@@ -895,7 +909,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -950,7 +964,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
ASSERT_FALSE(imported_credit_card);
@@ -995,7 +1009,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -1039,7 +1053,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
ASSERT_FALSE(imported_credit_card);
@@ -1088,7 +1102,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInNew) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -1133,7 +1147,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInNew) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
ASSERT_FALSE(imported_credit_card);
@@ -1173,7 +1187,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithInsufficientAddress) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_FALSE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -1229,7 +1243,7 @@ TEST_F(PersonalDataManagerTest, AggregateExistingAuxiliaryProfile) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure,
&imported_credit_card));
@@ -1264,7 +1278,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentCreditCards) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -1300,7 +1314,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentCreditCards) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
ASSERT_TRUE(imported_credit_card);
@@ -1340,7 +1354,7 @@ TEST_F(PersonalDataManagerTest, AggregateInvalidCreditCard) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -1376,7 +1390,7 @@ TEST_F(PersonalDataManagerTest, AggregateInvalidCreditCard) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_FALSE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
ASSERT_FALSE(imported_credit_card);
@@ -1407,7 +1421,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithConflict) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -1444,7 +1458,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithConflict) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
EXPECT_FALSE(imported_credit_card);
@@ -1483,7 +1497,7 @@ TEST_F(PersonalDataManagerTest, AggregateEmptyCreditCardWithConflict) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -1516,7 +1530,7 @@ TEST_F(PersonalDataManagerTest, AggregateEmptyCreditCardWithConflict) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_FALSE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
EXPECT_FALSE(imported_credit_card);
@@ -1551,7 +1565,7 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInNew) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -1586,7 +1600,7 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInNew) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
EXPECT_FALSE(imported_credit_card);
@@ -1615,7 +1629,7 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInNew) {
// Note missing expiration month and year..
FormStructure form_structure3(form3);
- form_structure3.DetermineHeuristicTypes();
+ form_structure3.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_FALSE(personal_data_->ImportFormData(form_structure3,
&imported_credit_card));
ASSERT_FALSE(imported_credit_card);
@@ -1667,7 +1681,7 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInOld) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure,
&imported_credit_card));
@@ -1724,7 +1738,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithSeparators) {
form.fields.push_back(field);
FormStructure form_structure(form);
- form_structure.DetermineHeuristicTypes();
+ form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure,
&imported_credit_card));
@@ -1890,7 +1904,7 @@ TEST_F(PersonalDataManagerTest, CaseInsensitiveMultiValueAggregation) {
form1.fields.push_back(field);
FormStructure form_structure1(form1);
- form_structure1.DetermineHeuristicTypes();
+ form_structure1.DetermineHeuristicTypes(TestAutofillMetrics());
const CreditCard* imported_credit_card;
EXPECT_TRUE(personal_data_->ImportFormData(form_structure1,
&imported_credit_card));
@@ -1937,7 +1951,7 @@ TEST_F(PersonalDataManagerTest, CaseInsensitiveMultiValueAggregation) {
form2.fields.push_back(field);
FormStructure form_structure2(form2);
- form_structure2.DetermineHeuristicTypes();
+ form_structure2.DetermineHeuristicTypes(TestAutofillMetrics());
EXPECT_TRUE(personal_data_->ImportFormData(form_structure2,
&imported_credit_card));
ASSERT_FALSE(imported_credit_card);