Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: components/autofill/core/browser/autofill_metrics_unittest.cc

Issue 2711543002: Experiment to add bank name in autofill ui. (Closed)
Patch Set: Address comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 a bank
191 // name
Jared Saul 2017/06/14 17:54:10 nit: add period
Shanfeng 2017/06/14 21:29:34 Done.
192 void RecreateServerCreditCardsWithBankName() {
193 server_credit_cards_.clear();
194 std::unique_ptr<CreditCard> credit_card = base::MakeUnique<CreditCard>(
195 CreditCard::FULL_SERVER_CARD, "server_id");
196 test::SetCreditCardInfo(credit_card.get(), "name", "4111111111111111",
197 "12", "24", "1");
198 credit_card->set_guid("10000000-0000-0000-0000-000000000003");
199 credit_card->set_bank_name("Chase");
200 server_credit_cards_.push_back(std::move(credit_card));
201 Refresh();
202 }
203
190 bool IsAutofillEnabled() const override { return autofill_enabled_; } 204 bool IsAutofillEnabled() const override { return autofill_enabled_; }
191 205
192 void CreateAmbiguousProfiles() { 206 void CreateAmbiguousProfiles() {
193 web_profiles_.clear(); 207 web_profiles_.clear();
194 CreateTestAutofillProfiles(&web_profiles_); 208 CreateTestAutofillProfiles(&web_profiles_);
195 209
196 auto profile = base::MakeUnique<AutofillProfile>(); 210 auto profile = base::MakeUnique<AutofillProfile>();
197 test::SetProfileInfo(profile.get(), "John", "Decca", "Public", 211 test::SetProfileInfo(profile.get(), "John", "Decca", "Public",
198 "john@gmail.com", "Company", "123 Main St.", "unit 7", 212 "john@gmail.com", "Company", "123 Main St.", "unit 7",
199 "Springfield", "Texas", "79401", "US", "2345678901"); 213 "Springfield", "Texas", "79401", "US", "2345678901");
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after
2522 { 2536 {
2523 // Simulating new popup being shown. 2537 // Simulating new popup being shown.
2524 base::HistogramTester histogram_tester; 2538 base::HistogramTester histogram_tester;
2525 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); 2539 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
2526 histogram_tester.ExpectBucketCount( 2540 histogram_tester.ExpectBucketCount(
2527 "Autofill.FormEvents.CreditCard", 2541 "Autofill.FormEvents.CreditCard",
2528 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1); 2542 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1);
2529 histogram_tester.ExpectBucketCount( 2543 histogram_tester.ExpectBucketCount(
2530 "Autofill.FormEvents.CreditCard", 2544 "Autofill.FormEvents.CreditCard",
2531 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); 2545 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1);
2546 // Check that the bank name histogram was not recorded. ExpectBucketCount()
2547 // can't be used here because it expects the histogram to exist.
2548 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix(
2549 "Autofill.FormEvents.CreditCard")
2550 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]);
2532 } 2551 }
2533 2552
2534 // Reset the autofill manager state. 2553 // Reset the autofill manager state.
2535 autofill_manager_->Reset(); 2554 autofill_manager_->Reset();
2536 autofill_manager_->AddSeenForm(form, field_types, field_types); 2555 autofill_manager_->AddSeenForm(form, field_types, field_types);
2537 2556
2538 { 2557 {
2539 // Simulating two popups in the same page load. 2558 // Simulating two popups in the same page load.
2540 base::HistogramTester histogram_tester; 2559 base::HistogramTester histogram_tester;
2541 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); 2560 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
2542 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); 2561 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
2543 histogram_tester.ExpectBucketCount( 2562 histogram_tester.ExpectBucketCount(
2544 "Autofill.FormEvents.CreditCard", 2563 "Autofill.FormEvents.CreditCard",
2545 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2); 2564 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2);
2546 histogram_tester.ExpectBucketCount( 2565 histogram_tester.ExpectBucketCount(
2547 "Autofill.FormEvents.CreditCard", 2566 "Autofill.FormEvents.CreditCard",
2548 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); 2567 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1);
2568 // Check that the bank name histogram was not recorded. ExpectBucketCount()
2569 // can't be used here because it expects the histogram to exist.
2570 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix(
2571 "Autofill.FormEvents.CreditCard")
2572 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]);
2549 } 2573 }
2550 2574
2551 // Reset the autofill manager state. 2575 // Reset the autofill manager state.
2552 autofill_manager_->Reset(); 2576 autofill_manager_->Reset();
2553 autofill_manager_->AddSeenForm(form, field_types, field_types); 2577 autofill_manager_->AddSeenForm(form, field_types, field_types);
2554 2578
2555 { 2579 {
2556 // Simulating same popup being refreshed. 2580 // Simulating same popup being refreshed.
2557 base::HistogramTester histogram_tester; 2581 base::HistogramTester histogram_tester;
2558 autofill_manager_->DidShowSuggestions(false /* is_new_popup */, form, 2582 autofill_manager_->DidShowSuggestions(false /* is_new_popup */, form,
2559 field); 2583 field);
2560 histogram_tester.ExpectBucketCount( 2584 histogram_tester.ExpectBucketCount(
2561 "Autofill.FormEvents.CreditCard", 2585 "Autofill.FormEvents.CreditCard",
2562 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 0); 2586 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 0);
2563 histogram_tester.ExpectBucketCount( 2587 histogram_tester.ExpectBucketCount(
2564 "Autofill.FormEvents.CreditCard", 2588 "Autofill.FormEvents.CreditCard",
2565 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 0); 2589 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 0);
2590 // Check that the bank name histogram was not recorded. ExpectBucketCount()
2591 // can't be used here because it expects the histogram to exist.
2592 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix(
2593 "Autofill.FormEvents.CreditCard")
2594 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]);
2595 }
2596
2597 // Recreate server cards with bank names.
2598 personal_data_->RecreateServerCreditCardsWithBankName();
2599
2600 // Reset the autofill manager state.
2601 autofill_manager_->Reset();
2602 autofill_manager_->AddSeenForm(form, field_types, field_types);
2603
2604 {
2605 // Simulating new popup being shown.
2606 base::HistogramTester histogram_tester;
2607 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
2608 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
2609 histogram_tester.ExpectBucketCount(
2610 "Autofill.FormEvents.CreditCard",
2611 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1);
2612 histogram_tester.ExpectBucketCount(
2613 "Autofill.FormEvents.CreditCard",
2614 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1);
2615 histogram_tester.ExpectBucketCount(
2616 "Autofill.FormEvents.CreditCard.BankNameExperiment",
2617 AutofillMetrics::
2618 FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE,
2619 1);
2620 }
2621
2622 // Reset the autofill manager state.
2623 autofill_manager_->Reset();
2624 autofill_manager_->AddSeenForm(form, field_types, field_types);
2625
2626 {
2627 // Simulating two popups in the same page load.
2628 base::HistogramTester histogram_tester;
2629 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
2630 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
2631 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
2632 histogram_tester.ExpectBucketCount(
2633 "Autofill.FormEvents.CreditCard",
2634 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2);
2635 histogram_tester.ExpectBucketCount(
2636 "Autofill.FormEvents.CreditCard",
2637 AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1);
2638 histogram_tester.ExpectBucketCount(
2639 "Autofill.FormEvents.CreditCard.BankNameExperiment",
2640 AutofillMetrics::
2641 FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE,
2642 1);
2566 } 2643 }
2567 } 2644 }
2568 2645
2569 // Test that we log selected form event for credit cards. 2646 // Test that we log selected form event for credit cards.
2570 TEST_F(AutofillMetricsTest, CreditCardSelectedFormEvents) { 2647 TEST_F(AutofillMetricsTest, CreditCardSelectedFormEvents) {
2571 EnableWalletSync(); 2648 EnableWalletSync();
2572 // Creating all kinds of cards. 2649 // Creating all kinds of cards.
2573 personal_data_->RecreateCreditCards( 2650 personal_data_->RecreateCreditCards(
2574 true /* include_local_credit_card */, 2651 true /* include_local_credit_card */,
2575 true /* include_masked_server_credit_card */, 2652 true /* include_masked_server_credit_card */,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 "10000000-0000-0000-0000-000000000003"); // full server card 2801 "10000000-0000-0000-0000-000000000003"); // full server card
2725 autofill_manager_->FillOrPreviewForm( 2802 autofill_manager_->FillOrPreviewForm(
2726 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), 2803 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(),
2727 autofill_manager_->MakeFrontendID(guid, std::string())); 2804 autofill_manager_->MakeFrontendID(guid, std::string()));
2728 histogram_tester.ExpectBucketCount( 2805 histogram_tester.ExpectBucketCount(
2729 "Autofill.FormEvents.CreditCard", 2806 "Autofill.FormEvents.CreditCard",
2730 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED, 1); 2807 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED, 1);
2731 histogram_tester.ExpectBucketCount( 2808 histogram_tester.ExpectBucketCount(
2732 "Autofill.FormEvents.CreditCard", 2809 "Autofill.FormEvents.CreditCard",
2733 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED_ONCE, 1); 2810 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED_ONCE, 1);
2811 // Check that the bank name histogram was not recorded. ExpectBucketCount()
2812 // can't be used here because it expects the histogram to exist.
2813 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix(
2814 "Autofill.FormEvents.CreditCard")
2815 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]);
2734 } 2816 }
2735 2817
2736 // Reset the autofill manager state. 2818 // Reset the autofill manager state.
2737 autofill_manager_->Reset(); 2819 autofill_manager_->Reset();
2738 autofill_manager_->AddSeenForm(form, field_types, field_types); 2820 autofill_manager_->AddSeenForm(form, field_types, field_types);
2739 2821
2740 { 2822 {
2741 // Simulating filling multiple times. 2823 // Simulating filling multiple times.
2742 base::HistogramTester histogram_tester; 2824 base::HistogramTester histogram_tester;
2743 std::string guid("10000000-0000-0000-0000-000000000001"); // local card 2825 std::string guid("10000000-0000-0000-0000-000000000001"); // local card
2744 autofill_manager_->FillOrPreviewForm( 2826 autofill_manager_->FillOrPreviewForm(
2745 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), 2827 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(),
2746 autofill_manager_->MakeFrontendID(guid, std::string())); 2828 autofill_manager_->MakeFrontendID(guid, std::string()));
2747 autofill_manager_->FillOrPreviewForm( 2829 autofill_manager_->FillOrPreviewForm(
2748 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), 2830 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(),
2749 autofill_manager_->MakeFrontendID(guid, std::string())); 2831 autofill_manager_->MakeFrontendID(guid, std::string()));
2750 histogram_tester.ExpectBucketCount( 2832 histogram_tester.ExpectBucketCount(
2751 "Autofill.FormEvents.CreditCard", 2833 "Autofill.FormEvents.CreditCard",
2752 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED, 2); 2834 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED, 2);
2753 histogram_tester.ExpectBucketCount( 2835 histogram_tester.ExpectBucketCount(
2754 "Autofill.FormEvents.CreditCard", 2836 "Autofill.FormEvents.CreditCard",
2755 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED_ONCE, 1); 2837 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED_ONCE, 1);
2756 } 2838 }
2839
2840 // Recreate server cards with bank names.
2841 personal_data_->RecreateServerCreditCardsWithBankName();
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.BankNameExperiment",
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.BankNameExperiment",
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
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 // Check that the bank name histogram was not recorded. ExpectBucketCount()
3579 // can't be used here because it expects the histogram to exist.
3580 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix(
3581 "Autofill.FormEvents.CreditCard")
3582 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]);
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 // Check that the bank name histogram was not recorded. ExpectBucketCount()
3601 // can't be used here because it expects the histogram to exist.
3602 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix(
3603 "Autofill.FormEvents.CreditCard")
3604 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]);
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 // Check that the bank name histogram was not recorded. ExpectBucketCount()
3623 // can't be used here because it expects the histogram to exist.
3624 EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix(
3625 "Autofill.FormEvents.CreditCard")
3626 ["Autofill.FormEvents.CreditCard.BankNameExperiment"]);
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
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
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_metrics.cc ('k') | components/autofill/core/browser/credit_card.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698