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

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

Issue 2839063004: [Autofill] UKM for suggestions polled field. (Closed)
Patch Set: Address comments. Created 3 years, 8 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 3372ee378848aebebcdd7a6fffd167b5735f9b72..5f5b531c7a7a04a6fd48256f82221473e75a4f79 100644
--- a/components/autofill/core/browser/autofill_metrics_unittest.cc
+++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -2313,6 +2313,9 @@ TEST_F(AutofillMetricsTest, ProfileCheckoutFlowUserActions) {
// Tests that the Autofill_PolledCreditCardSuggestions user action is only
// logged once if the field is queried repeatedly.
TEST_F(AutofillMetricsTest, PolledCreditCardSuggestions_DebounceLogs) {
+ EnableUkmLogging();
+ ukm::TestUkmService* ukm_service = autofill_client_.GetTestUkmService();
+
personal_data_->RecreateCreditCards(
true /* include_local_credit_card */,
false /* include_masked_server_credit_card */,
@@ -2321,6 +2324,8 @@ TEST_F(AutofillMetricsTest, PolledCreditCardSuggestions_DebounceLogs) {
// Set up the form data.
FormData form;
form.name = ASCIIToUTF16("TestForm");
+ form.origin = GURL("http://example.com/form.html");
+ form.action = GURL("http://example.com/submit.html");
FormFieldData field;
std::vector<ServerFieldType> field_types;
@@ -2364,6 +2369,21 @@ TEST_F(AutofillMetricsTest, PolledCreditCardSuggestions_DebounceLogs) {
gfx::RectF());
EXPECT_EQ(3, user_action_tester.GetActionCount(
"Autofill_PolledCreditCardSuggestions"));
+
+ VerifyFormInteractionUkm(
+ form, ukm_service, internal::kUKMPollSuggestionsEntryName,
+ {{{internal::kUKMMillisecondsSinceFormLoadedMetricName, 0},
+ {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NAME_FULL},
+ {internal::kUKMServerTypeMetricName, CREDIT_CARD_NAME_FULL},
+ {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}},
+ {{internal::kUKMMillisecondsSinceFormLoadedMetricName, 0},
+ {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NUMBER},
+ {internal::kUKMServerTypeMetricName, CREDIT_CARD_NUMBER},
+ {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}},
+ {{internal::kUKMMillisecondsSinceFormLoadedMetricName, 0},
+ {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NAME_FULL},
+ {internal::kUKMServerTypeMetricName, CREDIT_CARD_NAME_FULL},
+ {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}}});
}
// Tests that the Autofill.QueriedCreditCardFormIsSecure histogram is logged
@@ -2428,6 +2448,9 @@ TEST_F(AutofillMetricsTest, QueriedCreditCardFormIsSecure) {
// Tests that the Autofill_PolledProfileSuggestions user action is only logged
// once if the field is queried repeatedly.
TEST_F(AutofillMetricsTest, PolledProfileSuggestions_DebounceLogs) {
+ EnableUkmLogging();
+ ukm::TestUkmService* ukm_service = autofill_client_.GetTestUkmService();
+
personal_data_->RecreateProfile();
// Set up the form data.
@@ -2478,6 +2501,21 @@ TEST_F(AutofillMetricsTest, PolledProfileSuggestions_DebounceLogs) {
gfx::RectF());
EXPECT_EQ(3, user_action_tester.GetActionCount(
"Autofill_PolledProfileSuggestions"));
+
+ VerifyFormInteractionUkm(
+ form, ukm_service, internal::kUKMPollSuggestionsEntryName,
+ {{{internal::kUKMMillisecondsSinceFormLoadedMetricName, 0},
+ {internal::kUKMHeuristicTypeMetricName, ADDRESS_HOME_STATE},
+ {internal::kUKMServerTypeMetricName, ADDRESS_HOME_STATE},
+ {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}},
+ {{internal::kUKMMillisecondsSinceFormLoadedMetricName, 0},
+ {internal::kUKMHeuristicTypeMetricName, ADDRESS_HOME_CITY},
+ {internal::kUKMServerTypeMetricName, ADDRESS_HOME_CITY},
+ {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}},
+ {{internal::kUKMMillisecondsSinceFormLoadedMetricName, 0},
+ {internal::kUKMHeuristicTypeMetricName, ADDRESS_HOME_STATE},
+ {internal::kUKMServerTypeMetricName, ADDRESS_HOME_STATE},
+ {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}}});
}
// Test that we log interacted form event for credit cards related.

Powered by Google App Engine
This is Rietveld 408576698