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 |
| 191 void RecreateServerCreditCardsWithBankNames() { |
| 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 histogram_tester.ExpectBucketCount( |
| 2546 "Autofill.FormEvents.CreditCard", |
| 2547 AutofillMetrics:: |
| 2548 FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE, |
| 2549 0); |
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 histogram_tester.ExpectBucketCount( |
| 2568 "Autofill.FormEvents.CreditCard", |
| 2569 AutofillMetrics:: |
| 2570 FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE, |
| 2571 0); |
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 histogram_tester.ExpectBucketCount( |
| 2590 "Autofill.FormEvents.CreditCard", |
| 2591 AutofillMetrics:: |
| 2592 FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE, |
| 2593 0); |
| 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", |
| 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", |
| 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 histogram_tester.ExpectBucketCount( |
| 2811 "Autofill.FormEvents.CreditCard", |
| 2812 AutofillMetrics:: |
| 2813 FORM_EVENT_SERVER_SUGGESTION_FILLED_WITH_BANK_NAME_AVAILABLE_ONCE, |
| 2814 0); |
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 |
| 2840 // Recreate server cards with bank names. |
| 2841 personal_data_->RecreateServerCreditCardsWithBankNames(); |
| 2842 |
| 2843 // Reset the autofill manager state. |
| 2844 autofill_manager_->Reset(); |
| 2845 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 2846 |
| 2847 { |
| 2848 // Simulating filling a full card server suggestion. |
| 2849 base::HistogramTester histogram_tester; |
| 2850 std::string guid( |
| 2851 "10000000-0000-0000-0000-000000000003"); // full server card |
| 2852 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); |
| 2853 autofill_manager_->FillOrPreviewForm( |
| 2854 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, field, |
| 2855 autofill_manager_->MakeFrontendID(guid, std::string())); |
| 2856 histogram_tester.ExpectBucketCount( |
| 2857 "Autofill.FormEvents.CreditCard", |
| 2858 AutofillMetrics:: |
| 2859 FORM_EVENT_SERVER_SUGGESTION_FILLED_WITH_BANK_NAME_AVAILABLE_ONCE, |
| 2860 1); |
| 2861 } |
| 2862 |
| 2863 // Reset the autofill manager state. |
| 2864 autofill_manager_->Reset(); |
| 2865 autofill_manager_->AddSeenForm(form, field_types, field_types); |
| 2866 |
| 2867 { |
| 2868 // Simulating filling multiple times. |
| 2869 base::HistogramTester histogram_tester; |
| 2870 std::string guid( |
| 2871 "10000000-0000-0000-0000-000000000003"); // full server card |
| 2872 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); |
| 2873 autofill_manager_->FillOrPreviewForm( |
| 2874 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, field, |
| 2875 autofill_manager_->MakeFrontendID(guid, std::string())); |
| 2876 autofill_manager_->FillOrPreviewForm( |
| 2877 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, field, |
| 2878 autofill_manager_->MakeFrontendID(guid, std::string())); |
| 2879 histogram_tester.ExpectBucketCount( |
| 2880 "Autofill.FormEvents.CreditCard", |
| 2881 AutofillMetrics:: |
| 2882 FORM_EVENT_SERVER_SUGGESTION_FILLED_WITH_BANK_NAME_AVAILABLE_ONCE, |
| 2883 1); |
| 2884 } |
2757 } | 2885 } |
2758 | 2886 |
2759 // Test that we log submitted form events for credit cards. | 2887 // Test that we log submitted form events for credit cards. |
2760 TEST_F(AutofillMetricsTest, CreditCardGetRealPanDuration) { | 2888 TEST_F(AutofillMetricsTest, CreditCardGetRealPanDuration) { |
2761 EnableWalletSync(); | 2889 EnableWalletSync(); |
2762 // Creating masked card | 2890 // Creating masked card |
2763 personal_data_->RecreateCreditCards( | 2891 personal_data_->RecreateCreditCards( |
2764 false /* include_local_credit_card */, | 2892 false /* include_local_credit_card */, |
2765 true /* include_masked_server_credit_card */, | 2893 true /* include_masked_server_credit_card */, |
2766 false /* include_full_server_credit_card */); | 2894 false /* include_full_server_credit_card */); |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3440 { | 3568 { |
3441 // Simulating new popup being shown. | 3569 // Simulating new popup being shown. |
3442 base::HistogramTester histogram_tester; | 3570 base::HistogramTester histogram_tester; |
3443 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 3571 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); |
3444 histogram_tester.ExpectBucketCount( | 3572 histogram_tester.ExpectBucketCount( |
3445 "Autofill.FormEvents.Address", | 3573 "Autofill.FormEvents.Address", |
3446 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1); | 3574 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1); |
3447 histogram_tester.ExpectBucketCount( | 3575 histogram_tester.ExpectBucketCount( |
3448 "Autofill.FormEvents.Address", | 3576 "Autofill.FormEvents.Address", |
3449 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); | 3577 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); |
| 3578 histogram_tester.ExpectBucketCount( |
| 3579 "Autofill.FormEvents.CreditCard", |
| 3580 AutofillMetrics:: |
| 3581 FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE, |
| 3582 0); |
3450 } | 3583 } |
3451 | 3584 |
3452 // Reset the autofill manager state. | 3585 // Reset the autofill manager state. |
3453 autofill_manager_->Reset(); | 3586 autofill_manager_->Reset(); |
3454 autofill_manager_->AddSeenForm(form, field_types, field_types); | 3587 autofill_manager_->AddSeenForm(form, field_types, field_types); |
3455 | 3588 |
3456 { | 3589 { |
3457 // Simulating two popups in the same page load. | 3590 // Simulating two popups in the same page load. |
3458 base::HistogramTester histogram_tester; | 3591 base::HistogramTester histogram_tester; |
3459 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 3592 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); |
3460 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 3593 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); |
3461 histogram_tester.ExpectBucketCount( | 3594 histogram_tester.ExpectBucketCount( |
3462 "Autofill.FormEvents.Address", | 3595 "Autofill.FormEvents.Address", |
3463 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2); | 3596 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2); |
3464 histogram_tester.ExpectBucketCount( | 3597 histogram_tester.ExpectBucketCount( |
3465 "Autofill.FormEvents.Address", | 3598 "Autofill.FormEvents.Address", |
3466 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); | 3599 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); |
| 3600 histogram_tester.ExpectBucketCount( |
| 3601 "Autofill.FormEvents.CreditCard", |
| 3602 AutofillMetrics:: |
| 3603 FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE, |
| 3604 0); |
3467 } | 3605 } |
3468 | 3606 |
3469 // Reset the autofill manager state. | 3607 // Reset the autofill manager state. |
3470 autofill_manager_->Reset(); | 3608 autofill_manager_->Reset(); |
3471 autofill_manager_->AddSeenForm(form, field_types, field_types); | 3609 autofill_manager_->AddSeenForm(form, field_types, field_types); |
3472 | 3610 |
3473 { | 3611 { |
3474 // Simulating same popup being refreshed. | 3612 // Simulating same popup being refreshed. |
3475 base::HistogramTester histogram_tester; | 3613 base::HistogramTester histogram_tester; |
3476 autofill_manager_->DidShowSuggestions(false /* is_new_popup */, form, | 3614 autofill_manager_->DidShowSuggestions(false /* is_new_popup */, form, |
3477 field); | 3615 field); |
3478 histogram_tester.ExpectBucketCount( | 3616 histogram_tester.ExpectBucketCount( |
3479 "Autofill.FormEvents.Address", | 3617 "Autofill.FormEvents.Address", |
3480 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 0); | 3618 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 0); |
3481 histogram_tester.ExpectBucketCount( | 3619 histogram_tester.ExpectBucketCount( |
3482 "Autofill.FormEvents.Address", | 3620 "Autofill.FormEvents.Address", |
3483 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 0); | 3621 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 0); |
| 3622 histogram_tester.ExpectBucketCount( |
| 3623 "Autofill.FormEvents.CreditCard", |
| 3624 AutofillMetrics:: |
| 3625 FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE, |
| 3626 0); |
3484 } | 3627 } |
3485 } | 3628 } |
3486 | 3629 |
3487 // Test that we log filled form events for address. | 3630 // Test that we log filled form events for address. |
3488 TEST_F(AutofillMetricsTest, AddressFilledFormEvents) { | 3631 TEST_F(AutofillMetricsTest, AddressFilledFormEvents) { |
3489 EnableWalletSync(); | 3632 EnableWalletSync(); |
3490 // Create a profile. | 3633 // Create a profile. |
3491 personal_data_->RecreateProfile(); | 3634 personal_data_->RecreateProfile(); |
3492 // Set up our form data. | 3635 // Set up our form data. |
3493 FormData form; | 3636 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. | 5246 // Tests that no UKM is logged when the ukm service is null. |
5104 TEST_F(AutofillMetricsTest, RecordCardUploadDecisionMetric_NoUkmService) { | 5247 TEST_F(AutofillMetricsTest, RecordCardUploadDecisionMetric_NoUkmService) { |
5105 GURL url("https://www.google.com"); | 5248 GURL url("https://www.google.com"); |
5106 std::vector<std::pair<const char*, int>> metrics = {{"metric", 1}}; | 5249 std::vector<std::pair<const char*, int>> metrics = {{"metric", 1}}; |
5107 | 5250 |
5108 EXPECT_FALSE(AutofillMetrics::LogUkm(nullptr, url, "test_ukm", metrics)); | 5251 EXPECT_FALSE(AutofillMetrics::LogUkm(nullptr, url, "test_ukm", metrics)); |
5109 ASSERT_EQ(0U, test_ukm_recorder_.sources_count()); | 5252 ASSERT_EQ(0U, test_ukm_recorder_.sources_count()); |
5110 } | 5253 } |
5111 | 5254 |
5112 } // namespace autofill | 5255 } // namespace autofill |
OLD | NEW |