Chromium Code Reviews| Index: components/autofill/core/browser/autofill_metrics_unittest.cc |
| diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc |
| index d101f879395c0cfd9de4ca60d87252e3ed1a4b3f..f2e446528d7855deb1e784b253d0d846a4e1ec63 100644 |
| --- a/components/autofill/core/browser/autofill_metrics_unittest.cc |
| +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc |
| @@ -362,6 +362,11 @@ TEST_F(AutofillMetricsTest, QualityMetrics) { |
| histogram_tester.ExpectBucketCount( |
| "Autofill.Quality.PredictedType.ByFieldType", |
| GetFieldTypeGroupMetric(NAME_FULL, AutofillMetrics::TYPE_MISMATCH), 1); |
| + |
| + // An autofillable form was submitted, and number of stored profiles is |
| + // logged. |
| + histogram_tester.ExpectBucketCount( |
| + "Autofill.StoredProfileCountAtAutofillableFormSubmission", 2, 1); |
|
Ilya Sherman
2015/01/30 22:11:44
This isn't a quality metric. Please write a separ
Mathieu
2015/01/31 18:25:51
Done. Thanks, cleaner now.
|
| } |
| // Test that we behave sanely when the cached form differs from the submitted |
| @@ -505,6 +510,32 @@ TEST_F(AutofillMetricsTest, SaneMetricsWithCacheMismatch) { |
| 1); |
| } |
| +// Verify that when submitting a non-autofillable form, the stored profile |
| +// metric is not logged. |
| +TEST_F(AutofillMetricsTest, StoredProfileCountNonAutofillableFormSubmission) { |
| + // Construct a non-fillable form. |
| + FormData form; |
| + form.name = ASCIIToUTF16("TestForm"); |
| + form.origin = GURL("http://example.com/form.html"); |
| + form.action = GURL("http://example.com/submit.html"); |
| + |
| + // Two fields is not enough to make it an autofillable form. |
| + FormFieldData field; |
| + test::CreateTestFormField("Name", "name", "", "text", &field); |
| + form.fields.push_back(field); |
| + test::CreateTestFormField("Email", "email", "", "text", &field); |
| + form.fields.push_back(field); |
| + |
| + // Simulate form submission. |
| + base::HistogramTester histogram_tester; |
| + autofill_manager_->FormSubmitted(form, TimeTicks::Now()); |
| + |
| + // A non-autofillable form was submitted, and number of stored profiles is NOT |
| + // logged. |
| + histogram_tester.ExpectTotalCount( |
| + "Autofill.StoredProfileCountAtAutofillableFormSubmission", 0); |
| +} |
| + |
| // Verify that we correctly log metrics regarding developer engagement. |
| TEST_F(AutofillMetricsTest, DeveloperEngagement) { |
| // Start with a non-fillable form. |