Chromium Code Reviews| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 for (size_t i = 0; i < empty_form.fields.size(); ++i) { | 222 for (size_t i = 0; i < empty_form.fields.size(); ++i) { |
| 223 empty_form.fields[i].value = base::string16(); | 223 empty_form.fields[i].value = base::string16(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 // |form_structure| will be owned by |form_structures()|. | 226 // |form_structure| will be owned by |form_structures()|. |
| 227 TestFormStructure* form_structure = new TestFormStructure(empty_form); | 227 TestFormStructure* form_structure = new TestFormStructure(empty_form); |
| 228 form_structure->SetFieldTypes(heuristic_types, server_types); | 228 form_structure->SetFieldTypes(heuristic_types, server_types); |
| 229 form_structures()->push_back(form_structure); | 229 form_structures()->push_back(form_structure); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void WillSubmitForm(const FormData& form, const TimeTicks& timestamp) { | 232 // Calls both OnWillSubmitForm and OnFormSubmitted. |
|
Ilya Sherman
2015/03/18 22:42:10
Please add test coverage for OnWillSubmitForm bein
Mathieu
2015/03/23 15:24:02
Done.
| |
| 233 void SubmitForm(const FormData& form, const TimeTicks& timestamp) { | |
| 233 run_loop_.reset(new base::RunLoop()); | 234 run_loop_.reset(new base::RunLoop()); |
| 234 if (!OnWillSubmitForm(form, timestamp)) | 235 if (!OnWillSubmitForm(form, timestamp)) |
| 235 return; | 236 return; |
| 236 | 237 |
| 237 // Wait for the asynchronous OnWillSubmitForm() call to complete. | 238 // Wait for the asynchronous OnWillSubmitForm() call to complete. |
| 238 run_loop_->Run(); | 239 run_loop_->Run(); |
| 240 | |
| 241 OnFormSubmitted(form); | |
| 239 } | 242 } |
| 240 | 243 |
| 241 void UploadFormDataAsyncCallback( | 244 void UploadFormDataAsyncCallback( |
| 242 const FormStructure* submitted_form, | 245 const FormStructure* submitted_form, |
| 243 const base::TimeTicks& load_time, | 246 const base::TimeTicks& load_time, |
| 244 const base::TimeTicks& interaction_time, | 247 const base::TimeTicks& interaction_time, |
| 245 const base::TimeTicks& submission_time) override { | 248 const base::TimeTicks& submission_time) override { |
| 246 run_loop_->Quit(); | 249 run_loop_->Quit(); |
| 247 | 250 |
| 248 AutofillManager::UploadFormDataAsyncCallback(submitted_form, | 251 AutofillManager::UploadFormDataAsyncCallback(submitted_form, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 field.is_autofilled = true; | 373 field.is_autofilled = true; |
| 371 form.fields.push_back(field); | 374 form.fields.push_back(field); |
| 372 heuristic_types.push_back(PHONE_HOME_CITY_AND_NUMBER); | 375 heuristic_types.push_back(PHONE_HOME_CITY_AND_NUMBER); |
| 373 server_types.push_back(PHONE_HOME_WHOLE_NUMBER); | 376 server_types.push_back(PHONE_HOME_WHOLE_NUMBER); |
| 374 | 377 |
| 375 // Simulate having seen this form on page load. | 378 // Simulate having seen this form on page load. |
| 376 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); | 379 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); |
| 377 | 380 |
| 378 // Simulate form submission. | 381 // Simulate form submission. |
| 379 base::HistogramTester histogram_tester; | 382 base::HistogramTester histogram_tester; |
| 380 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 383 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 381 | 384 |
| 382 // Heuristic predictions. | 385 // Heuristic predictions. |
| 383 // Unknown: | 386 // Unknown: |
| 384 histogram_tester.ExpectBucketCount("Autofill.Quality.HeuristicType", | 387 histogram_tester.ExpectBucketCount("Autofill.Quality.HeuristicType", |
| 385 AutofillMetrics::TYPE_UNKNOWN, 1); | 388 AutofillMetrics::TYPE_UNKNOWN, 1); |
| 386 histogram_tester.ExpectBucketCount( | 389 histogram_tester.ExpectBucketCount( |
| 387 "Autofill.Quality.HeuristicType.ByFieldType", | 390 "Autofill.Quality.HeuristicType.ByFieldType", |
| 388 GetFieldTypeGroupMetric(ADDRESS_HOME_COUNTRY, | 391 GetFieldTypeGroupMetric(ADDRESS_HOME_COUNTRY, |
| 389 AutofillMetrics::TYPE_UNKNOWN), | 392 AutofillMetrics::TYPE_UNKNOWN), |
| 390 1); | 393 1); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 test::CreateTestFormField("Phone", "phone", "2345678901", "tel", &field); | 495 test::CreateTestFormField("Phone", "phone", "2345678901", "tel", &field); |
| 493 field.is_autofilled = true; | 496 field.is_autofilled = true; |
| 494 form.fields.push_back(field); | 497 form.fields.push_back(field); |
| 495 heuristic_types.push_back(PHONE_HOME_CITY_AND_NUMBER); | 498 heuristic_types.push_back(PHONE_HOME_CITY_AND_NUMBER); |
| 496 server_types.push_back(EMAIL_ADDRESS); | 499 server_types.push_back(EMAIL_ADDRESS); |
| 497 | 500 |
| 498 // Simulate having seen this form on page load. | 501 // Simulate having seen this form on page load. |
| 499 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); | 502 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); |
| 500 | 503 |
| 501 // Simulate form submission. | 504 // Simulate form submission. |
| 502 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 505 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 503 | 506 |
| 504 // The number of mismatches did not trigger the RAPPOR metric logging. | 507 // The number of mismatches did not trigger the RAPPOR metric logging. |
| 505 EXPECT_EQ(0, autofill_client_.test_rappor_service()->GetReportsCount()); | 508 EXPECT_EQ(0, autofill_client_.test_rappor_service()->GetReportsCount()); |
| 506 } | 509 } |
| 507 | 510 |
| 508 // Test that we don't log RAPPOR metrics in the case heuristics and/or server | 511 // Test that we don't log RAPPOR metrics in the case heuristics and/or server |
| 509 // have no data. | 512 // have no data. |
| 510 TEST_F(AutofillMetricsTest, Rappor_NoDataServerAndHeuristic_NoMetricsReported) { | 513 TEST_F(AutofillMetricsTest, Rappor_NoDataServerAndHeuristic_NoMetricsReported) { |
| 511 // Set up our form data. | 514 // Set up our form data. |
| 512 FormData form; | 515 FormData form; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 535 test::CreateTestFormField("Phone", "phone", "2345678901", "tel", &field); | 538 test::CreateTestFormField("Phone", "phone", "2345678901", "tel", &field); |
| 536 field.is_autofilled = true; | 539 field.is_autofilled = true; |
| 537 form.fields.push_back(field); | 540 form.fields.push_back(field); |
| 538 heuristic_types.push_back(UNKNOWN_TYPE); | 541 heuristic_types.push_back(UNKNOWN_TYPE); |
| 539 server_types.push_back(NO_SERVER_DATA); | 542 server_types.push_back(NO_SERVER_DATA); |
| 540 | 543 |
| 541 // Simulate having seen this form on page load. | 544 // Simulate having seen this form on page load. |
| 542 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); | 545 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); |
| 543 | 546 |
| 544 // Simulate form submission. | 547 // Simulate form submission. |
| 545 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 548 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 546 | 549 |
| 547 // No RAPPOR metrics are logged in the case of multiple UNKNOWN_TYPE and | 550 // No RAPPOR metrics are logged in the case of multiple UNKNOWN_TYPE and |
| 548 // NO_SERVER_DATA for heuristics and server predictions, respectively. | 551 // NO_SERVER_DATA for heuristics and server predictions, respectively. |
| 549 EXPECT_EQ(0, autofill_client_.test_rappor_service()->GetReportsCount()); | 552 EXPECT_EQ(0, autofill_client_.test_rappor_service()->GetReportsCount()); |
| 550 } | 553 } |
| 551 | 554 |
| 552 // Test that we log high number of mismatches for the server prediction. | 555 // Test that we log high number of mismatches for the server prediction. |
| 553 TEST_F(AutofillMetricsTest, Rappor_HighServerMismatchRate_MetricsReported) { | 556 TEST_F(AutofillMetricsTest, Rappor_HighServerMismatchRate_MetricsReported) { |
| 554 // Set up our form data. | 557 // Set up our form data. |
| 555 FormData form; | 558 FormData form; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 578 test::CreateTestFormField("Phone", "phone", "2345678901", "tel", &field); | 581 test::CreateTestFormField("Phone", "phone", "2345678901", "tel", &field); |
| 579 field.is_autofilled = true; | 582 field.is_autofilled = true; |
| 580 form.fields.push_back(field); | 583 form.fields.push_back(field); |
| 581 heuristic_types.push_back(PHONE_HOME_CITY_AND_NUMBER); | 584 heuristic_types.push_back(PHONE_HOME_CITY_AND_NUMBER); |
| 582 server_types.push_back(EMAIL_ADDRESS); | 585 server_types.push_back(EMAIL_ADDRESS); |
| 583 | 586 |
| 584 // Simulate having seen this form on page load. | 587 // Simulate having seen this form on page load. |
| 585 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); | 588 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); |
| 586 | 589 |
| 587 // Simulate form submission. | 590 // Simulate form submission. |
| 588 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 591 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 589 | 592 |
| 590 // The number of mismatches did trigger the RAPPOR metric logging for server | 593 // The number of mismatches did trigger the RAPPOR metric logging for server |
| 591 // predictions. | 594 // predictions. |
| 592 EXPECT_EQ(1, autofill_client_.test_rappor_service()->GetReportsCount()); | 595 EXPECT_EQ(1, autofill_client_.test_rappor_service()->GetReportsCount()); |
| 593 std::string sample; | 596 std::string sample; |
| 594 rappor::RapporType type; | 597 rappor::RapporType type; |
| 595 EXPECT_FALSE( | 598 EXPECT_FALSE( |
| 596 autofill_client_.test_rappor_service()->GetRecordedSampleForMetric( | 599 autofill_client_.test_rappor_service()->GetRecordedSampleForMetric( |
| 597 "Autofill.HighNumberOfHeuristicMismatches", &sample, &type)); | 600 "Autofill.HighNumberOfHeuristicMismatches", &sample, &type)); |
| 598 EXPECT_TRUE( | 601 EXPECT_TRUE( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 test::CreateTestFormField("Phone", "phone", "2345678901", "tel", &field); | 634 test::CreateTestFormField("Phone", "phone", "2345678901", "tel", &field); |
| 632 field.is_autofilled = true; | 635 field.is_autofilled = true; |
| 633 form.fields.push_back(field); | 636 form.fields.push_back(field); |
| 634 heuristic_types.push_back(EMAIL_ADDRESS); | 637 heuristic_types.push_back(EMAIL_ADDRESS); |
| 635 server_types.push_back(PHONE_HOME_WHOLE_NUMBER); | 638 server_types.push_back(PHONE_HOME_WHOLE_NUMBER); |
| 636 | 639 |
| 637 // Simulate having seen this form on page load. | 640 // Simulate having seen this form on page load. |
| 638 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); | 641 autofill_manager_->AddSeenForm(form, heuristic_types, server_types); |
| 639 | 642 |
| 640 // Simulate form submission. | 643 // Simulate form submission. |
| 641 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 644 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 642 | 645 |
| 643 // The number of mismatches did trigger the RAPPOR metric logging for | 646 // The number of mismatches did trigger the RAPPOR metric logging for |
| 644 // heuristic predictions. | 647 // heuristic predictions. |
| 645 EXPECT_EQ(1, autofill_client_.test_rappor_service()->GetReportsCount()); | 648 EXPECT_EQ(1, autofill_client_.test_rappor_service()->GetReportsCount()); |
| 646 std::string sample; | 649 std::string sample; |
| 647 rappor::RapporType type; | 650 rappor::RapporType type; |
| 648 EXPECT_FALSE( | 651 EXPECT_FALSE( |
| 649 autofill_client_.test_rappor_service()->GetRecordedSampleForMetric( | 652 autofill_client_.test_rappor_service()->GetRecordedSampleForMetric( |
| 650 "Autofill.HighNumberOfServerMismatches", &sample, &type)); | 653 "Autofill.HighNumberOfServerMismatches", &sample, &type)); |
| 651 EXPECT_TRUE( | 654 EXPECT_TRUE( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 684 std::vector<FormData> forms(1, form); | 687 std::vector<FormData> forms(1, form); |
| 685 | 688 |
| 686 { | 689 { |
| 687 base::HistogramTester histogram_tester; | 690 base::HistogramTester histogram_tester; |
| 688 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 691 autofill_manager_->OnFormsSeen(forms, TimeTicks()); |
| 689 // We change the value of the text fields to change the default/seen values | 692 // We change the value of the text fields to change the default/seen values |
| 690 // (hence the values are not cleared in UpdateFromCache). The new values | 693 // (hence the values are not cleared in UpdateFromCache). The new values |
| 691 // match what is in the test profile. | 694 // match what is in the test profile. |
| 692 form.fields[1].value = base::ASCIIToUTF16("79401"); | 695 form.fields[1].value = base::ASCIIToUTF16("79401"); |
| 693 form.fields[2].value = base::ASCIIToUTF16("2345678901"); | 696 form.fields[2].value = base::ASCIIToUTF16("2345678901"); |
| 694 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 697 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 695 | 698 |
| 696 // First verify that country was not predicted by client or server. | 699 // First verify that country was not predicted by client or server. |
| 697 histogram_tester.ExpectBucketCount( | 700 histogram_tester.ExpectBucketCount( |
| 698 "Autofill.Quality.ServerType.ByFieldType", | 701 "Autofill.Quality.ServerType.ByFieldType", |
| 699 GetFieldTypeGroupMetric(ADDRESS_HOME_COUNTRY, | 702 GetFieldTypeGroupMetric(ADDRESS_HOME_COUNTRY, |
| 700 AutofillMetrics::TYPE_UNKNOWN), | 703 AutofillMetrics::TYPE_UNKNOWN), |
| 701 1); | 704 1); |
| 702 histogram_tester.ExpectBucketCount( | 705 histogram_tester.ExpectBucketCount( |
| 703 "Autofill.Quality.HeuristicType.ByFieldType", | 706 "Autofill.Quality.HeuristicType.ByFieldType", |
| 704 GetFieldTypeGroupMetric(ADDRESS_HOME_COUNTRY, | 707 GetFieldTypeGroupMetric(ADDRESS_HOME_COUNTRY, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 797 test::CreateTestFormField( | 800 test::CreateTestFormField( |
| 798 "New field", "new field", "Tennessee", "text", &field); | 801 "New field", "new field", "Tennessee", "text", &field); |
| 799 form.fields.push_back(field); | 802 form.fields.push_back(field); |
| 800 form.fields.push_back(cached_fields[2]); | 803 form.fields.push_back(cached_fields[2]); |
| 801 form.fields.push_back(cached_fields[1]); | 804 form.fields.push_back(cached_fields[1]); |
| 802 form.fields.push_back(cached_fields[3]); | 805 form.fields.push_back(cached_fields[3]); |
| 803 form.fields.push_back(cached_fields[0]); | 806 form.fields.push_back(cached_fields[0]); |
| 804 | 807 |
| 805 // Simulate form submission. | 808 // Simulate form submission. |
| 806 base::HistogramTester histogram_tester; | 809 base::HistogramTester histogram_tester; |
| 807 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 810 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 808 | 811 |
| 809 // Heuristic predictions. | 812 // Heuristic predictions. |
| 810 // Unknown: | 813 // Unknown: |
| 811 histogram_tester.ExpectBucketCount("Autofill.Quality.HeuristicType", | 814 histogram_tester.ExpectBucketCount("Autofill.Quality.HeuristicType", |
| 812 AutofillMetrics::TYPE_UNKNOWN, 1); | 815 AutofillMetrics::TYPE_UNKNOWN, 1); |
| 813 histogram_tester.ExpectBucketCount( | 816 histogram_tester.ExpectBucketCount( |
| 814 "Autofill.Quality.HeuristicType.ByFieldType", | 817 "Autofill.Quality.HeuristicType.ByFieldType", |
| 815 GetFieldTypeGroupMetric(ADDRESS_HOME_STATE, | 818 GetFieldTypeGroupMetric(ADDRESS_HOME_STATE, |
| 816 AutofillMetrics::TYPE_UNKNOWN), | 819 AutofillMetrics::TYPE_UNKNOWN), |
| 817 1); | 820 1); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 907 test::CreateTestFormField("Email", "email", "", "text", &field); | 910 test::CreateTestFormField("Email", "email", "", "text", &field); |
| 908 form.fields.push_back(field); | 911 form.fields.push_back(field); |
| 909 test::CreateTestFormField("Phone", "phone", "", "text", &field); | 912 test::CreateTestFormField("Phone", "phone", "", "text", &field); |
| 910 form.fields.push_back(field); | 913 form.fields.push_back(field); |
| 911 | 914 |
| 912 std::vector<FormData> forms(1, form); | 915 std::vector<FormData> forms(1, form); |
| 913 | 916 |
| 914 // Simulate form submission. | 917 // Simulate form submission. |
| 915 base::HistogramTester histogram_tester; | 918 base::HistogramTester histogram_tester; |
| 916 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 919 autofill_manager_->OnFormsSeen(forms, TimeTicks()); |
| 917 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 920 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 918 | 921 |
| 919 // An autofillable form was submitted, and the number of stored profiles is | 922 // An autofillable form was submitted, and the number of stored profiles is |
| 920 // logged. | 923 // logged. |
| 921 histogram_tester.ExpectUniqueSample( | 924 histogram_tester.ExpectUniqueSample( |
| 922 "Autofill.StoredProfileCountAtAutofillableFormSubmission", 2, 1); | 925 "Autofill.StoredProfileCountAtAutofillableFormSubmission", 2, 1); |
| 923 } | 926 } |
| 924 | 927 |
| 925 // Verify that when submitting a non-autofillable form, the stored profile | 928 // Verify that when submitting a non-autofillable form, the stored profile |
| 926 // metric is not logged. | 929 // metric is not logged. |
| 927 TEST_F(AutofillMetricsTest, StoredProfileCountNonAutofillableFormSubmission) { | 930 TEST_F(AutofillMetricsTest, StoredProfileCountNonAutofillableFormSubmission) { |
| 928 // Construct a non-fillable form. | 931 // Construct a non-fillable form. |
| 929 FormData form; | 932 FormData form; |
| 930 form.name = ASCIIToUTF16("TestForm"); | 933 form.name = ASCIIToUTF16("TestForm"); |
| 931 form.origin = GURL("http://example.com/form.html"); | 934 form.origin = GURL("http://example.com/form.html"); |
| 932 form.action = GURL("http://example.com/submit.html"); | 935 form.action = GURL("http://example.com/submit.html"); |
| 933 form.user_submitted = true; | 936 form.user_submitted = true; |
| 934 | 937 |
| 935 // Two fields is not enough to make it an autofillable form. | 938 // Two fields is not enough to make it an autofillable form. |
| 936 FormFieldData field; | 939 FormFieldData field; |
| 937 test::CreateTestFormField("Name", "name", "", "text", &field); | 940 test::CreateTestFormField("Name", "name", "", "text", &field); |
| 938 form.fields.push_back(field); | 941 form.fields.push_back(field); |
| 939 test::CreateTestFormField("Email", "email", "", "text", &field); | 942 test::CreateTestFormField("Email", "email", "", "text", &field); |
| 940 form.fields.push_back(field); | 943 form.fields.push_back(field); |
| 941 | 944 |
| 942 std::vector<FormData> forms(1, form); | 945 std::vector<FormData> forms(1, form); |
| 943 | 946 |
| 944 // Simulate form submission. | 947 // Simulate form submission. |
| 945 base::HistogramTester histogram_tester; | 948 base::HistogramTester histogram_tester; |
| 946 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 949 autofill_manager_->OnFormsSeen(forms, TimeTicks()); |
| 947 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 950 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 948 | 951 |
| 949 // A non-autofillable form was submitted, and number of stored profiles is NOT | 952 // A non-autofillable form was submitted, and number of stored profiles is NOT |
| 950 // logged. | 953 // logged. |
| 951 histogram_tester.ExpectTotalCount( | 954 histogram_tester.ExpectTotalCount( |
| 952 "Autofill.StoredProfileCountAtAutofillableFormSubmission", 0); | 955 "Autofill.StoredProfileCountAtAutofillableFormSubmission", 0); |
| 953 } | 956 } |
| 954 | 957 |
| 955 // Verify that we correctly log metrics regarding developer engagement. | 958 // Verify that we correctly log metrics regarding developer engagement. |
| 956 TEST_F(AutofillMetricsTest, DeveloperEngagement) { | 959 TEST_F(AutofillMetricsTest, DeveloperEngagement) { |
| 957 // Start with a non-fillable form. | 960 // Start with a non-fillable form. |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1483 | 1486 |
| 1484 // Simulate having seen this form on page load. | 1487 // Simulate having seen this form on page load. |
| 1485 // |form_structure| will be owned by |autofill_manager_|. | 1488 // |form_structure| will be owned by |autofill_manager_|. |
| 1486 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1489 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1487 | 1490 |
| 1488 { | 1491 { |
| 1489 // Simulating submission with no filled data. | 1492 // Simulating submission with no filled data. |
| 1490 base::HistogramTester histogram_tester; | 1493 base::HistogramTester histogram_tester; |
| 1491 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), | 1494 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), |
| 1492 false); | 1495 false); |
| 1493 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1496 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1497 histogram_tester.ExpectBucketCount("Autofill.FormEvents.CreditCard", | |
| 1498 AutofillMetrics::FORM_EVENT_WILL_SUBMIT, | |
| 1499 1); | |
| 1494 histogram_tester.ExpectBucketCount( | 1500 histogram_tester.ExpectBucketCount( |
| 1495 "Autofill.FormEvents.CreditCard", | 1501 "Autofill.FormEvents.CreditCard", |
| 1496 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); | 1502 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); |
| 1497 } | 1503 } |
| 1498 | 1504 |
| 1499 // Reset the autofill manager state. | 1505 // Reset the autofill manager state. |
| 1500 autofill_manager_->Reset(); | 1506 autofill_manager_->Reset(); |
| 1501 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1507 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1502 | 1508 |
| 1503 { | 1509 { |
| 1504 // Simulating submission with filled local data. | 1510 // Simulating submission with filled local data. |
| 1505 base::HistogramTester histogram_tester; | 1511 base::HistogramTester histogram_tester; |
| 1506 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), | 1512 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), |
| 1507 false); | 1513 false); |
| 1508 SuggestionBackendID guid( | 1514 SuggestionBackendID guid( |
| 1509 "10000000-0000-0000-0000-000000000001", 0); // local card | 1515 "10000000-0000-0000-0000-000000000001", 0); // local card |
| 1510 autofill_manager_->FillOrPreviewForm( | 1516 autofill_manager_->FillOrPreviewForm( |
| 1511 AutofillDriver::FORM_DATA_ACTION_FILL, | 1517 AutofillDriver::FORM_DATA_ACTION_FILL, |
| 1512 0, form, form.fields.front(), | 1518 0, form, form.fields.front(), |
| 1513 autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); | 1519 autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); |
| 1514 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1520 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1521 histogram_tester.ExpectBucketCount("Autofill.FormEvents.CreditCard", | |
| 1522 AutofillMetrics::FORM_EVENT_WILL_SUBMIT, | |
| 1523 1); | |
| 1515 histogram_tester.ExpectBucketCount( | 1524 histogram_tester.ExpectBucketCount( |
| 1516 "Autofill.FormEvents.CreditCard", | 1525 "Autofill.FormEvents.CreditCard", |
| 1517 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 1); | 1526 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 1); |
| 1518 } | 1527 } |
| 1519 | 1528 |
| 1520 // Reset the autofill manager state. | 1529 // Reset the autofill manager state. |
| 1521 autofill_manager_->Reset(); | 1530 autofill_manager_->Reset(); |
| 1522 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1531 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1523 | 1532 |
| 1524 { | 1533 { |
| 1525 // Simulating submission with filled server data. | 1534 // Simulating submission with filled server data. |
| 1526 base::HistogramTester histogram_tester; | 1535 base::HistogramTester histogram_tester; |
| 1527 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), | 1536 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), |
| 1528 false); | 1537 false); |
| 1529 SuggestionBackendID guid( | 1538 SuggestionBackendID guid( |
| 1530 "10000000-0000-0000-0000-000000000003", 0); // full server card | 1539 "10000000-0000-0000-0000-000000000003", 0); // full server card |
| 1531 autofill_manager_->FillOrPreviewForm( | 1540 autofill_manager_->FillOrPreviewForm( |
| 1532 AutofillDriver::FORM_DATA_ACTION_FILL, | 1541 AutofillDriver::FORM_DATA_ACTION_FILL, |
| 1533 0, form, form.fields.front(), | 1542 0, form, form.fields.front(), |
| 1534 autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); | 1543 autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); |
| 1535 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1544 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1545 histogram_tester.ExpectBucketCount("Autofill.FormEvents.CreditCard", | |
| 1546 AutofillMetrics::FORM_EVENT_WILL_SUBMIT, | |
| 1547 1); | |
| 1536 histogram_tester.ExpectBucketCount( | 1548 histogram_tester.ExpectBucketCount( |
| 1537 "Autofill.FormEvents.CreditCard", | 1549 "Autofill.FormEvents.CreditCard", |
| 1538 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 1); | 1550 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 1); |
| 1539 } | 1551 } |
| 1540 | 1552 |
| 1541 // Reset the autofill manager state. | 1553 // Reset the autofill manager state. |
| 1542 autofill_manager_->Reset(); | 1554 autofill_manager_->Reset(); |
| 1543 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1555 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1544 | 1556 |
| 1545 { | 1557 { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 1571 | 1583 |
| 1572 // Reset the autofill manager state. | 1584 // Reset the autofill manager state. |
| 1573 autofill_manager_->Reset(); | 1585 autofill_manager_->Reset(); |
| 1574 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1586 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1575 | 1587 |
| 1576 { | 1588 { |
| 1577 // Simulating multiple submissions. | 1589 // Simulating multiple submissions. |
| 1578 base::HistogramTester histogram_tester; | 1590 base::HistogramTester histogram_tester; |
| 1579 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), | 1591 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), |
| 1580 false); | 1592 false); |
| 1581 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1593 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1582 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1594 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1595 histogram_tester.ExpectBucketCount("Autofill.FormEvents.CreditCard", | |
| 1596 AutofillMetrics::FORM_EVENT_WILL_SUBMIT, | |
| 1597 2); | |
| 1583 histogram_tester.ExpectBucketCount( | 1598 histogram_tester.ExpectBucketCount( |
| 1584 "Autofill.FormEvents.CreditCard", | 1599 "Autofill.FormEvents.CreditCard", |
| 1585 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); | 1600 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); |
| 1586 histogram_tester.ExpectBucketCount( | 1601 histogram_tester.ExpectBucketCount( |
| 1587 "Autofill.FormEvents.CreditCard", | 1602 "Autofill.FormEvents.CreditCard", |
| 1588 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); | 1603 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); |
| 1589 histogram_tester.ExpectBucketCount( | 1604 histogram_tester.ExpectBucketCount( |
| 1590 "Autofill.FormEvents.CreditCard", | 1605 "Autofill.FormEvents.CreditCard", |
| 1591 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 1606 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); |
| 1592 histogram_tester.ExpectBucketCount( | 1607 histogram_tester.ExpectBucketCount( |
| 1593 "Autofill.FormEvents.CreditCard", | 1608 "Autofill.FormEvents.CreditCard", |
| 1594 AutofillMetrics | 1609 AutofillMetrics |
| 1595 ::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, | 1610 ::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, |
| 1596 0); | 1611 0); |
| 1597 } | 1612 } |
| 1598 | 1613 |
| 1599 // Reset the autofill manager state. | 1614 // Reset the autofill manager state. |
| 1600 autofill_manager_->Reset(); | 1615 autofill_manager_->Reset(); |
| 1601 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1616 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1602 | 1617 |
| 1603 { | 1618 { |
| 1604 // Simulating submission without previous interaction. | 1619 // Simulating submission without previous interaction. |
| 1605 base::HistogramTester histogram_tester; | 1620 base::HistogramTester histogram_tester; |
| 1606 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1621 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1622 histogram_tester.ExpectBucketCount("Autofill.FormEvents.CreditCard", | |
| 1623 AutofillMetrics::FORM_EVENT_WILL_SUBMIT, | |
| 1624 0); | |
| 1607 histogram_tester.ExpectBucketCount( | 1625 histogram_tester.ExpectBucketCount( |
| 1608 "Autofill.FormEvents.CreditCard", | 1626 "Autofill.FormEvents.CreditCard", |
| 1609 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); | 1627 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); |
| 1610 histogram_tester.ExpectBucketCount( | 1628 histogram_tester.ExpectBucketCount( |
| 1611 "Autofill.FormEvents.CreditCard", | 1629 "Autofill.FormEvents.CreditCard", |
| 1612 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 1630 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); |
| 1613 histogram_tester.ExpectBucketCount( | 1631 histogram_tester.ExpectBucketCount( |
| 1614 "Autofill.FormEvents.CreditCard", | 1632 "Autofill.FormEvents.CreditCard", |
| 1615 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 1633 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); |
| 1616 } | 1634 } |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1864 | 1882 |
| 1865 // Simulate having seen this form on page load. | 1883 // Simulate having seen this form on page load. |
| 1866 // |form_structure| will be owned by |autofill_manager_|. | 1884 // |form_structure| will be owned by |autofill_manager_|. |
| 1867 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1885 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1868 | 1886 |
| 1869 { | 1887 { |
| 1870 // Simulating submission with no filled data. | 1888 // Simulating submission with no filled data. |
| 1871 base::HistogramTester histogram_tester; | 1889 base::HistogramTester histogram_tester; |
| 1872 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), | 1890 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), |
| 1873 false); | 1891 false); |
| 1874 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1892 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1893 histogram_tester.ExpectBucketCount("Autofill.FormEvents.Address", | |
| 1894 AutofillMetrics::FORM_EVENT_WILL_SUBMIT, | |
| 1895 1); | |
| 1875 histogram_tester.ExpectBucketCount( | 1896 histogram_tester.ExpectBucketCount( |
| 1876 "Autofill.FormEvents.Address", | 1897 "Autofill.FormEvents.Address", |
| 1877 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); | 1898 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); |
| 1878 } | 1899 } |
| 1879 | 1900 |
| 1880 // Reset the autofill manager state. | 1901 // Reset the autofill manager state. |
| 1881 autofill_manager_->Reset(); | 1902 autofill_manager_->Reset(); |
| 1882 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1903 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1883 | 1904 |
| 1884 { | 1905 { |
| 1885 // Simulating submission with filled local data. | 1906 // Simulating submission with filled local data. |
| 1886 base::HistogramTester histogram_tester; | 1907 base::HistogramTester histogram_tester; |
| 1887 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), | 1908 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), |
| 1888 false); | 1909 false); |
| 1889 SuggestionBackendID guid( | 1910 SuggestionBackendID guid( |
| 1890 "00000000-0000-0000-0000-000000000001", 0); // local profile | 1911 "00000000-0000-0000-0000-000000000001", 0); // local profile |
| 1891 autofill_manager_->FillOrPreviewForm( | 1912 autofill_manager_->FillOrPreviewForm( |
| 1892 AutofillDriver::FORM_DATA_ACTION_FILL, | 1913 AutofillDriver::FORM_DATA_ACTION_FILL, |
| 1893 0, form, form.fields.front(), | 1914 0, form, form.fields.front(), |
| 1894 autofill_manager_->MakeFrontendID(SuggestionBackendID(), guid)); | 1915 autofill_manager_->MakeFrontendID(SuggestionBackendID(), guid)); |
| 1895 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1916 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1917 histogram_tester.ExpectBucketCount("Autofill.FormEvents.Address", | |
| 1918 AutofillMetrics::FORM_EVENT_WILL_SUBMIT, | |
| 1919 1); | |
| 1896 histogram_tester.ExpectBucketCount( | 1920 histogram_tester.ExpectBucketCount( |
| 1897 "Autofill.FormEvents.Address", | 1921 "Autofill.FormEvents.Address", |
| 1898 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 1); | 1922 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 1); |
| 1899 } | 1923 } |
| 1900 | 1924 |
| 1901 // Reset the autofill manager state. | 1925 // Reset the autofill manager state. |
| 1902 autofill_manager_->Reset(); | 1926 autofill_manager_->Reset(); |
| 1903 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1927 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1904 | 1928 |
| 1905 { | 1929 { |
| 1906 // Simulating submission with filled server data. | 1930 // Simulating submission with filled server data. |
| 1907 base::HistogramTester histogram_tester; | 1931 base::HistogramTester histogram_tester; |
| 1908 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), | 1932 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), |
| 1909 false); | 1933 false); |
| 1910 SuggestionBackendID guid( | 1934 SuggestionBackendID guid( |
| 1911 "00000000-0000-0000-0000-000000000002", 0); // server profile | 1935 "00000000-0000-0000-0000-000000000002", 0); // server profile |
| 1912 autofill_manager_->FillOrPreviewForm( | 1936 autofill_manager_->FillOrPreviewForm( |
| 1913 AutofillDriver::FORM_DATA_ACTION_FILL, | 1937 AutofillDriver::FORM_DATA_ACTION_FILL, |
| 1914 0, form, form.fields.front(), | 1938 0, form, form.fields.front(), |
| 1915 autofill_manager_->MakeFrontendID(SuggestionBackendID(), guid)); | 1939 autofill_manager_->MakeFrontendID(SuggestionBackendID(), guid)); |
| 1916 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1940 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1941 histogram_tester.ExpectBucketCount("Autofill.FormEvents.Address", | |
| 1942 AutofillMetrics::FORM_EVENT_WILL_SUBMIT, | |
| 1943 1); | |
| 1917 histogram_tester.ExpectBucketCount( | 1944 histogram_tester.ExpectBucketCount( |
| 1918 "Autofill.FormEvents.Address", | 1945 "Autofill.FormEvents.Address", |
| 1919 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 1); | 1946 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 1); |
| 1920 } | 1947 } |
| 1921 | 1948 |
| 1922 // Reset the autofill manager state. | 1949 // Reset the autofill manager state. |
| 1923 autofill_manager_->Reset(); | 1950 autofill_manager_->Reset(); |
| 1924 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1951 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1925 | 1952 |
| 1926 { | 1953 { |
| 1927 // Simulating multiple submissions. | 1954 // Simulating multiple submissions. |
| 1928 base::HistogramTester histogram_tester; | 1955 base::HistogramTester histogram_tester; |
| 1929 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), | 1956 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), |
| 1930 false); | 1957 false); |
| 1931 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1958 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1959 autofill_manager_->SubmitForm(form, TimeTicks::Now()); | |
| 1960 histogram_tester.ExpectBucketCount("Autofill.FormEvents.Address", | |
| 1961 AutofillMetrics::FORM_EVENT_WILL_SUBMIT, | |
| 1962 2); | |
| 1932 histogram_tester.ExpectBucketCount( | 1963 histogram_tester.ExpectBucketCount( |
| 1933 "Autofill.FormEvents.Address", | 1964 "Autofill.FormEvents.Address", |
| 1934 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); | 1965 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); |
| 1935 histogram_tester.ExpectBucketCount( | 1966 histogram_tester.ExpectBucketCount( |
| 1936 "Autofill.FormEvents.Address", | 1967 "Autofill.FormEvents.Address", |
| 1937 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); | 1968 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); |
| 1938 histogram_tester.ExpectBucketCount( | 1969 histogram_tester.ExpectBucketCount( |
| 1939 "Autofill.FormEvents.Address", | 1970 "Autofill.FormEvents.Address", |
| 1940 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 1971 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); |
| 1941 } | 1972 } |
| 1942 | 1973 |
| 1943 // Reset the autofill manager state. | 1974 // Reset the autofill manager state. |
| 1944 autofill_manager_->Reset(); | 1975 autofill_manager_->Reset(); |
| 1945 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1976 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 1946 | 1977 |
| 1947 { | 1978 { |
| 1948 // Simulating submission without previous interaction. | 1979 // Simulating submission without previous interaction. |
| 1949 base::HistogramTester histogram_tester; | 1980 base::HistogramTester histogram_tester; |
| 1950 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 1981 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 1982 histogram_tester.ExpectBucketCount("Autofill.FormEvents.Address", | |
| 1983 AutofillMetrics::FORM_EVENT_WILL_SUBMIT, | |
| 1984 0); | |
| 1951 histogram_tester.ExpectBucketCount( | 1985 histogram_tester.ExpectBucketCount( |
| 1952 "Autofill.FormEvents.Address", | 1986 "Autofill.FormEvents.Address", |
| 1953 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); | 1987 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); |
| 1954 histogram_tester.ExpectBucketCount( | 1988 histogram_tester.ExpectBucketCount( |
| 1955 "Autofill.FormEvents.Address", | 1989 "Autofill.FormEvents.Address", |
| 1956 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); | 1990 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); |
| 1957 histogram_tester.ExpectBucketCount( | 1991 histogram_tester.ExpectBucketCount( |
| 1958 "Autofill.FormEvents.Address", | 1992 "Autofill.FormEvents.Address", |
| 1959 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 1993 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); |
| 1960 } | 1994 } |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2201 { | 2235 { |
| 2202 base::HistogramTester histogram_tester; | 2236 base::HistogramTester histogram_tester; |
| 2203 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 2237 autofill_manager_->OnFormsSeen(forms, TimeTicks()); |
| 2204 histogram_tester.ExpectTotalCount("Autofill.UserHappiness", 0); | 2238 histogram_tester.ExpectTotalCount("Autofill.UserHappiness", 0); |
| 2205 } | 2239 } |
| 2206 | 2240 |
| 2207 | 2241 |
| 2208 // Expect no notifications when the form is submitted. | 2242 // Expect no notifications when the form is submitted. |
| 2209 { | 2243 { |
| 2210 base::HistogramTester histogram_tester; | 2244 base::HistogramTester histogram_tester; |
| 2211 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 2245 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 2212 histogram_tester.ExpectTotalCount("Autofill.UserHappiness", 0); | 2246 histogram_tester.ExpectTotalCount("Autofill.UserHappiness", 0); |
| 2213 } | 2247 } |
| 2214 | 2248 |
| 2215 // Add more fields to the form. | 2249 // Add more fields to the form. |
| 2216 test::CreateTestFormField("Phone", "phone", "", "text", &field); | 2250 test::CreateTestFormField("Phone", "phone", "", "text", &field); |
| 2217 form.fields.push_back(field); | 2251 form.fields.push_back(field); |
| 2218 test::CreateTestFormField("Unknown", "unknown", "", "text", &field); | 2252 test::CreateTestFormField("Unknown", "unknown", "", "text", &field); |
| 2219 form.fields.push_back(field); | 2253 form.fields.push_back(field); |
| 2220 forms.front() = form; | 2254 forms.front() = form; |
| 2221 | 2255 |
| 2222 // Expect a notification when the form is first seen. | 2256 // Expect a notification when the form is first seen. |
| 2223 { | 2257 { |
| 2224 base::HistogramTester histogram_tester; | 2258 base::HistogramTester histogram_tester; |
| 2225 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 2259 autofill_manager_->OnFormsSeen(forms, TimeTicks()); |
| 2226 histogram_tester.ExpectUniqueSample("Autofill.UserHappiness", | 2260 histogram_tester.ExpectUniqueSample("Autofill.UserHappiness", |
| 2227 AutofillMetrics::FORMS_LOADED, 1); | 2261 AutofillMetrics::FORMS_LOADED, 1); |
| 2228 } | 2262 } |
| 2229 | 2263 |
| 2230 // Expect a notification when the form is submitted. | 2264 // Expect a notification when the form is submitted. |
| 2231 { | 2265 { |
| 2232 base::HistogramTester histogram_tester; | 2266 base::HistogramTester histogram_tester; |
| 2233 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 2267 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 2234 histogram_tester.ExpectUniqueSample( | 2268 histogram_tester.ExpectUniqueSample( |
| 2235 "Autofill.UserHappiness", AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM, | 2269 "Autofill.UserHappiness", AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM, |
| 2236 1); | 2270 1); |
| 2237 } | 2271 } |
| 2238 | 2272 |
| 2239 // Fill in two of the fields. | 2273 // Fill in two of the fields. |
| 2240 form.fields[0].value = ASCIIToUTF16("Elvis Aaron Presley"); | 2274 form.fields[0].value = ASCIIToUTF16("Elvis Aaron Presley"); |
| 2241 form.fields[1].value = ASCIIToUTF16("theking@gmail.com"); | 2275 form.fields[1].value = ASCIIToUTF16("theking@gmail.com"); |
| 2242 forms.front() = form; | 2276 forms.front() = form; |
| 2243 | 2277 |
| 2244 // Expect a notification when the form is submitted. | 2278 // Expect a notification when the form is submitted. |
| 2245 { | 2279 { |
| 2246 base::HistogramTester histogram_tester; | 2280 base::HistogramTester histogram_tester; |
| 2247 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 2281 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 2248 histogram_tester.ExpectUniqueSample( | 2282 histogram_tester.ExpectUniqueSample( |
| 2249 "Autofill.UserHappiness", AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM, | 2283 "Autofill.UserHappiness", AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM, |
| 2250 1); | 2284 1); |
| 2251 } | 2285 } |
| 2252 | 2286 |
| 2253 // Fill in the third field. | 2287 // Fill in the third field. |
| 2254 form.fields[2].value = ASCIIToUTF16("12345678901"); | 2288 form.fields[2].value = ASCIIToUTF16("12345678901"); |
| 2255 forms.front() = form; | 2289 forms.front() = form; |
| 2256 | 2290 |
| 2257 // Expect notifications when the form is submitted. | 2291 // Expect notifications when the form is submitted. |
| 2258 { | 2292 { |
| 2259 base::HistogramTester histogram_tester; | 2293 base::HistogramTester histogram_tester; |
| 2260 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 2294 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 2261 histogram_tester.ExpectUniqueSample( | 2295 histogram_tester.ExpectUniqueSample( |
| 2262 "Autofill.UserHappiness", | 2296 "Autofill.UserHappiness", |
| 2263 AutofillMetrics::SUBMITTED_FILLABLE_FORM_AUTOFILLED_NONE, 1); | 2297 AutofillMetrics::SUBMITTED_FILLABLE_FORM_AUTOFILLED_NONE, 1); |
| 2264 } | 2298 } |
| 2265 | 2299 |
| 2266 | 2300 |
| 2267 // Mark one of the fields as autofilled. | 2301 // Mark one of the fields as autofilled. |
| 2268 form.fields[1].is_autofilled = true; | 2302 form.fields[1].is_autofilled = true; |
| 2269 forms.front() = form; | 2303 forms.front() = form; |
| 2270 | 2304 |
| 2271 // Expect notifications when the form is submitted. | 2305 // Expect notifications when the form is submitted. |
| 2272 { | 2306 { |
| 2273 base::HistogramTester histogram_tester; | 2307 base::HistogramTester histogram_tester; |
| 2274 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 2308 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 2275 histogram_tester.ExpectUniqueSample( | 2309 histogram_tester.ExpectUniqueSample( |
| 2276 "Autofill.UserHappiness", | 2310 "Autofill.UserHappiness", |
| 2277 AutofillMetrics::SUBMITTED_FILLABLE_FORM_AUTOFILLED_SOME, 1); | 2311 AutofillMetrics::SUBMITTED_FILLABLE_FORM_AUTOFILLED_SOME, 1); |
| 2278 } | 2312 } |
| 2279 | 2313 |
| 2280 // Mark all of the fillable fields as autofilled. | 2314 // Mark all of the fillable fields as autofilled. |
| 2281 form.fields[0].is_autofilled = true; | 2315 form.fields[0].is_autofilled = true; |
| 2282 form.fields[2].is_autofilled = true; | 2316 form.fields[2].is_autofilled = true; |
| 2283 forms.front() = form; | 2317 forms.front() = form; |
| 2284 | 2318 |
| 2285 // Expect notifications when the form is submitted. | 2319 // Expect notifications when the form is submitted. |
| 2286 { | 2320 { |
| 2287 base::HistogramTester histogram_tester; | 2321 base::HistogramTester histogram_tester; |
| 2288 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 2322 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 2289 histogram_tester.ExpectUniqueSample( | 2323 histogram_tester.ExpectUniqueSample( |
| 2290 "Autofill.UserHappiness", | 2324 "Autofill.UserHappiness", |
| 2291 AutofillMetrics::SUBMITTED_FILLABLE_FORM_AUTOFILLED_ALL, 1); | 2325 AutofillMetrics::SUBMITTED_FILLABLE_FORM_AUTOFILLED_ALL, 1); |
| 2292 } | 2326 } |
| 2293 | 2327 |
| 2294 // Clear out the third field's value. | 2328 // Clear out the third field's value. |
| 2295 form.fields[2].value = base::string16(); | 2329 form.fields[2].value = base::string16(); |
| 2296 forms.front() = form; | 2330 forms.front() = form; |
| 2297 | 2331 |
| 2298 // Expect notifications when the form is submitted. | 2332 // Expect notifications when the form is submitted. |
| 2299 { | 2333 { |
| 2300 base::HistogramTester histogram_tester; | 2334 base::HistogramTester histogram_tester; |
| 2301 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 2335 autofill_manager_->SubmitForm(form, TimeTicks::Now()); |
| 2302 histogram_tester.ExpectUniqueSample( | 2336 histogram_tester.ExpectUniqueSample( |
| 2303 "Autofill.UserHappiness", AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM, | 2337 "Autofill.UserHappiness", AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM, |
| 2304 1); | 2338 1); |
| 2305 } | 2339 } |
| 2306 } | 2340 } |
| 2307 | 2341 |
| 2308 // Verify that we correctly log user happiness metrics dealing with form | 2342 // Verify that we correctly log user happiness metrics dealing with form |
| 2309 // interaction. | 2343 // interaction. |
| 2310 TEST_F(AutofillMetricsTest, UserHappinessFormInteraction) { | 2344 TEST_F(AutofillMetricsTest, UserHappinessFormInteraction) { |
| 2311 // Load a fillable form. | 2345 // Load a fillable form. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2447 second_form.fields[0].value = ASCIIToUTF16("Elvis Aaron Presley"); | 2481 second_form.fields[0].value = ASCIIToUTF16("Elvis Aaron Presley"); |
| 2448 second_form.fields[1].value = ASCIIToUTF16("theking@gmail.com"); | 2482 second_form.fields[1].value = ASCIIToUTF16("theking@gmail.com"); |
| 2449 second_form.fields[2].value = ASCIIToUTF16("12345678901"); | 2483 second_form.fields[2].value = ASCIIToUTF16("12345678901"); |
| 2450 second_form.fields[3].value = ASCIIToUTF16("51512345678"); | 2484 second_form.fields[3].value = ASCIIToUTF16("51512345678"); |
| 2451 | 2485 |
| 2452 // Expect only form load metrics to be logged if the form is submitted without | 2486 // Expect only form load metrics to be logged if the form is submitted without |
| 2453 // user interaction. | 2487 // user interaction. |
| 2454 { | 2488 { |
| 2455 base::HistogramTester histogram_tester; | 2489 base::HistogramTester histogram_tester; |
| 2456 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 2490 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); |
| 2457 autofill_manager_->WillSubmitForm(form, TimeTicks::FromInternalValue(17)); | 2491 autofill_manager_->SubmitForm(form, TimeTicks::FromInternalValue(17)); |
| 2458 | 2492 |
| 2459 histogram_tester.ExpectTotalCount( | 2493 histogram_tester.ExpectTotalCount( |
| 2460 "Autofill.FillDuration.FromLoad.WithAutofill", 0); | 2494 "Autofill.FillDuration.FromLoad.WithAutofill", 0); |
| 2461 histogram_tester.ExpectUniqueSample( | 2495 histogram_tester.ExpectUniqueSample( |
| 2462 "Autofill.FillDuration.FromLoad.WithoutAutofill", 16, 1); | 2496 "Autofill.FillDuration.FromLoad.WithoutAutofill", 16, 1); |
| 2463 histogram_tester.ExpectTotalCount( | 2497 histogram_tester.ExpectTotalCount( |
| 2464 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); | 2498 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); |
| 2465 histogram_tester.ExpectTotalCount( | 2499 histogram_tester.ExpectTotalCount( |
| 2466 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 2500 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
| 2467 | 2501 |
| 2468 autofill_manager_->Reset(); | 2502 autofill_manager_->Reset(); |
| 2469 } | 2503 } |
| 2470 | 2504 |
| 2471 // Expect metric to be logged if the user manually edited a form field. | 2505 // Expect metric to be logged if the user manually edited a form field. |
| 2472 { | 2506 { |
| 2473 base::HistogramTester histogram_tester; | 2507 base::HistogramTester histogram_tester; |
| 2474 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 2508 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); |
| 2475 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | 2509 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), |
| 2476 TimeTicks::FromInternalValue(3)); | 2510 TimeTicks::FromInternalValue(3)); |
| 2477 autofill_manager_->WillSubmitForm(form, TimeTicks::FromInternalValue(17)); | 2511 autofill_manager_->SubmitForm(form, TimeTicks::FromInternalValue(17)); |
| 2478 | 2512 |
| 2479 histogram_tester.ExpectTotalCount( | 2513 histogram_tester.ExpectTotalCount( |
| 2480 "Autofill.FillDuration.FromLoad.WithAutofill", 0); | 2514 "Autofill.FillDuration.FromLoad.WithAutofill", 0); |
| 2481 histogram_tester.ExpectUniqueSample( | 2515 histogram_tester.ExpectUniqueSample( |
| 2482 "Autofill.FillDuration.FromLoad.WithoutAutofill", 16, 1); | 2516 "Autofill.FillDuration.FromLoad.WithoutAutofill", 16, 1); |
| 2483 histogram_tester.ExpectTotalCount( | 2517 histogram_tester.ExpectTotalCount( |
| 2484 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); | 2518 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); |
| 2485 histogram_tester.ExpectUniqueSample( | 2519 histogram_tester.ExpectUniqueSample( |
| 2486 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 14, 1); | 2520 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 14, 1); |
| 2487 | 2521 |
| 2488 autofill_manager_->Reset(); | 2522 autofill_manager_->Reset(); |
| 2489 } | 2523 } |
| 2490 | 2524 |
| 2491 // Expect metric to be logged if the user autofilled the form. | 2525 // Expect metric to be logged if the user autofilled the form. |
| 2492 form.fields[0].is_autofilled = true; | 2526 form.fields[0].is_autofilled = true; |
| 2493 { | 2527 { |
| 2494 base::HistogramTester histogram_tester; | 2528 base::HistogramTester histogram_tester; |
| 2495 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 2529 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); |
| 2496 autofill_manager_->OnDidFillAutofillFormData( | 2530 autofill_manager_->OnDidFillAutofillFormData( |
| 2497 TimeTicks::FromInternalValue(5)); | 2531 TimeTicks::FromInternalValue(5)); |
| 2498 autofill_manager_->WillSubmitForm(form, TimeTicks::FromInternalValue(17)); | 2532 autofill_manager_->SubmitForm(form, TimeTicks::FromInternalValue(17)); |
| 2499 | 2533 |
| 2500 histogram_tester.ExpectUniqueSample( | 2534 histogram_tester.ExpectUniqueSample( |
| 2501 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); | 2535 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); |
| 2502 histogram_tester.ExpectTotalCount( | 2536 histogram_tester.ExpectTotalCount( |
| 2503 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); | 2537 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); |
| 2504 histogram_tester.ExpectUniqueSample( | 2538 histogram_tester.ExpectUniqueSample( |
| 2505 "Autofill.FillDuration.FromInteraction.WithAutofill", 12, 1); | 2539 "Autofill.FillDuration.FromInteraction.WithAutofill", 12, 1); |
| 2506 histogram_tester.ExpectTotalCount( | 2540 histogram_tester.ExpectTotalCount( |
| 2507 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 2541 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
| 2508 | 2542 |
| 2509 autofill_manager_->Reset(); | 2543 autofill_manager_->Reset(); |
| 2510 } | 2544 } |
| 2511 | 2545 |
| 2512 // Expect metric to be logged if the user both manually filled some fields | 2546 // Expect metric to be logged if the user both manually filled some fields |
| 2513 // and autofilled others. Messages can arrive out of order, so make sure they | 2547 // and autofilled others. Messages can arrive out of order, so make sure they |
| 2514 // take precedence appropriately. | 2548 // take precedence appropriately. |
| 2515 { | 2549 { |
| 2516 base::HistogramTester histogram_tester; | 2550 base::HistogramTester histogram_tester; |
| 2517 | 2551 |
| 2518 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 2552 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); |
| 2519 autofill_manager_->OnDidFillAutofillFormData( | 2553 autofill_manager_->OnDidFillAutofillFormData( |
| 2520 TimeTicks::FromInternalValue(5)); | 2554 TimeTicks::FromInternalValue(5)); |
| 2521 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | 2555 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), |
| 2522 TimeTicks::FromInternalValue(3)); | 2556 TimeTicks::FromInternalValue(3)); |
| 2523 autofill_manager_->WillSubmitForm(form, TimeTicks::FromInternalValue(17)); | 2557 autofill_manager_->SubmitForm(form, TimeTicks::FromInternalValue(17)); |
| 2524 | 2558 |
| 2525 histogram_tester.ExpectUniqueSample( | 2559 histogram_tester.ExpectUniqueSample( |
| 2526 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); | 2560 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); |
| 2527 histogram_tester.ExpectTotalCount( | 2561 histogram_tester.ExpectTotalCount( |
| 2528 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); | 2562 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); |
| 2529 histogram_tester.ExpectUniqueSample( | 2563 histogram_tester.ExpectUniqueSample( |
| 2530 "Autofill.FillDuration.FromInteraction.WithAutofill", 14, 1); | 2564 "Autofill.FillDuration.FromInteraction.WithAutofill", 14, 1); |
| 2531 histogram_tester.ExpectTotalCount( | 2565 histogram_tester.ExpectTotalCount( |
| 2532 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 2566 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
| 2533 | 2567 |
| 2534 autofill_manager_->Reset(); | 2568 autofill_manager_->Reset(); |
| 2535 } | 2569 } |
| 2536 | 2570 |
| 2537 // Make sure that loading another form doesn't affect metrics from the first | 2571 // Make sure that loading another form doesn't affect metrics from the first |
| 2538 // form. | 2572 // form. |
| 2539 { | 2573 { |
| 2540 base::HistogramTester histogram_tester; | 2574 base::HistogramTester histogram_tester; |
| 2541 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 2575 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); |
| 2542 autofill_manager_->OnFormsSeen(second_forms, | 2576 autofill_manager_->OnFormsSeen(second_forms, |
| 2543 TimeTicks::FromInternalValue(3)); | 2577 TimeTicks::FromInternalValue(3)); |
| 2544 autofill_manager_->OnDidFillAutofillFormData( | 2578 autofill_manager_->OnDidFillAutofillFormData( |
| 2545 TimeTicks::FromInternalValue(5)); | 2579 TimeTicks::FromInternalValue(5)); |
| 2546 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | 2580 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), |
| 2547 TimeTicks::FromInternalValue(3)); | 2581 TimeTicks::FromInternalValue(3)); |
| 2548 autofill_manager_->WillSubmitForm(form, TimeTicks::FromInternalValue(17)); | 2582 autofill_manager_->SubmitForm(form, TimeTicks::FromInternalValue(17)); |
| 2549 | 2583 |
| 2550 histogram_tester.ExpectUniqueSample( | 2584 histogram_tester.ExpectUniqueSample( |
| 2551 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); | 2585 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); |
| 2552 histogram_tester.ExpectTotalCount( | 2586 histogram_tester.ExpectTotalCount( |
| 2553 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); | 2587 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); |
| 2554 histogram_tester.ExpectUniqueSample( | 2588 histogram_tester.ExpectUniqueSample( |
| 2555 "Autofill.FillDuration.FromInteraction.WithAutofill", 14, 1); | 2589 "Autofill.FillDuration.FromInteraction.WithAutofill", 14, 1); |
| 2556 histogram_tester.ExpectTotalCount( | 2590 histogram_tester.ExpectTotalCount( |
| 2557 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 2591 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
| 2558 | 2592 |
| 2559 autofill_manager_->Reset(); | 2593 autofill_manager_->Reset(); |
| 2560 } | 2594 } |
| 2561 | 2595 |
| 2562 // Make sure that submitting a form that was loaded later will report the | 2596 // Make sure that submitting a form that was loaded later will report the |
| 2563 // later loading time. | 2597 // later loading time. |
| 2564 { | 2598 { |
| 2565 base::HistogramTester histogram_tester; | 2599 base::HistogramTester histogram_tester; |
| 2566 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 2600 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); |
| 2567 autofill_manager_->OnFormsSeen(second_forms, | 2601 autofill_manager_->OnFormsSeen(second_forms, |
| 2568 TimeTicks::FromInternalValue(5)); | 2602 TimeTicks::FromInternalValue(5)); |
| 2569 autofill_manager_->WillSubmitForm(second_form, | 2603 autofill_manager_->SubmitForm(second_form, |
| 2570 TimeTicks::FromInternalValue(17)); | 2604 TimeTicks::FromInternalValue(17)); |
| 2571 | 2605 |
| 2572 histogram_tester.ExpectTotalCount( | 2606 histogram_tester.ExpectTotalCount( |
| 2573 "Autofill.FillDuration.FromLoad.WithAutofill", 0); | 2607 "Autofill.FillDuration.FromLoad.WithAutofill", 0); |
| 2574 histogram_tester.ExpectUniqueSample( | 2608 histogram_tester.ExpectUniqueSample( |
| 2575 "Autofill.FillDuration.FromLoad.WithoutAutofill", 12, 1); | 2609 "Autofill.FillDuration.FromLoad.WithoutAutofill", 12, 1); |
| 2576 histogram_tester.ExpectTotalCount( | 2610 histogram_tester.ExpectTotalCount( |
| 2577 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); | 2611 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); |
| 2578 histogram_tester.ExpectTotalCount( | 2612 histogram_tester.ExpectTotalCount( |
| 2579 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 2613 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
| 2580 | 2614 |
| 2581 autofill_manager_->Reset(); | 2615 autofill_manager_->Reset(); |
| 2582 } | 2616 } |
| 2583 } | 2617 } |
| 2584 | 2618 |
| 2585 } // namespace autofill | 2619 } // namespace autofill |
| OLD | NEW |