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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 } | 180 } |
181 if (include_full_server_credit_card) { | 181 if (include_full_server_credit_card) { |
182 std::unique_ptr<CreditCard> credit_card = base::MakeUnique<CreditCard>( | 182 std::unique_ptr<CreditCard> credit_card = base::MakeUnique<CreditCard>( |
183 CreditCard::FULL_SERVER_CARD, "server_id"); | 183 CreditCard::FULL_SERVER_CARD, "server_id"); |
184 credit_card->set_guid("10000000-0000-0000-0000-000000000003"); | 184 credit_card->set_guid("10000000-0000-0000-0000-000000000003"); |
185 server_credit_cards_.push_back(std::move(credit_card)); | 185 server_credit_cards_.push_back(std::move(credit_card)); |
186 } | 186 } |
187 Refresh(); | 187 Refresh(); |
188 } | 188 } |
189 | 189 |
190 // Removes all existing credit cards and creates 1 server card with bank names | |
Jared Saul
2017/06/14 16:49:15
s/with bank names/with a bank name
Shanfeng
2017/06/14 17:48:25
Done.
| |
191 void RecreateServerCreditCardsWithBankNames() { | |
Jared Saul
2017/06/14 16:49:16
s/CardsWithBankNames/CardWithBankName
Since it's o
Shanfeng
2017/06/14 17:48:25
Done.
| |
192 server_credit_cards_.clear(); | |
193 std::unique_ptr<CreditCard> credit_card = base::MakeUnique<CreditCard>( | |
194 CreditCard::FULL_SERVER_CARD, "server_id"); | |
195 test::SetCreditCardInfo(credit_card.get(), "name", "4111111111111111", | |
196 "12", "24", "1"); | |
197 credit_card->set_guid("10000000-0000-0000-0000-000000000003"); | |
198 credit_card->set_bank_name("Chase"); | |
199 server_credit_cards_.push_back(std::move(credit_card)); | |
200 Refresh(); | |
201 } | |
202 | |
190 bool IsAutofillEnabled() const override { return autofill_enabled_; } | 203 bool IsAutofillEnabled() const override { return autofill_enabled_; } |
191 | 204 |
192 void CreateAmbiguousProfiles() { | 205 void CreateAmbiguousProfiles() { |
193 web_profiles_.clear(); | 206 web_profiles_.clear(); |
194 CreateTestAutofillProfiles(&web_profiles_); | 207 CreateTestAutofillProfiles(&web_profiles_); |
195 | 208 |
196 auto profile = base::MakeUnique<AutofillProfile>(); | 209 auto profile = base::MakeUnique<AutofillProfile>(); |
197 test::SetProfileInfo(profile.get(), "John", "Decca", "Public", | 210 test::SetProfileInfo(profile.get(), "John", "Decca", "Public", |
198 "john@gmail.com", "Company", "123 Main St.", "unit 7", | 211 "john@gmail.com", "Company", "123 Main St.", "unit 7", |
199 "Springfield", "Texas", "79401", "US", "2345678901"); | 212 "Springfield", "Texas", "79401", "US", "2345678901"); |
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2522 { | 2535 { |
2523 // Simulating new popup being shown. | 2536 // Simulating new popup being shown. |
2524 base::HistogramTester histogram_tester; | 2537 base::HistogramTester histogram_tester; |
2525 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 2538 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); |
2526 histogram_tester.ExpectBucketCount( | 2539 histogram_tester.ExpectBucketCount( |
2527 "Autofill.FormEvents.CreditCard", | 2540 "Autofill.FormEvents.CreditCard", |
2528 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1); | 2541 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1); |
2529 histogram_tester.ExpectBucketCount( | 2542 histogram_tester.ExpectBucketCount( |
2530 "Autofill.FormEvents.CreditCard", | 2543 "Autofill.FormEvents.CreditCard", |
2531 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); | 2544 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); |
2545 // Check that the bank name histogram was not recorded. ExpectBucketCount() | |
2546 // can't be used here because it expects the histogram to exist. | |
2547 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( | |
2548 "Autofill.FormEvents.CreditCard") | |
2549 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]); | |
2532 } | 2550 } |
2533 | 2551 |
2534 // Reset the autofill manager state. | 2552 // Reset the autofill manager state. |
2535 autofill_manager_->Reset(); | 2553 autofill_manager_->Reset(); |
2536 autofill_manager_->AddSeenForm(form, field_types, field_types); | 2554 autofill_manager_->AddSeenForm(form, field_types, field_types); |
2537 | 2555 |
2538 { | 2556 { |
2539 // Simulating two popups in the same page load. | 2557 // Simulating two popups in the same page load. |
2540 base::HistogramTester histogram_tester; | 2558 base::HistogramTester histogram_tester; |
2541 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 2559 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); |
2542 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 2560 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); |
2543 histogram_tester.ExpectBucketCount( | 2561 histogram_tester.ExpectBucketCount( |
2544 "Autofill.FormEvents.CreditCard", | 2562 "Autofill.FormEvents.CreditCard", |
2545 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2); | 2563 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2); |
2546 histogram_tester.ExpectBucketCount( | 2564 histogram_tester.ExpectBucketCount( |
2547 "Autofill.FormEvents.CreditCard", | 2565 "Autofill.FormEvents.CreditCard", |
2548 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); | 2566 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); |
2567 // Check that the bank name histogram was not recorded. ExpectBucketCount() | |
2568 // can't be used here because it expects the histogram to exist. | |
2569 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( | |
2570 "Autofill.FormEvents.CreditCard") | |
2571 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]); | |
2549 } | 2572 } |
2550 | 2573 |
2551 // Reset the autofill manager state. | 2574 // Reset the autofill manager state. |
2552 autofill_manager_->Reset(); | 2575 autofill_manager_->Reset(); |
2553 autofill_manager_->AddSeenForm(form, field_types, field_types); | 2576 autofill_manager_->AddSeenForm(form, field_types, field_types); |
2554 | 2577 |
2555 { | 2578 { |
2556 // Simulating same popup being refreshed. | 2579 // Simulating same popup being refreshed. |
2557 base::HistogramTester histogram_tester; | 2580 base::HistogramTester histogram_tester; |
2558 autofill_manager_->DidShowSuggestions(false /* is_new_popup */, form, | 2581 autofill_manager_->DidShowSuggestions(false /* is_new_popup */, form, |
2559 field); | 2582 field); |
2560 histogram_tester.ExpectBucketCount( | 2583 histogram_tester.ExpectBucketCount( |
2561 "Autofill.FormEvents.CreditCard", | 2584 "Autofill.FormEvents.CreditCard", |
2562 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 0); | 2585 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 0); |
2563 histogram_tester.ExpectBucketCount( | 2586 histogram_tester.ExpectBucketCount( |
2564 "Autofill.FormEvents.CreditCard", | 2587 "Autofill.FormEvents.CreditCard", |
2565 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 0); | 2588 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 0); |
2589 // Check that the bank name histogram was not recorded. ExpectBucketCount() | |
2590 // can't be used here because it expects the histogram to exist. | |
2591 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( | |
2592 "Autofill.FormEvents.CreditCard") | |
2593 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]); | |
2594 } | |
2595 | |
2596 // Recreate server cards with bank names. | |
2597 personal_data_->RecreateServerCreditCardsWithBankNames(); | |
2598 | |
2599 // Reset the autofill manager state. | |
2600 autofill_manager_->Reset(); | |
2601 autofill_manager_->AddSeenForm(form, field_types, field_types); | |
2602 | |
2603 { | |
2604 // Simulating new popup being shown. | |
2605 base::HistogramTester histogram_tester; | |
2606 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | |
2607 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | |
2608 histogram_tester.ExpectBucketCount( | |
2609 "Autofill.FormEvents.CreditCard", | |
2610 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1); | |
2611 histogram_tester.ExpectBucketCount( | |
2612 "Autofill.FormEvents.CreditCard", | |
2613 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); | |
2614 histogram_tester.ExpectBucketCount( | |
2615 "Autofill.FormEvents.CreditCard.BankNameExperiment", | |
2616 AutofillMetrics:: | |
2617 FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE, | |
2618 1); | |
2619 } | |
2620 | |
2621 // Reset the autofill manager state. | |
2622 autofill_manager_->Reset(); | |
2623 autofill_manager_->AddSeenForm(form, field_types, field_types); | |
2624 | |
2625 { | |
2626 // Simulating two popups in the same page load. | |
2627 base::HistogramTester histogram_tester; | |
2628 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | |
2629 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | |
2630 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | |
2631 histogram_tester.ExpectBucketCount( | |
2632 "Autofill.FormEvents.CreditCard", | |
2633 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2); | |
2634 histogram_tester.ExpectBucketCount( | |
2635 "Autofill.FormEvents.CreditCard", | |
2636 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); | |
2637 histogram_tester.ExpectBucketCount( | |
2638 "Autofill.FormEvents.CreditCard.BankNameExperiment", | |
2639 AutofillMetrics:: | |
2640 FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE, | |
2641 1); | |
2566 } | 2642 } |
2567 } | 2643 } |
2568 | 2644 |
2569 // Test that we log selected form event for credit cards. | 2645 // Test that we log selected form event for credit cards. |
2570 TEST_F(AutofillMetricsTest, CreditCardSelectedFormEvents) { | 2646 TEST_F(AutofillMetricsTest, CreditCardSelectedFormEvents) { |
2571 EnableWalletSync(); | 2647 EnableWalletSync(); |
2572 // Creating all kinds of cards. | 2648 // Creating all kinds of cards. |
2573 personal_data_->RecreateCreditCards( | 2649 personal_data_->RecreateCreditCards( |
2574 true /* include_local_credit_card */, | 2650 true /* include_local_credit_card */, |
2575 true /* include_masked_server_credit_card */, | 2651 true /* include_masked_server_credit_card */, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2724 "10000000-0000-0000-0000-000000000003"); // full server card | 2800 "10000000-0000-0000-0000-000000000003"); // full server card |
2725 autofill_manager_->FillOrPreviewForm( | 2801 autofill_manager_->FillOrPreviewForm( |
2726 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), | 2802 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), |
2727 autofill_manager_->MakeFrontendID(guid, std::string())); | 2803 autofill_manager_->MakeFrontendID(guid, std::string())); |
2728 histogram_tester.ExpectBucketCount( | 2804 histogram_tester.ExpectBucketCount( |
2729 "Autofill.FormEvents.CreditCard", | 2805 "Autofill.FormEvents.CreditCard", |
2730 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED, 1); | 2806 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED, 1); |
2731 histogram_tester.ExpectBucketCount( | 2807 histogram_tester.ExpectBucketCount( |
2732 "Autofill.FormEvents.CreditCard", | 2808 "Autofill.FormEvents.CreditCard", |
2733 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED_ONCE, 1); | 2809 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED_ONCE, 1); |
2810 // Check that the bank name histogram was not recorded. ExpectBucketCount() | |
2811 // can't be used here because it expects the histogram to exist. | |
2812 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( | |
2813 "Autofill.FormEvents.CreditCard") | |
2814 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]); | |
2734 } | 2815 } |
2735 | 2816 |
2736 // Reset the autofill manager state. | 2817 // Reset the autofill manager state. |
2737 autofill_manager_->Reset(); | 2818 autofill_manager_->Reset(); |
2738 autofill_manager_->AddSeenForm(form, field_types, field_types); | 2819 autofill_manager_->AddSeenForm(form, field_types, field_types); |
2739 | 2820 |
2740 { | 2821 { |
2741 // Simulating filling multiple times. | 2822 // Simulating filling multiple times. |
2742 base::HistogramTester histogram_tester; | 2823 base::HistogramTester histogram_tester; |
2743 std::string guid("10000000-0000-0000-0000-000000000001"); // local card | 2824 std::string guid("10000000-0000-0000-0000-000000000001"); // local card |
2744 autofill_manager_->FillOrPreviewForm( | 2825 autofill_manager_->FillOrPreviewForm( |
2745 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), | 2826 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), |
2746 autofill_manager_->MakeFrontendID(guid, std::string())); | 2827 autofill_manager_->MakeFrontendID(guid, std::string())); |
2747 autofill_manager_->FillOrPreviewForm( | 2828 autofill_manager_->FillOrPreviewForm( |
2748 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), | 2829 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), |
2749 autofill_manager_->MakeFrontendID(guid, std::string())); | 2830 autofill_manager_->MakeFrontendID(guid, std::string())); |
2750 histogram_tester.ExpectBucketCount( | 2831 histogram_tester.ExpectBucketCount( |
2751 "Autofill.FormEvents.CreditCard", | 2832 "Autofill.FormEvents.CreditCard", |
2752 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED, 2); | 2833 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED, 2); |
2753 histogram_tester.ExpectBucketCount( | 2834 histogram_tester.ExpectBucketCount( |
2754 "Autofill.FormEvents.CreditCard", | 2835 "Autofill.FormEvents.CreditCard", |
2755 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED_ONCE, 1); | 2836 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED_ONCE, 1); |
2756 } | 2837 } |
2838 | |
2839 // Recreate server cards with bank names. | |
2840 personal_data_->RecreateServerCreditCardsWithBankNames(); | |
2841 | |
2842 // Reset the autofill manager state. | |
2843 autofill_manager_->Reset(); | |
2844 autofill_manager_->AddSeenForm(form, field_types, field_types); | |
2845 | |
2846 { | |
2847 // Simulating filling a full card server suggestion. | |
2848 base::HistogramTester histogram_tester; | |
2849 std::string guid( | |
2850 "10000000-0000-0000-0000-000000000003"); // full server card | |
2851 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | |
2852 autofill_manager_->FillOrPreviewForm( | |
2853 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, field, | |
2854 autofill_manager_->MakeFrontendID(guid, std::string())); | |
2855 histogram_tester.ExpectBucketCount( | |
2856 "Autofill.FormEvents.CreditCard.BankNameExperiment", | |
2857 AutofillMetrics:: | |
2858 FORM_EVENT_SERVER_SUGGESTION_FILLED_WITH_BANK_NAME_AVAILABLE_ONCE, | |
2859 1); | |
2860 } | |
2861 | |
2862 // Reset the autofill manager state. | |
2863 autofill_manager_->Reset(); | |
2864 autofill_manager_->AddSeenForm(form, field_types, field_types); | |
2865 | |
2866 { | |
2867 // Simulating filling multiple times. | |
2868 base::HistogramTester histogram_tester; | |
2869 std::string guid( | |
2870 "10000000-0000-0000-0000-000000000003"); // full server card | |
2871 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | |
2872 autofill_manager_->FillOrPreviewForm( | |
2873 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, field, | |
2874 autofill_manager_->MakeFrontendID(guid, std::string())); | |
2875 autofill_manager_->FillOrPreviewForm( | |
2876 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, field, | |
2877 autofill_manager_->MakeFrontendID(guid, std::string())); | |
2878 histogram_tester.ExpectBucketCount( | |
2879 "Autofill.FormEvents.CreditCard.BankNameExperiment", | |
2880 AutofillMetrics:: | |
2881 FORM_EVENT_SERVER_SUGGESTION_FILLED_WITH_BANK_NAME_AVAILABLE_ONCE, | |
2882 1); | |
2883 } | |
2757 } | 2884 } |
2758 | 2885 |
2759 // Test that we log submitted form events for credit cards. | 2886 // Test that we log submitted form events for credit cards. |
2760 TEST_F(AutofillMetricsTest, CreditCardGetRealPanDuration) { | 2887 TEST_F(AutofillMetricsTest, CreditCardGetRealPanDuration) { |
2761 EnableWalletSync(); | 2888 EnableWalletSync(); |
2762 // Creating masked card | 2889 // Creating masked card |
2763 personal_data_->RecreateCreditCards( | 2890 personal_data_->RecreateCreditCards( |
2764 false /* include_local_credit_card */, | 2891 false /* include_local_credit_card */, |
2765 true /* include_masked_server_credit_card */, | 2892 true /* include_masked_server_credit_card */, |
2766 false /* include_full_server_credit_card */); | 2893 false /* include_full_server_credit_card */); |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3440 { | 3567 { |
3441 // Simulating new popup being shown. | 3568 // Simulating new popup being shown. |
3442 base::HistogramTester histogram_tester; | 3569 base::HistogramTester histogram_tester; |
3443 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 3570 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); |
3444 histogram_tester.ExpectBucketCount( | 3571 histogram_tester.ExpectBucketCount( |
3445 "Autofill.FormEvents.Address", | 3572 "Autofill.FormEvents.Address", |
3446 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1); | 3573 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1); |
3447 histogram_tester.ExpectBucketCount( | 3574 histogram_tester.ExpectBucketCount( |
3448 "Autofill.FormEvents.Address", | 3575 "Autofill.FormEvents.Address", |
3449 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); | 3576 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); |
3577 // Check that the bank name histogram was not recorded. ExpectBucketCount() | |
3578 // can't be used here because it expects the histogram to exist. | |
3579 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( | |
3580 "Autofill.FormEvents.CreditCard") | |
3581 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]); | |
3450 } | 3582 } |
3451 | 3583 |
3452 // Reset the autofill manager state. | 3584 // Reset the autofill manager state. |
3453 autofill_manager_->Reset(); | 3585 autofill_manager_->Reset(); |
3454 autofill_manager_->AddSeenForm(form, field_types, field_types); | 3586 autofill_manager_->AddSeenForm(form, field_types, field_types); |
3455 | 3587 |
3456 { | 3588 { |
3457 // Simulating two popups in the same page load. | 3589 // Simulating two popups in the same page load. |
3458 base::HistogramTester histogram_tester; | 3590 base::HistogramTester histogram_tester; |
3459 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 3591 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); |
3460 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 3592 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); |
3461 histogram_tester.ExpectBucketCount( | 3593 histogram_tester.ExpectBucketCount( |
3462 "Autofill.FormEvents.Address", | 3594 "Autofill.FormEvents.Address", |
3463 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2); | 3595 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2); |
3464 histogram_tester.ExpectBucketCount( | 3596 histogram_tester.ExpectBucketCount( |
3465 "Autofill.FormEvents.Address", | 3597 "Autofill.FormEvents.Address", |
3466 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); | 3598 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); |
3599 // Check that the bank name histogram was not recorded. ExpectBucketCount() | |
3600 // can't be used here because it expects the histogram to exist. | |
3601 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( | |
3602 "Autofill.FormEvents.CreditCard") | |
3603 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]); | |
3467 } | 3604 } |
3468 | 3605 |
3469 // Reset the autofill manager state. | 3606 // Reset the autofill manager state. |
3470 autofill_manager_->Reset(); | 3607 autofill_manager_->Reset(); |
3471 autofill_manager_->AddSeenForm(form, field_types, field_types); | 3608 autofill_manager_->AddSeenForm(form, field_types, field_types); |
3472 | 3609 |
3473 { | 3610 { |
3474 // Simulating same popup being refreshed. | 3611 // Simulating same popup being refreshed. |
3475 base::HistogramTester histogram_tester; | 3612 base::HistogramTester histogram_tester; |
3476 autofill_manager_->DidShowSuggestions(false /* is_new_popup */, form, | 3613 autofill_manager_->DidShowSuggestions(false /* is_new_popup */, form, |
3477 field); | 3614 field); |
3478 histogram_tester.ExpectBucketCount( | 3615 histogram_tester.ExpectBucketCount( |
3479 "Autofill.FormEvents.Address", | 3616 "Autofill.FormEvents.Address", |
3480 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 0); | 3617 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 0); |
3481 histogram_tester.ExpectBucketCount( | 3618 histogram_tester.ExpectBucketCount( |
3482 "Autofill.FormEvents.Address", | 3619 "Autofill.FormEvents.Address", |
3483 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 0); | 3620 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 0); |
3621 // Check that the bank name histogram was not recorded. ExpectBucketCount() | |
3622 // can't be used here because it expects the histogram to exist. | |
3623 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( | |
3624 "Autofill.FormEvents.CreditCard") | |
3625 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]); | |
3484 } | 3626 } |
3485 } | 3627 } |
3486 | 3628 |
3487 // Test that we log filled form events for address. | 3629 // Test that we log filled form events for address. |
3488 TEST_F(AutofillMetricsTest, AddressFilledFormEvents) { | 3630 TEST_F(AutofillMetricsTest, AddressFilledFormEvents) { |
3489 EnableWalletSync(); | 3631 EnableWalletSync(); |
3490 // Create a profile. | 3632 // Create a profile. |
3491 personal_data_->RecreateProfile(); | 3633 personal_data_->RecreateProfile(); |
3492 // Set up our form data. | 3634 // Set up our form data. |
3493 FormData form; | 3635 FormData form; |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5103 // Tests that no UKM is logged when the ukm service is null. | 5245 // Tests that no UKM is logged when the ukm service is null. |
5104 TEST_F(AutofillMetricsTest, RecordCardUploadDecisionMetric_NoUkmService) { | 5246 TEST_F(AutofillMetricsTest, RecordCardUploadDecisionMetric_NoUkmService) { |
5105 GURL url("https://www.google.com"); | 5247 GURL url("https://www.google.com"); |
5106 std::vector<std::pair<const char*, int>> metrics = {{"metric", 1}}; | 5248 std::vector<std::pair<const char*, int>> metrics = {{"metric", 1}}; |
5107 | 5249 |
5108 EXPECT_FALSE(AutofillMetrics::LogUkm(nullptr, url, "test_ukm", metrics)); | 5250 EXPECT_FALSE(AutofillMetrics::LogUkm(nullptr, url, "test_ukm", metrics)); |
5109 ASSERT_EQ(0U, test_ukm_recorder_.sources_count()); | 5251 ASSERT_EQ(0U, test_ukm_recorder_.sources_count()); |
5110 } | 5252 } |
5111 | 5253 |
5112 } // namespace autofill | 5254 } // namespace autofill |
OLD | NEW |