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

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

Issue 880353002: [Autofill] Log the number of autofill profiles available at form submission (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved tests 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
« no previous file with comments | « components/autofill/core/browser/autofill_metrics.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « components/autofill/core/browser/autofill_metrics.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698