| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/autofill/core/browser/autofill_metrics.h" | 5 #include "components/autofill/core/browser/autofill_metrics.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 using base::Bucket; | 52 using base::Bucket; |
| 53 using base::TimeTicks; | 53 using base::TimeTicks; |
| 54 using rappor::TestRapporServiceImpl; | 54 using rappor::TestRapporServiceImpl; |
| 55 using ::testing::ElementsAre; | 55 using ::testing::ElementsAre; |
| 56 using ::testing::Matcher; | 56 using ::testing::Matcher; |
| 57 using ::testing::UnorderedPointwise; | 57 using ::testing::UnorderedPointwise; |
| 58 | 58 |
| 59 namespace autofill { | 59 namespace autofill { |
| 60 namespace { | 60 namespace { |
| 61 | 61 |
| 62 using ExpectedUkmMetrics = |
| 63 std::vector<std::vector<std::pair<const char*, int64_t>>>; |
| 64 |
| 62 class TestPersonalDataManager : public PersonalDataManager { | 65 class TestPersonalDataManager : public PersonalDataManager { |
| 63 public: | 66 public: |
| 64 TestPersonalDataManager() | 67 TestPersonalDataManager() |
| 65 : PersonalDataManager("en-US"), | 68 : PersonalDataManager("en-US"), |
| 66 autofill_enabled_(true) { | 69 autofill_enabled_(true) { |
| 67 CreateTestAutofillProfiles(&web_profiles_); | 70 CreateTestAutofillProfiles(&web_profiles_); |
| 68 } | 71 } |
| 69 | 72 |
| 70 using PersonalDataManager::set_account_tracker; | 73 using PersonalDataManager::set_account_tracker; |
| 71 using PersonalDataManager::set_signin_manager; | 74 using PersonalDataManager::set_signin_manager; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 }; | 339 }; |
| 337 | 340 |
| 338 MATCHER(CompareMetrics, "") { | 341 MATCHER(CompareMetrics, "") { |
| 339 const ukm::mojom::UkmMetric* lhs = ::testing::get<0>(arg).get(); | 342 const ukm::mojom::UkmMetric* lhs = ::testing::get<0>(arg).get(); |
| 340 const std::pair<const char*, int64_t>& rhs = ::testing::get<1>(arg); | 343 const std::pair<const char*, int64_t>& rhs = ::testing::get<1>(arg); |
| 341 return lhs->metric_hash == base::HashMetricName(rhs.first) && | 344 return lhs->metric_hash == base::HashMetricName(rhs.first) && |
| 342 lhs->value == rhs.second; | 345 lhs->value == rhs.second; |
| 343 } | 346 } |
| 344 | 347 |
| 345 void VerifyDeveloperEngagementUkm( | 348 void VerifyDeveloperEngagementUkm( |
| 349 const ukm::TestUkmRecorder& ukm_recorder, |
| 346 const FormData& form, | 350 const FormData& form, |
| 347 const ukm::TestUkmRecorder* ukm_recorder, | |
| 348 const std::vector<int64_t>& expected_metric_values) { | 351 const std::vector<int64_t>& expected_metric_values) { |
| 349 const ukm::mojom::UkmEntry* entry = ukm_recorder->GetEntryForEntryName( | 352 const ukm::mojom::UkmEntry* entry = ukm_recorder.GetEntryForEntryName( |
| 350 internal::kUKMDeveloperEngagementEntryName); | 353 internal::kUKMDeveloperEngagementEntryName); |
| 351 ASSERT_NE(nullptr, entry); | 354 ASSERT_NE(nullptr, entry); |
| 352 const ukm::UkmSource* source = | 355 const ukm::UkmSource* source = |
| 353 ukm_recorder->GetSourceForSourceId(entry->source_id); | 356 ukm_recorder.GetSourceForSourceId(entry->source_id); |
| 354 ASSERT_NE(nullptr, source); | 357 ASSERT_NE(nullptr, source); |
| 355 EXPECT_EQ(form.origin, source->url()); | 358 EXPECT_EQ(form.origin, source->url()); |
| 356 | 359 |
| 357 int expected_metric_value = 0; | 360 int expected_metric_value = 0; |
| 358 for (const auto it : expected_metric_values) | 361 for (const auto it : expected_metric_values) |
| 359 expected_metric_value |= 1 << it; | 362 expected_metric_value |= 1 << it; |
| 360 | 363 |
| 361 const std::vector<std::pair<const char*, int64_t>> expected_metrics{ | 364 const std::vector<std::pair<const char*, int64_t>> expected_metrics{ |
| 362 {internal::kUKMDeveloperEngagementMetricName, expected_metric_value}}; | 365 {internal::kUKMDeveloperEngagementMetricName, expected_metric_value}}; |
| 363 | 366 |
| 364 EXPECT_THAT(entry->metrics, | 367 EXPECT_THAT(entry->metrics, |
| 365 UnorderedPointwise(CompareMetrics(), expected_metrics)); | 368 UnorderedPointwise(CompareMetrics(), expected_metrics)); |
| 366 } | 369 } |
| 367 | 370 |
| 368 MATCHER(CompareMetricsIgnoringMillisecondsSinceFormParsed, "") { | 371 MATCHER(CompareMetricsIgnoringMillisecondsSinceFormParsed, "") { |
| 369 const ukm::mojom::UkmMetric* lhs = ::testing::get<0>(arg).get(); | 372 const ukm::mojom::UkmMetric* lhs = ::testing::get<0>(arg).get(); |
| 370 const std::pair<const char*, int64_t>& rhs = ::testing::get<1>(arg); | 373 const std::pair<const char*, int64_t>& rhs = ::testing::get<1>(arg); |
| 371 return lhs->metric_hash == base::HashMetricName(rhs.first) && | 374 return lhs->metric_hash == base::HashMetricName(rhs.first) && |
| 372 (lhs->value == rhs.second || | 375 (lhs->value == rhs.second || |
| 373 (lhs->value > 0 && | 376 (lhs->value > 0 && |
| 374 rhs.first == internal::kUKMMillisecondsSinceFormParsedMetricName)); | 377 rhs.first == internal::kUKMMillisecondsSinceFormParsedMetricName)); |
| 375 } | 378 } |
| 376 | 379 |
| 377 void VerifyFormInteractionUkm( | 380 void VerifyFormInteractionUkm(const ukm::TestUkmRecorder& ukm_recorder, |
| 378 const FormData& form, | 381 const FormData& form, |
| 379 const ukm::TestUkmRecorder* ukm_recorder, | 382 const char* event_name, |
| 380 const char* event_name, | 383 const ExpectedUkmMetrics& expected_metrics) { |
| 381 const std::vector<std::vector<std::pair<const char*, int64_t>>>& | |
| 382 expected_metrics) { | |
| 383 size_t expected_metrics_index = 0; | 384 size_t expected_metrics_index = 0; |
| 384 for (size_t i = 0; i < ukm_recorder->entries_count(); ++i) { | 385 for (size_t i = 0; i < ukm_recorder.entries_count(); ++i) { |
| 385 const ukm::mojom::UkmEntry* entry = ukm_recorder->GetEntry(i); | 386 const ukm::mojom::UkmEntry* entry = ukm_recorder.GetEntry(i); |
| 386 if (entry->event_hash != base::HashMetricName(event_name)) | 387 if (entry->event_hash != base::HashMetricName(event_name)) |
| 387 continue; | 388 continue; |
| 388 | 389 |
| 389 const ukm::UkmSource* source = | 390 const ukm::UkmSource* source = |
| 390 ukm_recorder->GetSourceForSourceId(entry->source_id); | 391 ukm_recorder.GetSourceForSourceId(entry->source_id); |
| 391 ASSERT_NE(nullptr, source); | 392 ASSERT_NE(nullptr, source); |
| 392 EXPECT_EQ(form.origin, source->url()); | 393 EXPECT_EQ(form.origin, source->url()); |
| 393 | 394 |
| 394 ASSERT_LT(expected_metrics_index, expected_metrics.size()); | 395 ASSERT_LT(expected_metrics_index, expected_metrics.size()); |
| 395 EXPECT_THAT( | 396 EXPECT_THAT( |
| 396 entry->metrics, | 397 entry->metrics, |
| 397 UnorderedPointwise(CompareMetricsIgnoringMillisecondsSinceFormParsed(), | 398 UnorderedPointwise(CompareMetricsIgnoringMillisecondsSinceFormParsed(), |
| 398 expected_metrics[expected_metrics_index++])); | 399 expected_metrics[expected_metrics_index++])); |
| 399 } | 400 } |
| 400 } | 401 } |
| 401 | 402 |
| 402 void VerifySubmitFormUkm(const FormData& form, | 403 void VerifySubmitFormUkm(const ukm::TestUkmRecorder& ukm_recorder, |
| 403 const ukm::TestUkmRecorder* ukm_recorder, | 404 const FormData& form, |
| 404 AutofillMetrics::AutofillFormSubmittedState state) { | 405 AutofillMetrics::AutofillFormSubmittedState state) { |
| 405 VerifyFormInteractionUkm( | 406 VerifyFormInteractionUkm( |
| 406 form, ukm_recorder, internal::kUKMFormSubmittedEntryName, | 407 ukm_recorder, form, internal::kUKMFormSubmittedEntryName, |
| 407 {{{internal::kUKMAutofillFormSubmittedStateMetricName, state}, | 408 {{{internal::kUKMAutofillFormSubmittedStateMetricName, state}, |
| 408 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); | 409 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); |
| 409 } | 410 } |
| 410 | 411 |
| 412 void AppendFieldFillStatusUkm(const FormData& form, |
| 413 ExpectedUkmMetrics* expected_metrics) { |
| 414 int64_t form_signature = static_cast<int64_t>(CalculateFormSignature(form)); |
| 415 int64_t metric_type = static_cast<int64_t>(AutofillMetrics::TYPE_SUBMISSION); |
| 416 for (const FormFieldData& field : form.fields) { |
| 417 int64_t field_signature = |
| 418 static_cast<int64_t>(CalculateFieldSignatureForField(field)); |
| 419 expected_metrics->push_back( |
| 420 {{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 421 {internal::kUKMFormSignatureMetricName, form_signature}, |
| 422 {internal::kUKMFieldSignatureMetricName, field_signature}, |
| 423 {internal::kUKMValidationEventMetricName, metric_type}, |
| 424 {internal::kUKMIsAutofilledMetricName, field.is_autofilled ? 1 : 0}, |
| 425 {internal::kUKMWasPreviouslyAutofilledMetricName, 0}}); |
| 426 } |
| 427 } |
| 428 |
| 429 void AppendFieldTypeUkm(const FormData& form, |
| 430 const std::vector<ServerFieldType>& heuristic_types, |
| 431 const std::vector<ServerFieldType>& server_types, |
| 432 const std::vector<ServerFieldType>& actual_types, |
| 433 ExpectedUkmMetrics* expected_metrics) { |
| 434 ASSERT_EQ(heuristic_types.size(), form.fields.size()); |
| 435 ASSERT_EQ(server_types.size(), form.fields.size()); |
| 436 ASSERT_EQ(actual_types.size(), form.fields.size()); |
| 437 int64_t form_signature = static_cast<int64_t>(CalculateFormSignature(form)); |
| 438 int64_t metric_type = static_cast<int64_t>(AutofillMetrics::TYPE_SUBMISSION); |
| 439 std::vector<int64_t> prediction_sources{ |
| 440 AutofillMetrics::PREDICTION_SOURCE_HEURISTIC, |
| 441 AutofillMetrics::PREDICTION_SOURCE_SERVER, |
| 442 AutofillMetrics::PREDICTION_SOURCE_OVERALL}; |
| 443 for (size_t i = 0; i < form.fields.size(); ++i) { |
| 444 const FormFieldData& field = form.fields[i]; |
| 445 int64_t field_signature = |
| 446 static_cast<int64_t>(CalculateFieldSignatureForField(field)); |
| 447 for (int64_t source : prediction_sources) { |
| 448 int64_t predicted_type = static_cast<int64_t>( |
| 449 (source == AutofillMetrics::PREDICTION_SOURCE_SERVER |
| 450 ? server_types |
| 451 : heuristic_types)[i]); |
| 452 int64_t actual_type = static_cast<int64_t>(actual_types[i]); |
| 453 expected_metrics->push_back( |
| 454 {{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 455 {internal::kUKMFormSignatureMetricName, form_signature}, |
| 456 {internal::kUKMFieldSignatureMetricName, field_signature}, |
| 457 {internal::kUKMValidationEventMetricName, metric_type}, |
| 458 {internal::kUKMPredictionSourceMetricName, source}, |
| 459 {internal::kUKMPredictedTypeMetricName, predicted_type}, |
| 460 {internal::kUKMActualTypeMetricName, actual_type}}); |
| 461 } |
| 462 } |
| 463 } |
| 464 |
| 411 } // namespace | 465 } // namespace |
| 412 | 466 |
| 413 // This is defined in the autofill_metrics.cc implementation file. | 467 // This is defined in the autofill_metrics.cc implementation file. |
| 414 int GetFieldTypeGroupMetric(ServerFieldType field_type, | 468 int GetFieldTypeGroupMetric(ServerFieldType field_type, |
| 415 AutofillMetrics::FieldTypeQualityMetric metric); | 469 AutofillMetrics::FieldTypeQualityMetric metric); |
| 416 | 470 |
| 417 class AutofillMetricsTest : public testing::Test { | 471 class AutofillMetricsTest : public testing::Test { |
| 418 public: | 472 public: |
| 419 ~AutofillMetricsTest() override; | 473 ~AutofillMetricsTest() override; |
| 420 | 474 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 VLOG(2) << "Test Case = Predicted: " | 856 VLOG(2) << "Test Case = Predicted: " |
| 803 << AutofillType(predicted_type).ToString() << "; " | 857 << AutofillType(predicted_type).ToString() << "; " |
| 804 << "Actual: " << AutofillType(actual_field_type).ToString(); | 858 << "Actual: " << AutofillType(actual_field_type).ToString(); |
| 805 | 859 |
| 806 // Set up our form data. | 860 // Set up our form data. |
| 807 FormData form; | 861 FormData form; |
| 808 form.name = ASCIIToUTF16("TestForm"); | 862 form.name = ASCIIToUTF16("TestForm"); |
| 809 form.origin = GURL("http://example.com/form.html"); | 863 form.origin = GURL("http://example.com/form.html"); |
| 810 form.action = GURL("http://example.com/submit.html"); | 864 form.action = GURL("http://example.com/submit.html"); |
| 811 | 865 |
| 812 std::vector<ServerFieldType> heuristic_types, server_types; | 866 std::vector<ServerFieldType> heuristic_types, server_types, actual_types; |
| 813 AutofillField field; | 867 AutofillField field; |
| 814 | 868 |
| 815 // Add a first name field, that is predicted correctly. | 869 // Add a first name field, that is predicted correctly. |
| 816 test::CreateTestFormField("first", "first", ValueForType(NAME_FIRST), "text", | 870 test::CreateTestFormField("first", "first", ValueForType(NAME_FIRST), "text", |
| 817 &field); | 871 &field); |
| 818 form.fields.push_back(field); | 872 form.fields.push_back(field); |
| 819 heuristic_types.push_back(NAME_FIRST); | 873 heuristic_types.push_back(NAME_FIRST); |
| 820 server_types.push_back(NAME_FIRST); | 874 server_types.push_back(NAME_FIRST); |
| 875 actual_types.push_back(NAME_FIRST); |
| 821 | 876 |
| 822 // Add a last name field, that is predicted correctly. | 877 // Add a last name field, that is predicted correctly. |
| 823 test::CreateTestFormField("last", "last", ValueForType(NAME_LAST), "test", | 878 test::CreateTestFormField("last", "last", ValueForType(NAME_LAST), "test", |
| 824 &field); | 879 &field); |
| 825 form.fields.push_back(field); | 880 form.fields.push_back(field); |
| 826 heuristic_types.push_back(NAME_LAST); | 881 heuristic_types.push_back(NAME_LAST); |
| 827 server_types.push_back(NAME_LAST); | 882 server_types.push_back(NAME_LAST); |
| 883 actual_types.push_back(NAME_LAST); |
| 828 | 884 |
| 829 // Add an empty or unknown field, that is predicted as per the test params. | 885 // Add an empty or unknown field, that is predicted as per the test params. |
| 830 test::CreateTestFormField("Unknown", "Unknown", | 886 test::CreateTestFormField("Unknown", "Unknown", |
| 831 ValueForType(actual_field_type), "text", &field); | 887 ValueForType(actual_field_type), "text", &field); |
| 832 form.fields.push_back(field); | 888 form.fields.push_back(field); |
| 833 heuristic_types.push_back(predicted_type); | 889 heuristic_types.push_back(predicted_type); |
| 834 server_types.push_back(predicted_type == UNKNOWN_TYPE ? NO_SERVER_DATA | 890 server_types.push_back(predicted_type == UNKNOWN_TYPE ? NO_SERVER_DATA |
| 835 : predicted_type); | 891 : predicted_type); |
| 892 // Resolve any field type ambiguity. |
| 893 if (actual_field_type == AMBIGUOUS_TYPE) { |
| 894 if (predicted_type == COMPANY_NAME || predicted_type == NAME_MIDDLE) |
| 895 actual_field_type = predicted_type; |
| 896 } |
| 897 actual_types.push_back(actual_field_type); |
| 836 | 898 |
| 837 // Simulate having seen this form on page load. | 899 // Simulate having seen this form on page load. |
| 838 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); | 900 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); |
| 839 | 901 |
| 840 // Run the form submission code while tracking the histograms. | 902 // Run the form submission code while tracking the histograms. |
| 841 base::HistogramTester histogram_tester; | 903 base::HistogramTester histogram_tester; |
| 842 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 904 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 843 | 905 |
| 844 // Resolve any field type ambiguity. | 906 ExpectedUkmMetrics expected_ukm_metrics; |
| 845 if (actual_field_type == AMBIGUOUS_TYPE) { | 907 AppendFieldTypeUkm(form, heuristic_types, server_types, actual_types, |
| 846 if (predicted_type == COMPANY_NAME || predicted_type == NAME_MIDDLE) | 908 &expected_ukm_metrics); |
| 847 actual_field_type = predicted_type; | 909 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 848 } | 910 internal::kUKMFieldTypeEntryName, |
| 911 expected_ukm_metrics); |
| 849 | 912 |
| 850 // Validate the total samples and the crossed (predicted-to-actual) samples. | 913 // Validate the total samples and the crossed (predicted-to-actual) samples. |
| 851 for (const auto& source : prediction_sources) { | 914 for (const auto& source : prediction_sources) { |
| 852 const std::string crossed_histogram = "Autofill.FieldPrediction." + source; | 915 const std::string crossed_histogram = "Autofill.FieldPrediction." + source; |
| 853 const std::string aggregate_histogram = | 916 const std::string aggregate_histogram = |
| 854 "Autofill.FieldPredictionQuality.Aggregate." + source; | 917 "Autofill.FieldPredictionQuality.Aggregate." + source; |
| 855 const std::string by_field_type_histogram = | 918 const std::string by_field_type_histogram = |
| 856 "Autofill.FieldPredictionQuality.ByFieldType." + source; | 919 "Autofill.FieldPredictionQuality.ByFieldType." + source; |
| 857 | 920 |
| 858 // Sanity Check: | 921 // Sanity Check: |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1783 | 1846 |
| 1784 // Expect the "form parsed without field type hints" metric and the | 1847 // Expect the "form parsed without field type hints" metric and the |
| 1785 // "form loaded" form interaction event to be logged. | 1848 // "form loaded" form interaction event to be logged. |
| 1786 { | 1849 { |
| 1787 autofill_manager_->OnFormsSeen(forms, TimeTicks::Now()); | 1850 autofill_manager_->OnFormsSeen(forms, TimeTicks::Now()); |
| 1788 autofill_manager_->Reset(); | 1851 autofill_manager_->Reset(); |
| 1789 | 1852 |
| 1790 ASSERT_EQ(1U, test_ukm_recorder_.entries_count()); | 1853 ASSERT_EQ(1U, test_ukm_recorder_.entries_count()); |
| 1791 ASSERT_EQ(1U, test_ukm_recorder_.sources_count()); | 1854 ASSERT_EQ(1U, test_ukm_recorder_.sources_count()); |
| 1792 VerifyDeveloperEngagementUkm( | 1855 VerifyDeveloperEngagementUkm( |
| 1793 form, &test_ukm_recorder_, | 1856 test_ukm_recorder_, form, |
| 1794 {AutofillMetrics::FILLABLE_FORM_PARSED_WITHOUT_TYPE_HINTS}); | 1857 {AutofillMetrics::FILLABLE_FORM_PARSED_WITHOUT_TYPE_HINTS}); |
| 1795 } | 1858 } |
| 1796 } | 1859 } |
| 1797 | 1860 |
| 1798 // Verify that we correctly log UKM for form parsed with type hints regarding | 1861 // Verify that we correctly log UKM for form parsed with type hints regarding |
| 1799 // developer engagement. | 1862 // developer engagement. |
| 1800 TEST_F(AutofillMetricsTest, | 1863 TEST_F(AutofillMetricsTest, |
| 1801 UkmDeveloperEngagement_LogFillableFormParsedWithTypeHints) { | 1864 UkmDeveloperEngagement_LogFillableFormParsedWithTypeHints) { |
| 1802 FormData form; | 1865 FormData form; |
| 1803 form.name = ASCIIToUTF16("TestForm"); | 1866 form.name = ASCIIToUTF16("TestForm"); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1833 | 1896 |
| 1834 // Expect the "form parsed without field type hints" metric and the | 1897 // Expect the "form parsed without field type hints" metric and the |
| 1835 // "form loaded" form interaction event to be logged. | 1898 // "form loaded" form interaction event to be logged. |
| 1836 { | 1899 { |
| 1837 autofill_manager_->OnFormsSeen(forms, TimeTicks::Now()); | 1900 autofill_manager_->OnFormsSeen(forms, TimeTicks::Now()); |
| 1838 autofill_manager_->Reset(); | 1901 autofill_manager_->Reset(); |
| 1839 | 1902 |
| 1840 ASSERT_EQ(1U, test_ukm_recorder_.entries_count()); | 1903 ASSERT_EQ(1U, test_ukm_recorder_.entries_count()); |
| 1841 ASSERT_EQ(1U, test_ukm_recorder_.sources_count()); | 1904 ASSERT_EQ(1U, test_ukm_recorder_.sources_count()); |
| 1842 VerifyDeveloperEngagementUkm( | 1905 VerifyDeveloperEngagementUkm( |
| 1843 form, &test_ukm_recorder_, | 1906 test_ukm_recorder_, form, |
| 1844 {AutofillMetrics::FILLABLE_FORM_PARSED_WITH_TYPE_HINTS}); | 1907 {AutofillMetrics::FILLABLE_FORM_PARSED_WITH_TYPE_HINTS}); |
| 1845 } | 1908 } |
| 1846 } | 1909 } |
| 1847 | 1910 |
| 1848 // Verify that we correctly log UKM for form parsed with type hints regarding | 1911 // Verify that we correctly log UKM for form parsed with type hints regarding |
| 1849 // developer engagement. | 1912 // developer engagement. |
| 1850 TEST_F(AutofillMetricsTest, UkmDeveloperEngagement_LogUpiVpaTypeHint) { | 1913 TEST_F(AutofillMetricsTest, UkmDeveloperEngagement_LogUpiVpaTypeHint) { |
| 1851 FormData form; | 1914 FormData form; |
| 1852 form.name = ASCIIToUTF16("TestForm"); | 1915 form.name = ASCIIToUTF16("TestForm"); |
| 1853 form.origin = GURL("http://example.com/form.html"); | 1916 form.origin = GURL("http://example.com/form.html"); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1865 std::vector<FormData> forms(1, form); | 1928 std::vector<FormData> forms(1, form); |
| 1866 | 1929 |
| 1867 // Expect the "upi-vpa hint" metric to be logged and the "form loaded" form | 1930 // Expect the "upi-vpa hint" metric to be logged and the "form loaded" form |
| 1868 // interaction event to be logged. | 1931 // interaction event to be logged. |
| 1869 { | 1932 { |
| 1870 autofill_manager_->OnFormsSeen(forms, TimeTicks::Now()); | 1933 autofill_manager_->OnFormsSeen(forms, TimeTicks::Now()); |
| 1871 autofill_manager_->Reset(); | 1934 autofill_manager_->Reset(); |
| 1872 | 1935 |
| 1873 ASSERT_EQ(1U, test_ukm_recorder_.entries_count()); | 1936 ASSERT_EQ(1U, test_ukm_recorder_.entries_count()); |
| 1874 ASSERT_EQ(1U, test_ukm_recorder_.sources_count()); | 1937 ASSERT_EQ(1U, test_ukm_recorder_.sources_count()); |
| 1875 VerifyDeveloperEngagementUkm(form, &test_ukm_recorder_, | 1938 VerifyDeveloperEngagementUkm(test_ukm_recorder_, form, |
| 1876 {AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT}); | 1939 {AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT}); |
| 1877 test_ukm_recorder_.Purge(); | 1940 test_ukm_recorder_.Purge(); |
| 1878 } | 1941 } |
| 1879 | 1942 |
| 1880 // Add another field with an author-specified field type to the form. | 1943 // Add another field with an author-specified field type to the form. |
| 1881 test::CreateTestFormField("", "", "", "text", &field); | 1944 test::CreateTestFormField("", "", "", "text", &field); |
| 1882 field.autocomplete_attribute = "address-line1"; | 1945 field.autocomplete_attribute = "address-line1"; |
| 1883 forms.back().fields.push_back(field); | 1946 forms.back().fields.push_back(field); |
| 1884 | 1947 |
| 1885 { | 1948 { |
| 1886 autofill_manager_->OnFormsSeen(forms, TimeTicks::Now()); | 1949 autofill_manager_->OnFormsSeen(forms, TimeTicks::Now()); |
| 1887 autofill_manager_->Reset(); | 1950 autofill_manager_->Reset(); |
| 1888 | 1951 |
| 1889 VerifyDeveloperEngagementUkm( | 1952 VerifyDeveloperEngagementUkm( |
| 1890 form, &test_ukm_recorder_, | 1953 test_ukm_recorder_, form, |
| 1891 {AutofillMetrics::FILLABLE_FORM_PARSED_WITH_TYPE_HINTS, | 1954 {AutofillMetrics::FILLABLE_FORM_PARSED_WITH_TYPE_HINTS, |
| 1892 AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT}); | 1955 AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT}); |
| 1893 } | 1956 } |
| 1894 } | 1957 } |
| 1895 | 1958 |
| 1896 // Test that the profile count is logged correctly. | 1959 // Test that the profile count is logged correctly. |
| 1897 TEST_F(AutofillMetricsTest, StoredProfileCount) { | 1960 TEST_F(AutofillMetricsTest, StoredProfileCount) { |
| 1898 // The metric should be logged when the profiles are first loaded. | 1961 // The metric should be logged when the profiles are first loaded. |
| 1899 { | 1962 { |
| 1900 base::HistogramTester histogram_tester; | 1963 base::HistogramTester histogram_tester; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2153 base::UserActionTester user_action_tester; | 2216 base::UserActionTester user_action_tester; |
| 2154 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 2217 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); |
| 2155 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 2218 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 2156 EXPECT_EQ(1, | 2219 EXPECT_EQ(1, |
| 2157 user_action_tester.GetActionCount("Autofill_OnWillSubmitForm")); | 2220 user_action_tester.GetActionCount("Autofill_OnWillSubmitForm")); |
| 2158 EXPECT_EQ(1, user_action_tester.GetActionCount( | 2221 EXPECT_EQ(1, user_action_tester.GetActionCount( |
| 2159 "Autofill_FormSubmitted_NonFillable")); | 2222 "Autofill_FormSubmitted_NonFillable")); |
| 2160 } | 2223 } |
| 2161 | 2224 |
| 2162 VerifyFormInteractionUkm( | 2225 VerifyFormInteractionUkm( |
| 2163 form, &test_ukm_recorder_, internal::kUKMSuggestionsShownEntryName, | 2226 test_ukm_recorder_, form, internal::kUKMSuggestionsShownEntryName, |
| 2164 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, | 2227 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 2165 {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NAME_FULL}, | 2228 {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NAME_FULL}, |
| 2166 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, | 2229 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, |
| 2167 {internal::kUKMServerTypeMetricName, CREDIT_CARD_NAME_FULL}}, | 2230 {internal::kUKMServerTypeMetricName, CREDIT_CARD_NAME_FULL}}, |
| 2168 {{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, | 2231 {{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 2169 {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NUMBER}, | 2232 {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NUMBER}, |
| 2170 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, | 2233 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, |
| 2171 {internal::kUKMServerTypeMetricName, CREDIT_CARD_NUMBER}}}); | 2234 {internal::kUKMServerTypeMetricName, CREDIT_CARD_NUMBER}}}); |
| 2172 // Expect 2 |FORM_EVENT_LOCAL_SUGGESTION_FILLED| events. First, from | 2235 // Expect 2 |FORM_EVENT_LOCAL_SUGGESTION_FILLED| events. First, from |
| 2173 // call to |external_delegate_->DidAcceptSuggestion|. Second, from call to | 2236 // call to |external_delegate_->DidAcceptSuggestion|. Second, from call to |
| 2174 // |autofill_manager_->FillOrPreviewForm|. | 2237 // |autofill_manager_->FillOrPreviewForm|. |
| 2175 VerifyFormInteractionUkm( | 2238 VerifyFormInteractionUkm( |
| 2176 form, &test_ukm_recorder_, internal::kUKMSuggestionFilledEntryName, | 2239 test_ukm_recorder_, form, internal::kUKMSuggestionFilledEntryName, |
| 2177 {{{internal::kUKMRecordTypeMetricName, CreditCard::LOCAL_CARD}, | 2240 {{{internal::kUKMRecordTypeMetricName, CreditCard::LOCAL_CARD}, |
| 2178 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}, | 2241 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}, |
| 2179 {{internal::kUKMRecordTypeMetricName, CreditCard::LOCAL_CARD}, | 2242 {{internal::kUKMRecordTypeMetricName, CreditCard::LOCAL_CARD}, |
| 2180 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); | 2243 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); |
| 2181 // Expect |NON_FILLABLE_FORM_OR_NEW_DATA| in |AutofillFormSubmittedState| | 2244 // Expect |NON_FILLABLE_FORM_OR_NEW_DATA| in |AutofillFormSubmittedState| |
| 2182 // because |field.value| is empty in |DeterminePossibleFieldTypesForUpload|. | 2245 // because |field.value| is empty in |DeterminePossibleFieldTypesForUpload|. |
| 2183 VerifySubmitFormUkm(form, &test_ukm_recorder_, | 2246 VerifySubmitFormUkm(test_ukm_recorder_, form, |
| 2184 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); | 2247 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); |
| 2185 } | 2248 } |
| 2186 | 2249 |
| 2187 // Test that the profile checkout flow user actions are correctly logged. | 2250 // Test that the profile checkout flow user actions are correctly logged. |
| 2188 TEST_F(AutofillMetricsTest, ProfileCheckoutFlowUserActions) { | 2251 TEST_F(AutofillMetricsTest, ProfileCheckoutFlowUserActions) { |
| 2189 // Create a profile. | 2252 // Create a profile. |
| 2190 personal_data_->RecreateProfile(); | 2253 personal_data_->RecreateProfile(); |
| 2191 | 2254 |
| 2192 // Set up our form data. | 2255 // Set up our form data. |
| 2193 FormData form; | 2256 FormData form; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2264 base::UserActionTester user_action_tester; | 2327 base::UserActionTester user_action_tester; |
| 2265 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 2328 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); |
| 2266 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 2329 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 2267 EXPECT_EQ(1, | 2330 EXPECT_EQ(1, |
| 2268 user_action_tester.GetActionCount("Autofill_OnWillSubmitForm")); | 2331 user_action_tester.GetActionCount("Autofill_OnWillSubmitForm")); |
| 2269 EXPECT_EQ(1, user_action_tester.GetActionCount( | 2332 EXPECT_EQ(1, user_action_tester.GetActionCount( |
| 2270 "Autofill_FormSubmitted_NonFillable")); | 2333 "Autofill_FormSubmitted_NonFillable")); |
| 2271 } | 2334 } |
| 2272 | 2335 |
| 2273 VerifyFormInteractionUkm( | 2336 VerifyFormInteractionUkm( |
| 2274 form, &test_ukm_recorder_, internal::kUKMSuggestionsShownEntryName, | 2337 test_ukm_recorder_, form, internal::kUKMSuggestionsShownEntryName, |
| 2275 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, | 2338 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 2276 {internal::kUKMHeuristicTypeMetricName, ADDRESS_HOME_STATE}, | 2339 {internal::kUKMHeuristicTypeMetricName, ADDRESS_HOME_STATE}, |
| 2277 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, | 2340 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, |
| 2278 {internal::kUKMServerTypeMetricName, ADDRESS_HOME_STATE}}, | 2341 {internal::kUKMServerTypeMetricName, ADDRESS_HOME_STATE}}, |
| 2279 {{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, | 2342 {{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 2280 {internal::kUKMHeuristicTypeMetricName, ADDRESS_HOME_CITY}, | 2343 {internal::kUKMHeuristicTypeMetricName, ADDRESS_HOME_CITY}, |
| 2281 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, | 2344 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, |
| 2282 {internal::kUKMServerTypeMetricName, ADDRESS_HOME_CITY}}}); | 2345 {internal::kUKMServerTypeMetricName, ADDRESS_HOME_CITY}}}); |
| 2283 // Expect 2 |FORM_EVENT_LOCAL_SUGGESTION_FILLED| events. First, from | 2346 // Expect 2 |FORM_EVENT_LOCAL_SUGGESTION_FILLED| events. First, from |
| 2284 // call to |external_delegate_->DidAcceptSuggestion|. Second, from call to | 2347 // call to |external_delegate_->DidAcceptSuggestion|. Second, from call to |
| 2285 // |autofill_manager_->FillOrPreviewForm|. | 2348 // |autofill_manager_->FillOrPreviewForm|. |
| 2286 VerifyFormInteractionUkm( | 2349 VerifyFormInteractionUkm( |
| 2287 form, &test_ukm_recorder_, internal::kUKMSuggestionFilledEntryName, | 2350 test_ukm_recorder_, form, internal::kUKMSuggestionFilledEntryName, |
| 2288 {{{internal::kUKMRecordTypeMetricName, AutofillProfile::LOCAL_PROFILE}, | 2351 {{{internal::kUKMRecordTypeMetricName, AutofillProfile::LOCAL_PROFILE}, |
| 2289 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}, | 2352 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}, |
| 2290 {{internal::kUKMRecordTypeMetricName, AutofillProfile::LOCAL_PROFILE}, | 2353 {{internal::kUKMRecordTypeMetricName, AutofillProfile::LOCAL_PROFILE}, |
| 2291 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); | 2354 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); |
| 2292 // Expect |NON_FILLABLE_FORM_OR_NEW_DATA| in |AutofillFormSubmittedState| | 2355 // Expect |NON_FILLABLE_FORM_OR_NEW_DATA| in |AutofillFormSubmittedState| |
| 2293 // because |field.value| is empty in |DeterminePossibleFieldTypesForUpload|. | 2356 // because |field.value| is empty in |DeterminePossibleFieldTypesForUpload|. |
| 2294 VerifySubmitFormUkm(form, &test_ukm_recorder_, | 2357 VerifySubmitFormUkm(test_ukm_recorder_, form, |
| 2295 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); | 2358 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); |
| 2296 } | 2359 } |
| 2297 | 2360 |
| 2298 // Tests that the Autofill_PolledCreditCardSuggestions user action is only | 2361 // Tests that the Autofill_PolledCreditCardSuggestions user action is only |
| 2299 // logged once if the field is queried repeatedly. | 2362 // logged once if the field is queried repeatedly. |
| 2300 TEST_F(AutofillMetricsTest, PolledCreditCardSuggestions_DebounceLogs) { | 2363 TEST_F(AutofillMetricsTest, PolledCreditCardSuggestions_DebounceLogs) { |
| 2301 personal_data_->RecreateCreditCards( | 2364 personal_data_->RecreateCreditCards( |
| 2302 true /* include_local_credit_card */, | 2365 true /* include_local_credit_card */, |
| 2303 false /* include_masked_server_credit_card */, | 2366 false /* include_masked_server_credit_card */, |
| 2304 false /* include_full_server_credit_card */); | 2367 false /* include_full_server_credit_card */); |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2995 base::HistogramTester histogram_tester; | 3058 base::HistogramTester histogram_tester; |
| 2996 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 3059 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); |
| 2997 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 3060 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 2998 histogram_tester.ExpectBucketCount( | 3061 histogram_tester.ExpectBucketCount( |
| 2999 "Autofill.FormEvents.CreditCard", | 3062 "Autofill.FormEvents.CreditCard", |
| 3000 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); | 3063 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); |
| 3001 histogram_tester.ExpectBucketCount( | 3064 histogram_tester.ExpectBucketCount( |
| 3002 "Autofill.FormEvents.CreditCard", | 3065 "Autofill.FormEvents.CreditCard", |
| 3003 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); | 3066 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); |
| 3004 | 3067 |
| 3005 VerifySubmitFormUkm(form, &test_ukm_recorder_, | 3068 VerifySubmitFormUkm(test_ukm_recorder_, form, |
| 3006 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); | 3069 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); |
| 3007 } | 3070 } |
| 3008 | 3071 |
| 3009 // Reset the autofill manager state and purge UKM logs. | 3072 // Reset the autofill manager state and purge UKM logs. |
| 3010 autofill_manager_->Reset(); | 3073 autofill_manager_->Reset(); |
| 3011 test_ukm_recorder_.Purge(); | 3074 test_ukm_recorder_.Purge(); |
| 3012 | 3075 |
| 3013 autofill_manager_->AddSeenForm(form, field_types, field_types); | 3076 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 3014 | 3077 |
| 3015 { | 3078 { |
| 3016 // Simulating submission with suggestion shown. | 3079 // Simulating submission with suggestion shown. |
| 3017 base::HistogramTester histogram_tester; | 3080 base::HistogramTester histogram_tester; |
| 3018 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 3081 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); |
| 3019 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 3082 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); |
| 3020 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 3083 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 3021 histogram_tester.ExpectBucketCount( | 3084 histogram_tester.ExpectBucketCount( |
| 3022 "Autofill.FormEvents.CreditCard", | 3085 "Autofill.FormEvents.CreditCard", |
| 3023 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 1); | 3086 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 1); |
| 3024 histogram_tester.ExpectBucketCount( | 3087 histogram_tester.ExpectBucketCount( |
| 3025 "Autofill.FormEvents.CreditCard", | 3088 "Autofill.FormEvents.CreditCard", |
| 3026 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 1); | 3089 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 1); |
| 3027 | 3090 |
| 3028 VerifyFormInteractionUkm( | 3091 VerifyFormInteractionUkm( |
| 3029 form, &test_ukm_recorder_, internal::kUKMSuggestionsShownEntryName, | 3092 test_ukm_recorder_, form, internal::kUKMSuggestionsShownEntryName, |
| 3030 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, | 3093 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 3031 {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NUMBER}, | 3094 {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NUMBER}, |
| 3032 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, | 3095 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, |
| 3033 {internal::kUKMServerTypeMetricName, CREDIT_CARD_NUMBER}}}); | 3096 {internal::kUKMServerTypeMetricName, CREDIT_CARD_NUMBER}}}); |
| 3034 VerifySubmitFormUkm(form, &test_ukm_recorder_, | 3097 VerifySubmitFormUkm(test_ukm_recorder_, form, |
| 3035 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); | 3098 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); |
| 3036 } | 3099 } |
| 3037 | 3100 |
| 3038 // Reset the autofill manager state and purge UKM logs. | 3101 // Reset the autofill manager state and purge UKM logs. |
| 3039 autofill_manager_->Reset(); | 3102 autofill_manager_->Reset(); |
| 3040 test_ukm_recorder_.Purge(); | 3103 test_ukm_recorder_.Purge(); |
| 3041 | 3104 |
| 3042 autofill_manager_->AddSeenForm(form, field_types, field_types); | 3105 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 3043 | 3106 |
| 3044 { | 3107 { |
| 3045 // Simulating submission with filled local data. | 3108 // Simulating submission with filled local data. |
| 3046 base::HistogramTester histogram_tester; | 3109 base::HistogramTester histogram_tester; |
| 3047 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 3110 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); |
| 3048 std::string guid("10000000-0000-0000-0000-000000000001"); // local card | 3111 std::string guid("10000000-0000-0000-0000-000000000001"); // local card |
| 3049 autofill_manager_->FillOrPreviewForm( | 3112 autofill_manager_->FillOrPreviewForm( |
| 3050 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), | 3113 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), |
| 3051 autofill_manager_->MakeFrontendID(guid, std::string())); | 3114 autofill_manager_->MakeFrontendID(guid, std::string())); |
| 3052 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 3115 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 3053 histogram_tester.ExpectBucketCount( | 3116 histogram_tester.ExpectBucketCount( |
| 3054 "Autofill.FormEvents.CreditCard", | 3117 "Autofill.FormEvents.CreditCard", |
| 3055 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 1); | 3118 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 1); |
| 3056 histogram_tester.ExpectBucketCount( | 3119 histogram_tester.ExpectBucketCount( |
| 3057 "Autofill.FormEvents.CreditCard", | 3120 "Autofill.FormEvents.CreditCard", |
| 3058 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 1); | 3121 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 1); |
| 3059 | 3122 |
| 3060 VerifyFormInteractionUkm( | 3123 VerifyFormInteractionUkm( |
| 3061 form, &test_ukm_recorder_, internal::kUKMSuggestionFilledEntryName, | 3124 test_ukm_recorder_, form, internal::kUKMSuggestionFilledEntryName, |
| 3062 {{{internal::kUKMRecordTypeMetricName, CreditCard::LOCAL_CARD}, | 3125 {{{internal::kUKMRecordTypeMetricName, CreditCard::LOCAL_CARD}, |
| 3063 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); | 3126 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); |
| 3064 VerifySubmitFormUkm(form, &test_ukm_recorder_, | 3127 VerifySubmitFormUkm(test_ukm_recorder_, form, |
| 3065 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); | 3128 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); |
| 3066 } | 3129 } |
| 3067 | 3130 |
| 3068 // Reset the autofill manager state and purge UKM logs. | 3131 // Reset the autofill manager state and purge UKM logs. |
| 3069 autofill_manager_->Reset(); | 3132 autofill_manager_->Reset(); |
| 3070 test_ukm_recorder_.Purge(); | 3133 test_ukm_recorder_.Purge(); |
| 3071 | 3134 |
| 3072 autofill_manager_->AddSeenForm(form, field_types, field_types); | 3135 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 3073 | 3136 |
| 3074 { | 3137 { |
| 3075 // Simulating submission with filled server data. | 3138 // Simulating submission with filled server data. |
| 3076 base::HistogramTester histogram_tester; | 3139 base::HistogramTester histogram_tester; |
| 3077 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 3140 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); |
| 3078 std::string guid( | 3141 std::string guid( |
| 3079 "10000000-0000-0000-0000-000000000003"); // full server card | 3142 "10000000-0000-0000-0000-000000000003"); // full server card |
| 3080 autofill_manager_->FillOrPreviewForm( | 3143 autofill_manager_->FillOrPreviewForm( |
| 3081 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), | 3144 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), |
| 3082 autofill_manager_->MakeFrontendID(guid, std::string())); | 3145 autofill_manager_->MakeFrontendID(guid, std::string())); |
| 3083 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 3146 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 3084 histogram_tester.ExpectBucketCount( | 3147 histogram_tester.ExpectBucketCount( |
| 3085 "Autofill.FormEvents.CreditCard", | 3148 "Autofill.FormEvents.CreditCard", |
| 3086 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 1); | 3149 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 1); |
| 3087 histogram_tester.ExpectBucketCount( | 3150 histogram_tester.ExpectBucketCount( |
| 3088 "Autofill.FormEvents.CreditCard", | 3151 "Autofill.FormEvents.CreditCard", |
| 3089 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 1); | 3152 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 1); |
| 3090 | 3153 |
| 3091 VerifyFormInteractionUkm( | 3154 VerifyFormInteractionUkm( |
| 3092 form, &test_ukm_recorder_, internal::kUKMSuggestionFilledEntryName, | 3155 test_ukm_recorder_, form, internal::kUKMSuggestionFilledEntryName, |
| 3093 {{{internal::kUKMRecordTypeMetricName, CreditCard::FULL_SERVER_CARD}, | 3156 {{{internal::kUKMRecordTypeMetricName, CreditCard::FULL_SERVER_CARD}, |
| 3094 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); | 3157 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); |
| 3095 VerifySubmitFormUkm(form, &test_ukm_recorder_, | 3158 VerifySubmitFormUkm(test_ukm_recorder_, form, |
| 3096 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); | 3159 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); |
| 3097 } | 3160 } |
| 3098 | 3161 |
| 3099 // Reset the autofill manager state and purge UKM logs. | 3162 // Reset the autofill manager state and purge UKM logs. |
| 3100 autofill_manager_->Reset(); | 3163 autofill_manager_->Reset(); |
| 3101 test_ukm_recorder_.Purge(); | 3164 test_ukm_recorder_.Purge(); |
| 3102 | 3165 |
| 3103 autofill_manager_->AddSeenForm(form, field_types, field_types); | 3166 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 3104 | 3167 |
| 3105 { | 3168 { |
| 3106 // Simulating submission with a masked card server suggestion. | 3169 // Simulating submission with a masked card server suggestion. |
| 3107 base::HistogramTester histogram_tester; | 3170 base::HistogramTester histogram_tester; |
| 3108 std::string guid( | 3171 std::string guid( |
| 3109 "10000000-0000-0000-0000-000000000002"); // masked server card | 3172 "10000000-0000-0000-0000-000000000002"); // masked server card |
| 3110 autofill_manager_->FillOrPreviewForm( | 3173 autofill_manager_->FillOrPreviewForm( |
| 3111 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.back(), | 3174 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.back(), |
| 3112 autofill_manager_->MakeFrontendID(guid, std::string())); | 3175 autofill_manager_->MakeFrontendID(guid, std::string())); |
| 3113 autofill_manager_->OnDidGetRealPan(AutofillClient::SUCCESS, | 3176 autofill_manager_->OnDidGetRealPan(AutofillClient::SUCCESS, |
| 3114 "6011000990139424"); | 3177 "6011000990139424"); |
| 3115 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 3178 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 3116 histogram_tester.ExpectBucketCount( | 3179 histogram_tester.ExpectBucketCount( |
| 3117 "Autofill.FormEvents.CreditCard", | 3180 "Autofill.FormEvents.CreditCard", |
| 3118 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED, 1); | 3181 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED, 1); |
| 3119 histogram_tester.ExpectBucketCount( | 3182 histogram_tester.ExpectBucketCount( |
| 3120 "Autofill.FormEvents.CreditCard", | 3183 "Autofill.FormEvents.CreditCard", |
| 3121 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED_ONCE, | 3184 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED_ONCE, |
| 3122 1); | 3185 1); |
| 3123 | 3186 |
| 3124 VerifyFormInteractionUkm( | 3187 VerifyFormInteractionUkm( |
| 3125 form, &test_ukm_recorder_, internal::kUKMSuggestionFilledEntryName, | 3188 test_ukm_recorder_, form, internal::kUKMSuggestionFilledEntryName, |
| 3126 {{{internal::kUKMRecordTypeMetricName, CreditCard::MASKED_SERVER_CARD}, | 3189 {{{internal::kUKMRecordTypeMetricName, CreditCard::MASKED_SERVER_CARD}, |
| 3127 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); | 3190 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); |
| 3128 VerifyFormInteractionUkm( | 3191 VerifyFormInteractionUkm( |
| 3129 form, &test_ukm_recorder_, | 3192 test_ukm_recorder_, form, |
| 3130 internal::kUKMSelectedMaskedServerCardEntryName, | 3193 internal::kUKMSelectedMaskedServerCardEntryName, |
| 3131 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); | 3194 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); |
| 3132 VerifySubmitFormUkm(form, &test_ukm_recorder_, | 3195 VerifySubmitFormUkm(test_ukm_recorder_, form, |
| 3133 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); | 3196 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); |
| 3134 } | 3197 } |
| 3135 | 3198 |
| 3136 // Reset the autofill manager state and purge UKM logs. | 3199 // Reset the autofill manager state and purge UKM logs. |
| 3137 autofill_manager_->Reset(); | 3200 autofill_manager_->Reset(); |
| 3138 test_ukm_recorder_.Purge(); | 3201 test_ukm_recorder_.Purge(); |
| 3139 | 3202 |
| 3140 // Recreating cards as the previous test should have upgraded the masked | 3203 // Recreating cards as the previous test should have upgraded the masked |
| 3141 // card to a full card. | 3204 // card to a full card. |
| 3142 personal_data_->RecreateCreditCards( | 3205 personal_data_->RecreateCreditCards( |
| 3143 true /* include_local_credit_card */, | 3206 true /* include_local_credit_card */, |
| 3144 true /* include_masked_server_credit_card */, | 3207 true /* include_masked_server_credit_card */, |
| 3145 true /* include_full_server_credit_card */); | 3208 true /* include_full_server_credit_card */); |
| 3146 | 3209 |
| 3147 // Reset the autofill manager state. | 3210 // Reset the autofill manager state. |
| 3148 autofill_manager_->Reset(); | 3211 autofill_manager_->Reset(); |
| 3149 autofill_manager_->AddSeenForm(form, field_types, field_types); | 3212 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 3150 | 3213 |
| 3151 { | 3214 { |
| 3152 // Simulating multiple submissions. | 3215 // Simulating multiple submissions. |
| 3153 base::HistogramTester histogram_tester; | 3216 base::HistogramTester histogram_tester; |
| 3154 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 3217 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); |
| 3155 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 3218 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 3156 | 3219 |
| 3157 VerifyFormInteractionUkm( | 3220 VerifyFormInteractionUkm( |
| 3158 form, &test_ukm_recorder_, internal::kUKMFormSubmittedEntryName, | 3221 test_ukm_recorder_, form, internal::kUKMFormSubmittedEntryName, |
| 3159 {{{internal::kUKMAutofillFormSubmittedStateMetricName, | 3222 {{{internal::kUKMAutofillFormSubmittedStateMetricName, |
| 3160 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, | 3223 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, |
| 3161 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); | 3224 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); |
| 3162 | 3225 |
| 3163 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 3226 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 3164 | 3227 |
| 3165 VerifyFormInteractionUkm( | 3228 VerifyFormInteractionUkm( |
| 3166 form, &test_ukm_recorder_, internal::kUKMFormSubmittedEntryName, | 3229 test_ukm_recorder_, form, internal::kUKMFormSubmittedEntryName, |
| 3167 {{{internal::kUKMAutofillFormSubmittedStateMetricName, | 3230 {{{internal::kUKMAutofillFormSubmittedStateMetricName, |
| 3168 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, | 3231 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, |
| 3169 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}, | 3232 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}, |
| 3170 {{internal::kUKMAutofillFormSubmittedStateMetricName, | 3233 {{internal::kUKMAutofillFormSubmittedStateMetricName, |
| 3171 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, | 3234 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, |
| 3172 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); | 3235 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); |
| 3173 | 3236 |
| 3174 histogram_tester.ExpectBucketCount( | 3237 histogram_tester.ExpectBucketCount( |
| 3175 "Autofill.FormEvents.CreditCard", | 3238 "Autofill.FormEvents.CreditCard", |
| 3176 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); | 3239 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3248 histogram_tester.ExpectBucketCount( | 3311 histogram_tester.ExpectBucketCount( |
| 3249 "Autofill.FormEvents.CreditCard", | 3312 "Autofill.FormEvents.CreditCard", |
| 3250 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 3313 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); |
| 3251 histogram_tester.ExpectBucketCount( | 3314 histogram_tester.ExpectBucketCount( |
| 3252 "Autofill.FormEvents.CreditCard", | 3315 "Autofill.FormEvents.CreditCard", |
| 3253 AutofillMetrics:: | 3316 AutofillMetrics:: |
| 3254 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE, | 3317 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE, |
| 3255 0); | 3318 0); |
| 3256 | 3319 |
| 3257 VerifyFormInteractionUkm( | 3320 VerifyFormInteractionUkm( |
| 3258 form, &test_ukm_recorder_, internal::kUKMSuggestionsShownEntryName, | 3321 test_ukm_recorder_, form, internal::kUKMSuggestionsShownEntryName, |
| 3259 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, | 3322 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 3260 {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NUMBER}, | 3323 {internal::kUKMHeuristicTypeMetricName, CREDIT_CARD_NUMBER}, |
| 3261 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, | 3324 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, |
| 3262 {internal::kUKMServerTypeMetricName, CREDIT_CARD_NUMBER}}}); | 3325 {internal::kUKMServerTypeMetricName, CREDIT_CARD_NUMBER}}}); |
| 3263 VerifySubmitFormUkm(form, &test_ukm_recorder_, | 3326 VerifySubmitFormUkm(test_ukm_recorder_, form, |
| 3264 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); | 3327 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); |
| 3265 } | 3328 } |
| 3266 } | 3329 } |
| 3267 | 3330 |
| 3268 // Test that we log "will submit" (but not submitted) form events for credit | 3331 // Test that we log "will submit" (but not submitted) form events for credit |
| 3269 // cards. Mirrors CreditCardSubmittedFormEvents test but does not expect any | 3332 // cards. Mirrors CreditCardSubmittedFormEvents test but does not expect any |
| 3270 // "submitted" metrics. | 3333 // "submitted" metrics. |
| 3271 TEST_F(AutofillMetricsTest, CreditCardWillSubmitFormEvents) { | 3334 TEST_F(AutofillMetricsTest, CreditCardWillSubmitFormEvents) { |
| 3272 EnableWalletSync(); | 3335 EnableWalletSync(); |
| 3273 // Creating all kinds of cards. | 3336 // Creating all kinds of cards. |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3728 base::HistogramTester histogram_tester; | 3791 base::HistogramTester histogram_tester; |
| 3729 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 3792 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); |
| 3730 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 3793 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 3731 histogram_tester.ExpectBucketCount( | 3794 histogram_tester.ExpectBucketCount( |
| 3732 "Autofill.FormEvents.Address", | 3795 "Autofill.FormEvents.Address", |
| 3733 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); | 3796 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); |
| 3734 histogram_tester.ExpectBucketCount( | 3797 histogram_tester.ExpectBucketCount( |
| 3735 "Autofill.FormEvents.Address", | 3798 "Autofill.FormEvents.Address", |
| 3736 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); | 3799 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); |
| 3737 | 3800 |
| 3738 VerifySubmitFormUkm(form, &test_ukm_recorder_, | 3801 VerifySubmitFormUkm(test_ukm_recorder_, form, |
| 3739 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); | 3802 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA); |
| 3740 } | 3803 } |
| 3741 | 3804 |
| 3742 // Reset the autofill manager state and purge UKM logs. | 3805 // Reset the autofill manager state and purge UKM logs. |
| 3743 autofill_manager_->Reset(); | 3806 autofill_manager_->Reset(); |
| 3744 test_ukm_recorder_.Purge(); | 3807 test_ukm_recorder_.Purge(); |
| 3745 | 3808 |
| 3746 autofill_manager_->AddSeenForm(form, field_types, field_types); | 3809 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 3747 | 3810 |
| 3748 { | 3811 { |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4251 form.fields.push_back(field); | 4314 form.fields.push_back(field); |
| 4252 test::CreateTestFormField("Unknown", "unknown", "", "text", &field); | 4315 test::CreateTestFormField("Unknown", "unknown", "", "text", &field); |
| 4253 form.fields.push_back(field); | 4316 form.fields.push_back(field); |
| 4254 std::vector<FormData> forms(1, form); | 4317 std::vector<FormData> forms(1, form); |
| 4255 | 4318 |
| 4256 // Expect no notifications when the form is first seen. | 4319 // Expect no notifications when the form is first seen. |
| 4257 { | 4320 { |
| 4258 base::HistogramTester histogram_tester; | 4321 base::HistogramTester histogram_tester; |
| 4259 autofill_manager_->OnFormsSeen(forms, TimeTicks::Now()); | 4322 autofill_manager_->OnFormsSeen(forms, TimeTicks::Now()); |
| 4260 histogram_tester.ExpectTotalCount("Autofill.FormSubmittedState", 0); | 4323 histogram_tester.ExpectTotalCount("Autofill.FormSubmittedState", 0); |
| 4324 |
| 4325 EXPECT_EQ(1U, test_ukm_recorder_.entries_count()); |
| 4326 EXPECT_EQ(1U, test_ukm_recorder_.sources_count()); |
| 4327 |
| 4328 VerifyDeveloperEngagementUkm( |
| 4329 test_ukm_recorder_, form, |
| 4330 {AutofillMetrics::FILLABLE_FORM_PARSED_WITHOUT_TYPE_HINTS}); |
| 4261 } | 4331 } |
| 4262 | 4332 |
| 4263 std::vector<std::vector<std::pair<const char*, int64_t>>> | 4333 ExpectedUkmMetrics expected_form_submission_ukm_metrics; |
| 4264 expected_form_submission_ukm_metrics = { | 4334 ExpectedUkmMetrics expected_field_fill_status_ukm_metrics; |
| 4265 {{internal::kUKMAutofillFormSubmittedStateMetricName, | |
| 4266 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, | |
| 4267 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}; | |
| 4268 | 4335 |
| 4269 // No data entered in the form. | 4336 // No data entered in the form. |
| 4270 { | 4337 { |
| 4271 base::HistogramTester histogram_tester; | 4338 base::HistogramTester histogram_tester; |
| 4272 base::UserActionTester user_action_tester; | 4339 base::UserActionTester user_action_tester; |
| 4273 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 4340 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 4274 histogram_tester.ExpectUniqueSample( | 4341 histogram_tester.ExpectUniqueSample( |
| 4275 "Autofill.FormSubmittedState", | 4342 "Autofill.FormSubmittedState", |
| 4276 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA, 1); | 4343 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA, 1); |
| 4277 EXPECT_EQ(1, user_action_tester.GetActionCount( | 4344 EXPECT_EQ(1, user_action_tester.GetActionCount( |
| 4278 "Autofill_FormSubmitted_NonFillable")); | 4345 "Autofill_FormSubmitted_NonFillable")); |
| 4279 | 4346 |
| 4280 // Expect an entry for |DeveloperEngagement| and an entry for form | 4347 expected_form_submission_ukm_metrics.push_back( |
| 4281 // interactions. Both entries are for the same URL. | 4348 {{internal::kUKMAutofillFormSubmittedStateMetricName, |
| 4282 ASSERT_EQ(2U, test_ukm_recorder_.entries_count()); | 4349 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, |
| 4283 ASSERT_EQ(2U, test_ukm_recorder_.sources_count()); | 4350 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); |
| 4284 VerifyDeveloperEngagementUkm( | 4351 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4285 form, &test_ukm_recorder_, | |
| 4286 {AutofillMetrics::FILLABLE_FORM_PARSED_WITHOUT_TYPE_HINTS}); | |
| 4287 VerifyFormInteractionUkm(form, &test_ukm_recorder_, | |
| 4288 internal::kUKMFormSubmittedEntryName, | 4352 internal::kUKMFormSubmittedEntryName, |
| 4289 expected_form_submission_ukm_metrics); | 4353 expected_form_submission_ukm_metrics); |
| 4354 |
| 4355 AppendFieldFillStatusUkm(form, &expected_field_fill_status_ukm_metrics); |
| 4356 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4357 internal::kUKMFieldFillStatusEntryName, |
| 4358 expected_field_fill_status_ukm_metrics); |
| 4290 } | 4359 } |
| 4291 | 4360 |
| 4292 // Non fillable form. | 4361 // Non fillable form. |
| 4293 form.fields[0].value = ASCIIToUTF16("Elvis Aaron Presley"); | 4362 form.fields[0].value = ASCIIToUTF16("Elvis Aaron Presley"); |
| 4294 form.fields[1].value = ASCIIToUTF16("theking@gmail.com"); | 4363 form.fields[1].value = ASCIIToUTF16("theking@gmail.com"); |
| 4295 forms.front() = form; | 4364 forms.front() = form; |
| 4296 | 4365 |
| 4297 { | 4366 { |
| 4298 base::HistogramTester histogram_tester; | 4367 base::HistogramTester histogram_tester; |
| 4299 base::UserActionTester user_action_tester; | 4368 base::UserActionTester user_action_tester; |
| 4300 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 4369 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 4301 histogram_tester.ExpectUniqueSample( | 4370 histogram_tester.ExpectUniqueSample( |
| 4302 "Autofill.FormSubmittedState", | 4371 "Autofill.FormSubmittedState", |
| 4303 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA, 1); | 4372 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA, 1); |
| 4304 EXPECT_EQ(1, user_action_tester.GetActionCount( | 4373 EXPECT_EQ(1, user_action_tester.GetActionCount( |
| 4305 "Autofill_FormSubmitted_NonFillable")); | 4374 "Autofill_FormSubmitted_NonFillable")); |
| 4306 | 4375 |
| 4307 expected_form_submission_ukm_metrics.push_back( | 4376 expected_form_submission_ukm_metrics.push_back( |
| 4308 {{internal::kUKMAutofillFormSubmittedStateMetricName, | 4377 {{internal::kUKMAutofillFormSubmittedStateMetricName, |
| 4309 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, | 4378 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, |
| 4310 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); | 4379 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); |
| 4311 VerifyFormInteractionUkm(form, &test_ukm_recorder_, | 4380 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4312 internal::kUKMFormSubmittedEntryName, | 4381 internal::kUKMFormSubmittedEntryName, |
| 4313 expected_form_submission_ukm_metrics); | 4382 expected_form_submission_ukm_metrics); |
| 4383 |
| 4384 AppendFieldFillStatusUkm(form, &expected_field_fill_status_ukm_metrics); |
| 4385 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4386 internal::kUKMFieldFillStatusEntryName, |
| 4387 expected_field_fill_status_ukm_metrics); |
| 4314 } | 4388 } |
| 4315 | 4389 |
| 4316 // Fill in the third field. | 4390 // Fill in the third field. |
| 4317 form.fields[2].value = ASCIIToUTF16("12345678901"); | 4391 form.fields[2].value = ASCIIToUTF16("12345678901"); |
| 4318 forms.front() = form; | 4392 forms.front() = form; |
| 4319 | 4393 |
| 4320 // Autofilled none with no suggestions shown. | 4394 // Autofilled none with no suggestions shown. |
| 4321 { | 4395 { |
| 4322 base::HistogramTester histogram_tester; | 4396 base::HistogramTester histogram_tester; |
| 4323 base::UserActionTester user_action_tester; | 4397 base::UserActionTester user_action_tester; |
| 4324 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 4398 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 4325 histogram_tester.ExpectUniqueSample( | 4399 histogram_tester.ExpectUniqueSample( |
| 4326 "Autofill.FormSubmittedState", | 4400 "Autofill.FormSubmittedState", |
| 4327 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS, | 4401 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS, |
| 4328 1); | 4402 1); |
| 4329 EXPECT_EQ(1, user_action_tester.GetActionCount( | 4403 EXPECT_EQ(1, user_action_tester.GetActionCount( |
| 4330 "Autofill_FormSubmitted_FilledNone_SuggestionsNotShown")); | 4404 "Autofill_FormSubmitted_FilledNone_SuggestionsNotShown")); |
| 4331 | 4405 |
| 4332 expected_form_submission_ukm_metrics.push_back( | 4406 expected_form_submission_ukm_metrics.push_back( |
| 4333 {{internal::kUKMAutofillFormSubmittedStateMetricName, | 4407 {{internal::kUKMAutofillFormSubmittedStateMetricName, |
| 4334 AutofillMetrics:: | 4408 AutofillMetrics:: |
| 4335 FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS}, | 4409 FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS}, |
| 4336 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); | 4410 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); |
| 4337 VerifyFormInteractionUkm(form, &test_ukm_recorder_, | 4411 |
| 4412 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4338 internal::kUKMFormSubmittedEntryName, | 4413 internal::kUKMFormSubmittedEntryName, |
| 4339 expected_form_submission_ukm_metrics); | 4414 expected_form_submission_ukm_metrics); |
| 4415 |
| 4416 AppendFieldFillStatusUkm(form, &expected_field_fill_status_ukm_metrics); |
| 4417 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4418 internal::kUKMFieldFillStatusEntryName, |
| 4419 expected_field_fill_status_ukm_metrics); |
| 4340 } | 4420 } |
| 4341 | 4421 |
| 4342 // Autofilled none with suggestions shown. | 4422 // Autofilled none with suggestions shown. |
| 4343 autofill_manager_->DidShowSuggestions(true, form, form.fields[2]); | 4423 autofill_manager_->DidShowSuggestions(true, form, form.fields[2]); |
| 4344 { | 4424 { |
| 4345 base::HistogramTester histogram_tester; | 4425 base::HistogramTester histogram_tester; |
| 4346 base::UserActionTester user_action_tester; | 4426 base::UserActionTester user_action_tester; |
| 4347 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 4427 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 4348 histogram_tester.ExpectUniqueSample( | 4428 histogram_tester.ExpectUniqueSample( |
| 4349 "Autofill.FormSubmittedState", | 4429 "Autofill.FormSubmittedState", |
| 4350 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS, 1); | 4430 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS, 1); |
| 4351 EXPECT_EQ(1, user_action_tester.GetActionCount( | 4431 EXPECT_EQ(1, user_action_tester.GetActionCount( |
| 4352 "Autofill_FormSubmitted_FilledNone_SuggestionsShown")); | 4432 "Autofill_FormSubmitted_FilledNone_SuggestionsShown")); |
| 4353 | 4433 |
| 4354 VerifyFormInteractionUkm( | 4434 VerifyFormInteractionUkm( |
| 4355 form, &test_ukm_recorder_, internal::kUKMSuggestionsShownEntryName, | 4435 test_ukm_recorder_, form, internal::kUKMSuggestionsShownEntryName, |
| 4356 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, | 4436 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 4357 {internal::kUKMHeuristicTypeMetricName, PHONE_HOME_WHOLE_NUMBER}, | 4437 {internal::kUKMHeuristicTypeMetricName, PHONE_HOME_WHOLE_NUMBER}, |
| 4358 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, | 4438 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, |
| 4359 {internal::kUKMServerTypeMetricName, NO_SERVER_DATA}}}); | 4439 {internal::kUKMServerTypeMetricName, NO_SERVER_DATA}}}); |
| 4440 |
| 4360 expected_form_submission_ukm_metrics.push_back( | 4441 expected_form_submission_ukm_metrics.push_back( |
| 4361 {{internal::kUKMAutofillFormSubmittedStateMetricName, | 4442 {{internal::kUKMAutofillFormSubmittedStateMetricName, |
| 4362 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS}, | 4443 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS}, |
| 4363 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); | 4444 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); |
| 4364 VerifyFormInteractionUkm(form, &test_ukm_recorder_, | 4445 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4365 internal::kUKMFormSubmittedEntryName, | 4446 internal::kUKMFormSubmittedEntryName, |
| 4366 expected_form_submission_ukm_metrics); | 4447 expected_form_submission_ukm_metrics); |
| 4448 |
| 4449 AppendFieldFillStatusUkm(form, &expected_field_fill_status_ukm_metrics); |
| 4450 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4451 internal::kUKMFieldFillStatusEntryName, |
| 4452 expected_field_fill_status_ukm_metrics); |
| 4367 } | 4453 } |
| 4368 | 4454 |
| 4369 // Mark one of the fields as autofilled. | 4455 // Mark one of the fields as autofilled. |
| 4370 form.fields[1].is_autofilled = true; | 4456 form.fields[1].is_autofilled = true; |
| 4371 forms.front() = form; | 4457 forms.front() = form; |
| 4372 | 4458 |
| 4373 // Autofilled some of the fields. | 4459 // Autofilled some of the fields. |
| 4374 { | 4460 { |
| 4375 base::HistogramTester histogram_tester; | 4461 base::HistogramTester histogram_tester; |
| 4376 base::UserActionTester user_action_tester; | 4462 base::UserActionTester user_action_tester; |
| 4377 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 4463 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 4378 histogram_tester.ExpectUniqueSample( | 4464 histogram_tester.ExpectUniqueSample( |
| 4379 "Autofill.FormSubmittedState", | 4465 "Autofill.FormSubmittedState", |
| 4380 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_SOME, 1); | 4466 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_SOME, 1); |
| 4381 EXPECT_EQ(1, user_action_tester.GetActionCount( | 4467 EXPECT_EQ(1, user_action_tester.GetActionCount( |
| 4382 "Autofill_FormSubmitted_FilledSome")); | 4468 "Autofill_FormSubmitted_FilledSome")); |
| 4383 | 4469 |
| 4384 expected_form_submission_ukm_metrics.push_back( | 4470 expected_form_submission_ukm_metrics.push_back( |
| 4385 {{internal::kUKMAutofillFormSubmittedStateMetricName, | 4471 {{internal::kUKMAutofillFormSubmittedStateMetricName, |
| 4386 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_SOME}, | 4472 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_SOME}, |
| 4387 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); | 4473 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); |
| 4388 VerifyFormInteractionUkm(form, &test_ukm_recorder_, | 4474 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4389 internal::kUKMFormSubmittedEntryName, | 4475 internal::kUKMFormSubmittedEntryName, |
| 4390 expected_form_submission_ukm_metrics); | 4476 expected_form_submission_ukm_metrics); |
| 4477 |
| 4478 AppendFieldFillStatusUkm(form, &expected_field_fill_status_ukm_metrics); |
| 4479 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4480 internal::kUKMFieldFillStatusEntryName, |
| 4481 expected_field_fill_status_ukm_metrics); |
| 4391 } | 4482 } |
| 4392 | 4483 |
| 4393 // Mark all of the fillable fields as autofilled. | 4484 // Mark all of the fillable fields as autofilled. |
| 4394 form.fields[0].is_autofilled = true; | 4485 form.fields[0].is_autofilled = true; |
| 4395 form.fields[2].is_autofilled = true; | 4486 form.fields[2].is_autofilled = true; |
| 4396 forms.front() = form; | 4487 forms.front() = form; |
| 4397 | 4488 |
| 4398 // Autofilled all the fields. | 4489 // Autofilled all the fields. |
| 4399 { | 4490 { |
| 4400 base::HistogramTester histogram_tester; | 4491 base::HistogramTester histogram_tester; |
| 4401 base::UserActionTester user_action_tester; | 4492 base::UserActionTester user_action_tester; |
| 4402 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 4493 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 4403 histogram_tester.ExpectUniqueSample( | 4494 histogram_tester.ExpectUniqueSample( |
| 4404 "Autofill.FormSubmittedState", | 4495 "Autofill.FormSubmittedState", |
| 4405 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_ALL, 1); | 4496 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_ALL, 1); |
| 4406 EXPECT_EQ(1, user_action_tester.GetActionCount( | 4497 EXPECT_EQ(1, user_action_tester.GetActionCount( |
| 4407 "Autofill_FormSubmitted_FilledAll")); | 4498 "Autofill_FormSubmitted_FilledAll")); |
| 4408 | 4499 |
| 4409 expected_form_submission_ukm_metrics.push_back( | 4500 expected_form_submission_ukm_metrics.push_back( |
| 4410 {{internal::kUKMAutofillFormSubmittedStateMetricName, | 4501 {{internal::kUKMAutofillFormSubmittedStateMetricName, |
| 4411 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_ALL}, | 4502 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_ALL}, |
| 4412 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); | 4503 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); |
| 4413 VerifyFormInteractionUkm(form, &test_ukm_recorder_, | 4504 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4414 internal::kUKMFormSubmittedEntryName, | 4505 internal::kUKMFormSubmittedEntryName, |
| 4415 expected_form_submission_ukm_metrics); | 4506 expected_form_submission_ukm_metrics); |
| 4507 |
| 4508 AppendFieldFillStatusUkm(form, &expected_field_fill_status_ukm_metrics); |
| 4509 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4510 internal::kUKMFieldFillStatusEntryName, |
| 4511 expected_field_fill_status_ukm_metrics); |
| 4416 } | 4512 } |
| 4417 | 4513 |
| 4418 // Clear out the third field's value. | 4514 // Clear out the third field's value. |
| 4419 form.fields[2].value = base::string16(); | 4515 form.fields[2].value = base::string16(); |
| 4420 forms.front() = form; | 4516 forms.front() = form; |
| 4421 | 4517 |
| 4422 // Non fillable form. | 4518 // Non fillable form. |
| 4423 { | 4519 { |
| 4424 base::HistogramTester histogram_tester; | 4520 base::HistogramTester histogram_tester; |
| 4425 base::UserActionTester user_action_tester; | 4521 base::UserActionTester user_action_tester; |
| 4426 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 4522 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 4427 histogram_tester.ExpectUniqueSample( | 4523 histogram_tester.ExpectUniqueSample( |
| 4428 "Autofill.FormSubmittedState", | 4524 "Autofill.FormSubmittedState", |
| 4429 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA, 1); | 4525 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA, 1); |
| 4430 EXPECT_EQ(1, user_action_tester.GetActionCount( | 4526 EXPECT_EQ(1, user_action_tester.GetActionCount( |
| 4431 "Autofill_FormSubmitted_NonFillable")); | 4527 "Autofill_FormSubmitted_NonFillable")); |
| 4432 | 4528 |
| 4433 expected_form_submission_ukm_metrics.push_back( | 4529 expected_form_submission_ukm_metrics.push_back( |
| 4434 {{internal::kUKMAutofillFormSubmittedStateMetricName, | 4530 {{internal::kUKMAutofillFormSubmittedStateMetricName, |
| 4435 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, | 4531 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA}, |
| 4436 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); | 4532 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}); |
| 4437 VerifyFormInteractionUkm(form, &test_ukm_recorder_, | 4533 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4438 internal::kUKMFormSubmittedEntryName, | 4534 internal::kUKMFormSubmittedEntryName, |
| 4439 expected_form_submission_ukm_metrics); | 4535 expected_form_submission_ukm_metrics); |
| 4536 |
| 4537 AppendFieldFillStatusUkm(form, &expected_field_fill_status_ukm_metrics); |
| 4538 VerifyFormInteractionUkm(test_ukm_recorder_, form, |
| 4539 internal::kUKMFieldFillStatusEntryName, |
| 4540 expected_field_fill_status_ukm_metrics); |
| 4440 } | 4541 } |
| 4441 } | 4542 } |
| 4442 | 4543 |
| 4443 // Verify that we correctly log user happiness metrics dealing with form | 4544 // Verify that we correctly log user happiness metrics dealing with form |
| 4444 // interaction. | 4545 // interaction. |
| 4445 TEST_F(AutofillMetricsTest, UserHappinessFormInteraction) { | 4546 TEST_F(AutofillMetricsTest, UserHappinessFormInteraction) { |
| 4446 // Load a fillable form. | 4547 // Load a fillable form. |
| 4447 FormData form; | 4548 FormData form; |
| 4448 form.name = ASCIIToUTF16("TestForm"); | 4549 form.name = ASCIIToUTF16("TestForm"); |
| 4449 form.origin = GURL("http://example.com/form.html"); | 4550 form.origin = GURL("http://example.com/form.html"); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4540 autofill_manager_->OnTextFieldDidChange(form, form.fields[1], gfx::RectF(), | 4641 autofill_manager_->OnTextFieldDidChange(form, form.fields[1], gfx::RectF(), |
| 4541 TimeTicks()); | 4642 TimeTicks()); |
| 4542 histogram_tester.ExpectUniqueSample( | 4643 histogram_tester.ExpectUniqueSample( |
| 4543 "Autofill.UserHappiness", | 4644 "Autofill.UserHappiness", |
| 4544 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD, 1); | 4645 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD, 1); |
| 4545 } | 4646 } |
| 4546 | 4647 |
| 4547 autofill_manager_->Reset(); | 4648 autofill_manager_->Reset(); |
| 4548 | 4649 |
| 4549 VerifyFormInteractionUkm( | 4650 VerifyFormInteractionUkm( |
| 4550 form, &test_ukm_recorder_, internal::kUKMInteractedWithFormEntryName, | 4651 test_ukm_recorder_, form, internal::kUKMInteractedWithFormEntryName, |
| 4551 {{{internal::kUKMIsForCreditCardMetricName, false}, | 4652 {{{internal::kUKMIsForCreditCardMetricName, false}, |
| 4552 {internal::kUKMLocalRecordTypeCountMetricName, 0}, | 4653 {internal::kUKMLocalRecordTypeCountMetricName, 0}, |
| 4553 {internal::kUKMServerRecordTypeCountMetricName, 0}}}); | 4654 {internal::kUKMServerRecordTypeCountMetricName, 0}}}); |
| 4554 VerifyFormInteractionUkm( | 4655 VerifyFormInteractionUkm( |
| 4555 form, &test_ukm_recorder_, internal::kUKMSuggestionsShownEntryName, | 4656 test_ukm_recorder_, form, internal::kUKMSuggestionsShownEntryName, |
| 4556 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, | 4657 {{{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 4557 {internal::kUKMHeuristicTypeMetricName, PHONE_HOME_WHOLE_NUMBER}, | 4658 {internal::kUKMHeuristicTypeMetricName, PHONE_HOME_WHOLE_NUMBER}, |
| 4558 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, | 4659 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, |
| 4559 {internal::kUKMServerTypeMetricName, NO_SERVER_DATA}}, | 4660 {internal::kUKMServerTypeMetricName, NO_SERVER_DATA}}, |
| 4560 {{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, | 4661 {{internal::kUKMMillisecondsSinceFormParsedMetricName, 0}, |
| 4561 {internal::kUKMHeuristicTypeMetricName, EMAIL_ADDRESS}, | 4662 {internal::kUKMHeuristicTypeMetricName, EMAIL_ADDRESS}, |
| 4562 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, | 4663 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, |
| 4563 {internal::kUKMServerTypeMetricName, NO_SERVER_DATA}}}); | 4664 {internal::kUKMServerTypeMetricName, NO_SERVER_DATA}}}); |
| 4564 VerifyFormInteractionUkm( | 4665 VerifyFormInteractionUkm( |
| 4565 form, &test_ukm_recorder_, internal::kUKMSuggestionFilledEntryName, | 4666 test_ukm_recorder_, form, internal::kUKMSuggestionFilledEntryName, |
| 4566 {{{internal::kUKMRecordTypeMetricName, AutofillProfile::LOCAL_PROFILE}, | 4667 {{{internal::kUKMRecordTypeMetricName, AutofillProfile::LOCAL_PROFILE}, |
| 4567 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}, | 4668 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}, |
| 4568 {{internal::kUKMRecordTypeMetricName, AutofillProfile::LOCAL_PROFILE}, | 4669 {{internal::kUKMRecordTypeMetricName, AutofillProfile::LOCAL_PROFILE}, |
| 4569 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); | 4670 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}}); |
| 4570 VerifyFormInteractionUkm( | 4671 VerifyFormInteractionUkm( |
| 4571 form, &test_ukm_recorder_, internal::kUKMTextFieldDidChangeEntryName, | 4672 test_ukm_recorder_, form, internal::kUKMTextFieldDidChangeEntryName, |
| 4572 {{{internal::kUKMFieldTypeGroupMetricName, NAME}, | 4673 {{{internal::kUKMFieldTypeGroupMetricName, NAME}, |
| 4573 {internal::kUKMHeuristicTypeMetricName, NAME_FULL}, | 4674 {internal::kUKMHeuristicTypeMetricName, NAME_FULL}, |
| 4574 {internal::kUKMServerTypeMetricName, NO_SERVER_DATA}, | 4675 {internal::kUKMServerTypeMetricName, NO_SERVER_DATA}, |
| 4575 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, | 4676 {internal::kUKMHtmlFieldTypeMetricName, HTML_TYPE_UNSPECIFIED}, |
| 4576 {internal::kUKMHtmlFieldModeMetricName, HTML_MODE_NONE}, | 4677 {internal::kUKMHtmlFieldModeMetricName, HTML_MODE_NONE}, |
| 4577 {internal::kUKMIsAutofilledMetricName, false}, | 4678 {internal::kUKMIsAutofilledMetricName, false}, |
| 4578 {internal::kUKMIsEmptyMetricName, true}, | 4679 {internal::kUKMIsEmptyMetricName, true}, |
| 4579 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}, | 4680 {internal::kUKMMillisecondsSinceFormParsedMetricName, 0}}, |
| 4580 {{internal::kUKMFieldTypeGroupMetricName, NAME}, | 4681 {{internal::kUKMFieldTypeGroupMetricName, NAME}, |
| 4581 {internal::kUKMHeuristicTypeMetricName, NAME_FULL}, | 4682 {internal::kUKMHeuristicTypeMetricName, NAME_FULL}, |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5254 // Tests that no UKM is logged when the ukm service is null. | 5355 // Tests that no UKM is logged when the ukm service is null. |
| 5255 TEST_F(AutofillMetricsTest, RecordCardUploadDecisionMetric_NoUkmService) { | 5356 TEST_F(AutofillMetricsTest, RecordCardUploadDecisionMetric_NoUkmService) { |
| 5256 GURL url("https://www.google.com"); | 5357 GURL url("https://www.google.com"); |
| 5257 std::vector<std::pair<const char*, int>> metrics = {{"metric", 1}}; | 5358 std::vector<std::pair<const char*, int>> metrics = {{"metric", 1}}; |
| 5258 | 5359 |
| 5259 EXPECT_FALSE(AutofillMetrics::LogUkm(nullptr, url, "test_ukm", metrics)); | 5360 EXPECT_FALSE(AutofillMetrics::LogUkm(nullptr, url, "test_ukm", metrics)); |
| 5260 ASSERT_EQ(0U, test_ukm_recorder_.sources_count()); | 5361 ASSERT_EQ(0U, test_ukm_recorder_.sources_count()); |
| 5261 } | 5362 } |
| 5262 | 5363 |
| 5263 } // namespace autofill | 5364 } // namespace autofill |
| OLD | NEW |