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

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

Issue 2395243002: [Autofill] Log count histogram for the number of server cards (Closed)
Patch Set: addressed nits Created 4 years, 2 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/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 6ebf24c0b25b7a0f9c32ed234a6e68bd363aadf8..73c9ae8fd4a4a7915996259c8ff2bd32752b5dd8 100644
--- a/components/autofill/core/browser/autofill_metrics_unittest.cc
+++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -1513,6 +1513,56 @@ TEST_F(AutofillMetricsTest, StoredLocalCreditCardCount) {
}
}
+// Test that the masked server credit card counts are logged correctly.
+TEST_F(AutofillMetricsTest, StoredServerCreditCardCounts_Masked) {
+ // The metrics should be logged when the credit cards are first loaded.
+ {
+ base::HistogramTester histogram_tester;
+ personal_data_->RecreateCreditCards(
+ false /* include_local_credit_card */,
+ true /* include_masked_server_credit_card */,
+ false /* include_full_server_credit_card */);
+ histogram_tester.ExpectUniqueSample(
+ "Autofill.StoredServerCreditCardCount.Masked", 1, 1);
+ }
+
+ // The metrics should only be logged once.
+ {
+ base::HistogramTester histogram_tester;
+ personal_data_->RecreateCreditCards(
+ false /* include_local_credit_card */,
+ true /* include_masked_server_credit_card */,
+ true /* include_full_server_credit_card */);
+ histogram_tester.ExpectTotalCount(
+ "Autofill.StoredServerCreditCardCount.Masked", 0);
+ }
+}
+
+// Test that the unmasked (full) server credit card counts are logged correctly.
+TEST_F(AutofillMetricsTest, StoredServerCreditCardCounts_Unmasked) {
+ // The metrics should be logged when the credit cards are first loaded.
+ {
+ base::HistogramTester histogram_tester;
+ personal_data_->RecreateCreditCards(
+ false /* include_local_credit_card */,
+ false /* include_masked_server_credit_card */,
+ true /* include_full_server_credit_card */);
+ histogram_tester.ExpectUniqueSample(
+ "Autofill.StoredServerCreditCardCount.Unmasked", 1, 1);
+ }
+
+ // The metrics should only be logged once.
+ {
+ base::HistogramTester histogram_tester;
+ personal_data_->RecreateCreditCards(
+ false /* include_local_credit_card */,
+ false /* include_masked_server_credit_card */,
+ true /* include_full_server_credit_card */);
+ histogram_tester.ExpectTotalCount(
+ "Autofill.StoredServerCreditCardCount.Unmasked", 0);
+ }
+}
+
// Test that we correctly log when Autofill is enabled.
TEST_F(AutofillMetricsTest, AutofillIsEnabledAtStartup) {
base::HistogramTester histogram_tester;
« no previous file with comments | « components/autofill/core/browser/autofill_metrics.cc ('k') | components/autofill/core/browser/personal_data_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698