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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 test::CreateTestFormField("Name", "name", "", "text", &field); | 517 test::CreateTestFormField("Name", "name", "", "text", &field); |
518 form.fields.push_back(field); | 518 form.fields.push_back(field); |
519 test::CreateTestFormField("Email", "email", "", "text", &field); | 519 test::CreateTestFormField("Email", "email", "", "text", &field); |
520 form.fields.push_back(field); | 520 form.fields.push_back(field); |
521 | 521 |
522 std::vector<FormData> forms(1, form); | 522 std::vector<FormData> forms(1, form); |
523 | 523 |
524 // Ensure no metrics are logged when loading a non-fillable form. | 524 // Ensure no metrics are logged when loading a non-fillable form. |
525 { | 525 { |
526 base::HistogramTester histogram_tester; | 526 base::HistogramTester histogram_tester; |
527 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 527 autofill_manager_->OnFormsSeen(forms, false, TimeTicks()); |
528 autofill_manager_->Reset(); | 528 autofill_manager_->Reset(); |
529 histogram_tester.ExpectTotalCount("Autofill.DeveloperEngagement", 0); | 529 histogram_tester.ExpectTotalCount("Autofill.DeveloperEngagement", 0); |
530 } | 530 } |
531 | 531 |
532 // Add another field to the form, so that it becomes fillable. | 532 // Add another field to the form, so that it becomes fillable. |
533 test::CreateTestFormField("Phone", "phone", "", "text", &field); | 533 test::CreateTestFormField("Phone", "phone", "", "text", &field); |
534 forms.back().fields.push_back(field); | 534 forms.back().fields.push_back(field); |
535 | 535 |
536 // Expect only the "form parsed" metric to be logged; no metrics about | 536 // Expect only the "form parsed" metric to be logged; no metrics about |
537 // author-specified field type hints. | 537 // author-specified field type hints. |
538 { | 538 { |
539 base::HistogramTester histogram_tester; | 539 base::HistogramTester histogram_tester; |
540 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 540 autofill_manager_->OnFormsSeen(forms, false, TimeTicks()); |
541 autofill_manager_->Reset(); | 541 autofill_manager_->Reset(); |
542 histogram_tester.ExpectUniqueSample("Autofill.DeveloperEngagement", | 542 histogram_tester.ExpectUniqueSample("Autofill.DeveloperEngagement", |
543 AutofillMetrics::FILLABLE_FORM_PARSED, | 543 AutofillMetrics::FILLABLE_FORM_PARSED, |
544 1); | 544 1); |
545 } | 545 } |
546 | 546 |
547 // Add some fields with an author-specified field type to the form. | 547 // Add some fields with an author-specified field type to the form. |
548 // We need to add at least three fields, because a form must have at least | 548 // We need to add at least three fields, because a form must have at least |
549 // three fillable fields to be considered to be autofillable; and if at least | 549 // three fillable fields to be considered to be autofillable; and if at least |
550 // one field specifies an explicit type hint, we don't apply any of our usual | 550 // one field specifies an explicit type hint, we don't apply any of our usual |
551 // local heuristics to detect field types in the rest of the form. | 551 // local heuristics to detect field types in the rest of the form. |
552 test::CreateTestFormField("", "", "", "text", &field); | 552 test::CreateTestFormField("", "", "", "text", &field); |
553 field.autocomplete_attribute = "given-name"; | 553 field.autocomplete_attribute = "given-name"; |
554 forms.back().fields.push_back(field); | 554 forms.back().fields.push_back(field); |
555 test::CreateTestFormField("", "", "", "text", &field); | 555 test::CreateTestFormField("", "", "", "text", &field); |
556 field.autocomplete_attribute = "email"; | 556 field.autocomplete_attribute = "email"; |
557 forms.back().fields.push_back(field); | 557 forms.back().fields.push_back(field); |
558 test::CreateTestFormField("", "", "", "text", &field); | 558 test::CreateTestFormField("", "", "", "text", &field); |
559 field.autocomplete_attribute = "address-line1"; | 559 field.autocomplete_attribute = "address-line1"; |
560 forms.back().fields.push_back(field); | 560 forms.back().fields.push_back(field); |
561 | 561 |
562 // Expect both the "form parsed" metric and the author-specified field type | 562 // Expect both the "form parsed" metric and the author-specified field type |
563 // hints metric to be logged. | 563 // hints metric to be logged. |
564 { | 564 { |
565 base::HistogramTester histogram_tester; | 565 base::HistogramTester histogram_tester; |
566 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 566 autofill_manager_->OnFormsSeen(forms, false, TimeTicks()); |
567 autofill_manager_->Reset(); | 567 autofill_manager_->Reset(); |
568 histogram_tester.ExpectBucketCount("Autofill.DeveloperEngagement", | 568 histogram_tester.ExpectBucketCount("Autofill.DeveloperEngagement", |
569 AutofillMetrics::FILLABLE_FORM_PARSED, | 569 AutofillMetrics::FILLABLE_FORM_PARSED, |
570 1); | 570 1); |
571 histogram_tester.ExpectBucketCount( | 571 histogram_tester.ExpectBucketCount( |
572 "Autofill.DeveloperEngagement", | 572 "Autofill.DeveloperEngagement", |
573 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS, 1); | 573 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS, 1); |
574 } | 574 } |
575 } | 575 } |
576 | 576 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), | 677 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::Rect(), |
678 false); | 678 false); |
679 histogram_tester.ExpectTotalCount("Autofill.AddressSuggestionsCount", 0); | 679 histogram_tester.ExpectTotalCount("Autofill.AddressSuggestionsCount", 0); |
680 } | 680 } |
681 } | 681 } |
682 | 682 |
683 // Test that we log that Autofill is enabled when filling a form. | 683 // Test that we log that Autofill is enabled when filling a form. |
684 TEST_F(AutofillMetricsTest, AutofillIsEnabledAtPageLoad) { | 684 TEST_F(AutofillMetricsTest, AutofillIsEnabledAtPageLoad) { |
685 base::HistogramTester histogram_tester; | 685 base::HistogramTester histogram_tester; |
686 autofill_manager_->set_autofill_enabled(true); | 686 autofill_manager_->set_autofill_enabled(true); |
687 autofill_manager_->OnFormsSeen(std::vector<FormData>(), TimeTicks()); | 687 autofill_manager_->OnFormsSeen(std::vector<FormData>(), false, TimeTicks()); |
688 histogram_tester.ExpectUniqueSample("Autofill.IsEnabled.PageLoad", true, 1); | 688 histogram_tester.ExpectUniqueSample("Autofill.IsEnabled.PageLoad", true, 1); |
689 } | 689 } |
690 | 690 |
691 // Test that we log that Autofill is disabled when filling a form. | 691 // Test that we log that Autofill is disabled when filling a form. |
692 TEST_F(AutofillMetricsTest, AutofillIsDisabledAtPageLoad) { | 692 TEST_F(AutofillMetricsTest, AutofillIsDisabledAtPageLoad) { |
693 base::HistogramTester histogram_tester; | 693 base::HistogramTester histogram_tester; |
694 autofill_manager_->set_autofill_enabled(false); | 694 autofill_manager_->set_autofill_enabled(false); |
695 autofill_manager_->OnFormsSeen(std::vector<FormData>(), TimeTicks()); | 695 autofill_manager_->OnFormsSeen(std::vector<FormData>(), false, TimeTicks()); |
696 histogram_tester.ExpectUniqueSample("Autofill.IsEnabled.PageLoad", false, 1); | 696 histogram_tester.ExpectUniqueSample("Autofill.IsEnabled.PageLoad", false, 1); |
697 } | 697 } |
698 | 698 |
699 // Verify that we correctly log user happiness metrics dealing with form loading | 699 // Verify that we correctly log user happiness metrics dealing with form loading |
700 // and form submission. | 700 // and form submission. |
701 TEST_F(AutofillMetricsTest, UserHappinessFormLoadAndSubmission) { | 701 TEST_F(AutofillMetricsTest, UserHappinessFormLoadAndSubmission) { |
702 // Start with a form with insufficiently many fields. | 702 // Start with a form with insufficiently many fields. |
703 FormData form; | 703 FormData form; |
704 form.name = ASCIIToUTF16("TestForm"); | 704 form.name = ASCIIToUTF16("TestForm"); |
705 form.origin = GURL("http://example.com/form.html"); | 705 form.origin = GURL("http://example.com/form.html"); |
706 form.action = GURL("http://example.com/submit.html"); | 706 form.action = GURL("http://example.com/submit.html"); |
707 form.user_submitted = true; | 707 form.user_submitted = true; |
708 | 708 |
709 FormFieldData field; | 709 FormFieldData field; |
710 test::CreateTestFormField("Name", "name", "", "text", &field); | 710 test::CreateTestFormField("Name", "name", "", "text", &field); |
711 form.fields.push_back(field); | 711 form.fields.push_back(field); |
712 test::CreateTestFormField("Email", "email", "", "text", &field); | 712 test::CreateTestFormField("Email", "email", "", "text", &field); |
713 form.fields.push_back(field); | 713 form.fields.push_back(field); |
714 | 714 |
715 std::vector<FormData> forms(1, form); | 715 std::vector<FormData> forms(1, form); |
716 | 716 |
717 // Expect no notifications when the form is first seen. | 717 // Expect no notifications when the form is first seen. |
718 { | 718 { |
719 base::HistogramTester histogram_tester; | 719 base::HistogramTester histogram_tester; |
720 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 720 autofill_manager_->OnFormsSeen(forms, false, TimeTicks()); |
721 histogram_tester.ExpectTotalCount("Autofill.UserHappiness", 0); | 721 histogram_tester.ExpectTotalCount("Autofill.UserHappiness", 0); |
722 } | 722 } |
723 | 723 |
724 | 724 |
725 // Expect no notifications when the form is submitted. | 725 // Expect no notifications when the form is submitted. |
726 { | 726 { |
727 base::HistogramTester histogram_tester; | 727 base::HistogramTester histogram_tester; |
728 autofill_manager_->FormSubmitted(form, TimeTicks::Now()); | 728 autofill_manager_->FormSubmitted(form, TimeTicks::Now()); |
729 histogram_tester.ExpectTotalCount("Autofill.UserHappiness", 0); | 729 histogram_tester.ExpectTotalCount("Autofill.UserHappiness", 0); |
730 } | 730 } |
731 | 731 |
732 // Add more fields to the form. | 732 // Add more fields to the form. |
733 test::CreateTestFormField("Phone", "phone", "", "text", &field); | 733 test::CreateTestFormField("Phone", "phone", "", "text", &field); |
734 form.fields.push_back(field); | 734 form.fields.push_back(field); |
735 test::CreateTestFormField("Unknown", "unknown", "", "text", &field); | 735 test::CreateTestFormField("Unknown", "unknown", "", "text", &field); |
736 form.fields.push_back(field); | 736 form.fields.push_back(field); |
737 forms.front() = form; | 737 forms.front() = form; |
738 | 738 |
739 // Expect a notification when the form is first seen. | 739 // Expect a notification when the form is first seen. |
740 { | 740 { |
741 base::HistogramTester histogram_tester; | 741 base::HistogramTester histogram_tester; |
742 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 742 autofill_manager_->OnFormsSeen(forms, false, TimeTicks()); |
743 histogram_tester.ExpectUniqueSample("Autofill.UserHappiness", | 743 histogram_tester.ExpectUniqueSample("Autofill.UserHappiness", |
744 AutofillMetrics::FORMS_LOADED, 1); | 744 AutofillMetrics::FORMS_LOADED, 1); |
745 } | 745 } |
746 | 746 |
747 // Expect a notification when the form is submitted. | 747 // Expect a notification when the form is submitted. |
748 { | 748 { |
749 base::HistogramTester histogram_tester; | 749 base::HistogramTester histogram_tester; |
750 autofill_manager_->FormSubmitted(form, TimeTicks::Now()); | 750 autofill_manager_->FormSubmitted(form, TimeTicks::Now()); |
751 histogram_tester.ExpectUniqueSample( | 751 histogram_tester.ExpectUniqueSample( |
752 "Autofill.UserHappiness", AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM, | 752 "Autofill.UserHappiness", AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 test::CreateTestFormField("Email", "email", "", "text", &field); | 838 test::CreateTestFormField("Email", "email", "", "text", &field); |
839 form.fields.push_back(field); | 839 form.fields.push_back(field); |
840 test::CreateTestFormField("Phone", "phone", "", "text", &field); | 840 test::CreateTestFormField("Phone", "phone", "", "text", &field); |
841 form.fields.push_back(field); | 841 form.fields.push_back(field); |
842 | 842 |
843 std::vector<FormData> forms(1, form); | 843 std::vector<FormData> forms(1, form); |
844 | 844 |
845 // Expect a notification when the form is first seen. | 845 // Expect a notification when the form is first seen. |
846 { | 846 { |
847 base::HistogramTester histogram_tester; | 847 base::HistogramTester histogram_tester; |
848 autofill_manager_->OnFormsSeen(forms, TimeTicks()); | 848 autofill_manager_->OnFormsSeen(forms, false, TimeTicks()); |
849 histogram_tester.ExpectUniqueSample("Autofill.UserHappiness", | 849 histogram_tester.ExpectUniqueSample("Autofill.UserHappiness", |
850 AutofillMetrics::FORMS_LOADED, 1); | 850 AutofillMetrics::FORMS_LOADED, 1); |
851 } | 851 } |
852 | 852 |
853 // Simulate typing. | 853 // Simulate typing. |
854 { | 854 { |
855 base::HistogramTester histogram_tester; | 855 base::HistogramTester histogram_tester; |
856 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | 856 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), |
857 TimeTicks()); | 857 TimeTicks()); |
858 histogram_tester.ExpectUniqueSample("Autofill.UserHappiness", | 858 histogram_tester.ExpectUniqueSample("Autofill.UserHappiness", |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 // Fill the field values for form submission. | 963 // Fill the field values for form submission. |
964 second_form.fields[0].value = ASCIIToUTF16("Elvis Aaron Presley"); | 964 second_form.fields[0].value = ASCIIToUTF16("Elvis Aaron Presley"); |
965 second_form.fields[1].value = ASCIIToUTF16("theking@gmail.com"); | 965 second_form.fields[1].value = ASCIIToUTF16("theking@gmail.com"); |
966 second_form.fields[2].value = ASCIIToUTF16("12345678901"); | 966 second_form.fields[2].value = ASCIIToUTF16("12345678901"); |
967 second_form.fields[3].value = ASCIIToUTF16("51512345678"); | 967 second_form.fields[3].value = ASCIIToUTF16("51512345678"); |
968 | 968 |
969 // Expect only form load metrics to be logged if the form is submitted without | 969 // Expect only form load metrics to be logged if the form is submitted without |
970 // user interaction. | 970 // user interaction. |
971 { | 971 { |
972 base::HistogramTester histogram_tester; | 972 base::HistogramTester histogram_tester; |
973 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 973 autofill_manager_->OnFormsSeen(forms, false, |
| 974 TimeTicks::FromInternalValue(1)); |
974 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); | 975 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); |
975 | 976 |
976 histogram_tester.ExpectTotalCount( | 977 histogram_tester.ExpectTotalCount( |
977 "Autofill.FillDuration.FromLoad.WithAutofill", 0); | 978 "Autofill.FillDuration.FromLoad.WithAutofill", 0); |
978 histogram_tester.ExpectUniqueSample( | 979 histogram_tester.ExpectUniqueSample( |
979 "Autofill.FillDuration.FromLoad.WithoutAutofill", 16, 1); | 980 "Autofill.FillDuration.FromLoad.WithoutAutofill", 16, 1); |
980 histogram_tester.ExpectTotalCount( | 981 histogram_tester.ExpectTotalCount( |
981 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); | 982 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); |
982 histogram_tester.ExpectTotalCount( | 983 histogram_tester.ExpectTotalCount( |
983 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 984 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
984 | 985 |
985 autofill_manager_->Reset(); | 986 autofill_manager_->Reset(); |
986 } | 987 } |
987 | 988 |
988 // Expect metric to be logged if the user manually edited a form field. | 989 // Expect metric to be logged if the user manually edited a form field. |
989 { | 990 { |
990 base::HistogramTester histogram_tester; | 991 base::HistogramTester histogram_tester; |
991 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 992 autofill_manager_->OnFormsSeen(forms, false, |
| 993 TimeTicks::FromInternalValue(1)); |
992 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | 994 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), |
993 TimeTicks::FromInternalValue(3)); | 995 TimeTicks::FromInternalValue(3)); |
994 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); | 996 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); |
995 | 997 |
996 histogram_tester.ExpectTotalCount( | 998 histogram_tester.ExpectTotalCount( |
997 "Autofill.FillDuration.FromLoad.WithAutofill", 0); | 999 "Autofill.FillDuration.FromLoad.WithAutofill", 0); |
998 histogram_tester.ExpectUniqueSample( | 1000 histogram_tester.ExpectUniqueSample( |
999 "Autofill.FillDuration.FromLoad.WithoutAutofill", 16, 1); | 1001 "Autofill.FillDuration.FromLoad.WithoutAutofill", 16, 1); |
1000 histogram_tester.ExpectTotalCount( | 1002 histogram_tester.ExpectTotalCount( |
1001 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); | 1003 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); |
1002 histogram_tester.ExpectUniqueSample( | 1004 histogram_tester.ExpectUniqueSample( |
1003 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 14, 1); | 1005 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 14, 1); |
1004 | 1006 |
1005 autofill_manager_->Reset(); | 1007 autofill_manager_->Reset(); |
1006 } | 1008 } |
1007 | 1009 |
1008 // Expect metric to be logged if the user autofilled the form. | 1010 // Expect metric to be logged if the user autofilled the form. |
1009 form.fields[0].is_autofilled = true; | 1011 form.fields[0].is_autofilled = true; |
1010 { | 1012 { |
1011 base::HistogramTester histogram_tester; | 1013 base::HistogramTester histogram_tester; |
1012 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 1014 autofill_manager_->OnFormsSeen(forms, false, |
| 1015 TimeTicks::FromInternalValue(1)); |
1013 autofill_manager_->OnDidFillAutofillFormData( | 1016 autofill_manager_->OnDidFillAutofillFormData( |
1014 TimeTicks::FromInternalValue(5)); | 1017 TimeTicks::FromInternalValue(5)); |
1015 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); | 1018 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); |
1016 | 1019 |
1017 histogram_tester.ExpectUniqueSample( | 1020 histogram_tester.ExpectUniqueSample( |
1018 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); | 1021 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); |
1019 histogram_tester.ExpectTotalCount( | 1022 histogram_tester.ExpectTotalCount( |
1020 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); | 1023 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); |
1021 histogram_tester.ExpectUniqueSample( | 1024 histogram_tester.ExpectUniqueSample( |
1022 "Autofill.FillDuration.FromInteraction.WithAutofill", 12, 1); | 1025 "Autofill.FillDuration.FromInteraction.WithAutofill", 12, 1); |
1023 histogram_tester.ExpectTotalCount( | 1026 histogram_tester.ExpectTotalCount( |
1024 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 1027 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
1025 | 1028 |
1026 autofill_manager_->Reset(); | 1029 autofill_manager_->Reset(); |
1027 } | 1030 } |
1028 | 1031 |
1029 // Expect metric to be logged if the user both manually filled some fields | 1032 // Expect metric to be logged if the user both manually filled some fields |
1030 // and autofilled others. Messages can arrive out of order, so make sure they | 1033 // and autofilled others. Messages can arrive out of order, so make sure they |
1031 // take precedence appropriately. | 1034 // take precedence appropriately. |
1032 { | 1035 { |
1033 base::HistogramTester histogram_tester; | 1036 base::HistogramTester histogram_tester; |
1034 | 1037 |
1035 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 1038 autofill_manager_->OnFormsSeen(forms, false, |
| 1039 TimeTicks::FromInternalValue(1)); |
1036 autofill_manager_->OnDidFillAutofillFormData( | 1040 autofill_manager_->OnDidFillAutofillFormData( |
1037 TimeTicks::FromInternalValue(5)); | 1041 TimeTicks::FromInternalValue(5)); |
1038 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | 1042 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), |
1039 TimeTicks::FromInternalValue(3)); | 1043 TimeTicks::FromInternalValue(3)); |
1040 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); | 1044 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); |
1041 | 1045 |
1042 histogram_tester.ExpectUniqueSample( | 1046 histogram_tester.ExpectUniqueSample( |
1043 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); | 1047 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); |
1044 histogram_tester.ExpectTotalCount( | 1048 histogram_tester.ExpectTotalCount( |
1045 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); | 1049 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); |
1046 histogram_tester.ExpectUniqueSample( | 1050 histogram_tester.ExpectUniqueSample( |
1047 "Autofill.FillDuration.FromInteraction.WithAutofill", 14, 1); | 1051 "Autofill.FillDuration.FromInteraction.WithAutofill", 14, 1); |
1048 histogram_tester.ExpectTotalCount( | 1052 histogram_tester.ExpectTotalCount( |
1049 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 1053 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
1050 | 1054 |
1051 autofill_manager_->Reset(); | 1055 autofill_manager_->Reset(); |
1052 } | 1056 } |
1053 | 1057 |
1054 // Make sure that loading another form doesn't affect metrics from the first | 1058 // Make sure that loading another form doesn't affect metrics from the first |
1055 // form. | 1059 // form. |
1056 { | 1060 { |
1057 base::HistogramTester histogram_tester; | 1061 base::HistogramTester histogram_tester; |
1058 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 1062 autofill_manager_->OnFormsSeen(forms, false, |
1059 autofill_manager_->OnFormsSeen(second_forms, | 1063 TimeTicks::FromInternalValue(1)); |
| 1064 autofill_manager_->OnFormsSeen(second_forms, false, |
1060 TimeTicks::FromInternalValue(3)); | 1065 TimeTicks::FromInternalValue(3)); |
1061 autofill_manager_->OnDidFillAutofillFormData( | 1066 autofill_manager_->OnDidFillAutofillFormData( |
1062 TimeTicks::FromInternalValue(5)); | 1067 TimeTicks::FromInternalValue(5)); |
1063 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | 1068 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), |
1064 TimeTicks::FromInternalValue(3)); | 1069 TimeTicks::FromInternalValue(3)); |
1065 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); | 1070 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); |
1066 | 1071 |
1067 histogram_tester.ExpectUniqueSample( | 1072 histogram_tester.ExpectUniqueSample( |
1068 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); | 1073 "Autofill.FillDuration.FromLoad.WithAutofill", 16, 1); |
1069 histogram_tester.ExpectTotalCount( | 1074 histogram_tester.ExpectTotalCount( |
1070 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); | 1075 "Autofill.FillDuration.FromLoad.WithoutAutofill", 0); |
1071 histogram_tester.ExpectUniqueSample( | 1076 histogram_tester.ExpectUniqueSample( |
1072 "Autofill.FillDuration.FromInteraction.WithAutofill", 14, 1); | 1077 "Autofill.FillDuration.FromInteraction.WithAutofill", 14, 1); |
1073 histogram_tester.ExpectTotalCount( | 1078 histogram_tester.ExpectTotalCount( |
1074 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 1079 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
1075 | 1080 |
1076 autofill_manager_->Reset(); | 1081 autofill_manager_->Reset(); |
1077 } | 1082 } |
1078 | 1083 |
1079 // Make sure that submitting a form that was loaded later will report the | 1084 // Make sure that submitting a form that was loaded later will report the |
1080 // later loading time. | 1085 // later loading time. |
1081 { | 1086 { |
1082 base::HistogramTester histogram_tester; | 1087 base::HistogramTester histogram_tester; |
1083 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); | 1088 autofill_manager_->OnFormsSeen(forms, false, |
1084 autofill_manager_->OnFormsSeen(second_forms, | 1089 TimeTicks::FromInternalValue(1)); |
| 1090 autofill_manager_->OnFormsSeen(second_forms, false, |
1085 TimeTicks::FromInternalValue(5)); | 1091 TimeTicks::FromInternalValue(5)); |
1086 autofill_manager_->FormSubmitted(second_form, | 1092 autofill_manager_->FormSubmitted(second_form, |
1087 TimeTicks::FromInternalValue(17)); | 1093 TimeTicks::FromInternalValue(17)); |
1088 | 1094 |
1089 histogram_tester.ExpectTotalCount( | 1095 histogram_tester.ExpectTotalCount( |
1090 "Autofill.FillDuration.FromLoad.WithAutofill", 0); | 1096 "Autofill.FillDuration.FromLoad.WithAutofill", 0); |
1091 histogram_tester.ExpectUniqueSample( | 1097 histogram_tester.ExpectUniqueSample( |
1092 "Autofill.FillDuration.FromLoad.WithoutAutofill", 12, 1); | 1098 "Autofill.FillDuration.FromLoad.WithoutAutofill", 12, 1); |
1093 histogram_tester.ExpectTotalCount( | 1099 histogram_tester.ExpectTotalCount( |
1094 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); | 1100 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); |
1095 histogram_tester.ExpectTotalCount( | 1101 histogram_tester.ExpectTotalCount( |
1096 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 1102 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
1097 | 1103 |
1098 autofill_manager_->Reset(); | 1104 autofill_manager_->Reset(); |
1099 } | 1105 } |
1100 } | 1106 } |
1101 | 1107 |
1102 } // namespace autofill | 1108 } // namespace autofill |
OLD | NEW |