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

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

Issue 2575263002: [Autofill] Add a new metric for upstream. (Closed)
Patch Set: Resolve comments. Created 4 years 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 <vector> 10 #include <vector>
(...skipping 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2406 histogram_tester.ExpectBucketCount( 2406 histogram_tester.ExpectBucketCount(
2407 "Autofill.FormEvents.CreditCard", 2407 "Autofill.FormEvents.CreditCard",
2408 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); 2408 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1);
2409 } 2409 }
2410 2410
2411 // Reset the autofill manager state. 2411 // Reset the autofill manager state.
2412 autofill_manager_->Reset(); 2412 autofill_manager_->Reset();
2413 autofill_manager_->AddSeenForm(form, field_types, field_types); 2413 autofill_manager_->AddSeenForm(form, field_types, field_types);
2414 2414
2415 { 2415 {
2416 // Simulating submission with suggestion shown.
2417 base::HistogramTester histogram_tester;
2418 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
2419 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
2420 autofill_manager_->SubmitForm(form, TimeTicks::Now());
2421 histogram_tester.ExpectBucketCount(
2422 "Autofill.FormEvents.CreditCard",
2423 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 1);
2424 histogram_tester.ExpectBucketCount(
2425 "Autofill.FormEvents.CreditCard",
2426 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 1);
2427 }
2428
2429 // Reset the autofill manager state.
2430 autofill_manager_->Reset();
2431 autofill_manager_->AddSeenForm(form, field_types, field_types);
2432
2433 {
2416 // Simulating submission with filled local data. 2434 // Simulating submission with filled local data.
2417 base::HistogramTester histogram_tester; 2435 base::HistogramTester histogram_tester;
2418 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); 2436 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
2419 std::string guid("10000000-0000-0000-0000-000000000001"); // local card 2437 std::string guid("10000000-0000-0000-0000-000000000001"); // local card
2420 autofill_manager_->FillOrPreviewForm( 2438 autofill_manager_->FillOrPreviewForm(
2421 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), 2439 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(),
2422 autofill_manager_->MakeFrontendID(guid, std::string())); 2440 autofill_manager_->MakeFrontendID(guid, std::string()));
2423 autofill_manager_->SubmitForm(form, TimeTicks::Now()); 2441 autofill_manager_->SubmitForm(form, TimeTicks::Now());
2424 histogram_tester.ExpectBucketCount( 2442 histogram_tester.ExpectBucketCount(
2425 "Autofill.FormEvents.CreditCard", 2443 "Autofill.FormEvents.CreditCard",
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2489 // Simulating multiple submissions. 2507 // Simulating multiple submissions.
2490 base::HistogramTester histogram_tester; 2508 base::HistogramTester histogram_tester;
2491 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); 2509 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
2492 autofill_manager_->SubmitForm(form, TimeTicks::Now()); 2510 autofill_manager_->SubmitForm(form, TimeTicks::Now());
2493 autofill_manager_->SubmitForm(form, TimeTicks::Now()); 2511 autofill_manager_->SubmitForm(form, TimeTicks::Now());
2494 histogram_tester.ExpectBucketCount( 2512 histogram_tester.ExpectBucketCount(
2495 "Autofill.FormEvents.CreditCard", 2513 "Autofill.FormEvents.CreditCard",
2496 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); 2514 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1);
2497 histogram_tester.ExpectBucketCount( 2515 histogram_tester.ExpectBucketCount(
2498 "Autofill.FormEvents.CreditCard", 2516 "Autofill.FormEvents.CreditCard",
2517 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0);
2518 histogram_tester.ExpectBucketCount(
2519 "Autofill.FormEvents.CreditCard",
2499 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0); 2520 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0);
2500 histogram_tester.ExpectBucketCount( 2521 histogram_tester.ExpectBucketCount(
2501 "Autofill.FormEvents.CreditCard", 2522 "Autofill.FormEvents.CreditCard",
2502 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); 2523 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0);
2503 histogram_tester.ExpectBucketCount( 2524 histogram_tester.ExpectBucketCount(
2504 "Autofill.FormEvents.CreditCard", 2525 "Autofill.FormEvents.CreditCard",
2505 AutofillMetrics:: 2526 AutofillMetrics::
2506 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE, 2527 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE,
2507 0); 2528 0);
2508 histogram_tester.ExpectBucketCount( 2529 histogram_tester.ExpectBucketCount(
2509 "Autofill.FormEvents.CreditCard", 2530 "Autofill.FormEvents.CreditCard",
2510 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); 2531 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1);
2511 histogram_tester.ExpectBucketCount( 2532 histogram_tester.ExpectBucketCount(
2512 "Autofill.FormEvents.CreditCard", 2533 "Autofill.FormEvents.CreditCard",
2534 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0);
2535 histogram_tester.ExpectBucketCount(
2536 "Autofill.FormEvents.CreditCard",
2513 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); 2537 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0);
2514 histogram_tester.ExpectBucketCount( 2538 histogram_tester.ExpectBucketCount(
2515 "Autofill.FormEvents.CreditCard", 2539 "Autofill.FormEvents.CreditCard",
2516 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); 2540 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
2517 histogram_tester.ExpectBucketCount( 2541 histogram_tester.ExpectBucketCount(
2518 "Autofill.FormEvents.CreditCard", 2542 "Autofill.FormEvents.CreditCard",
2519 AutofillMetrics:: 2543 AutofillMetrics::
2520 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, 2544 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE,
2521 0); 2545 0);
2522 } 2546 }
2523 2547
2524 // Reset the autofill manager state. 2548 // Reset the autofill manager state.
2525 autofill_manager_->Reset(); 2549 autofill_manager_->Reset();
2526 autofill_manager_->AddSeenForm(form, field_types, field_types); 2550 autofill_manager_->AddSeenForm(form, field_types, field_types);
2527 2551
2528 { 2552 {
2529 // Simulating submission without previous interaction. 2553 // Simulating submission with suggestion shown but without previous
2554 // interaction.
2530 base::HistogramTester histogram_tester; 2555 base::HistogramTester histogram_tester;
2556 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
2531 autofill_manager_->SubmitForm(form, TimeTicks::Now()); 2557 autofill_manager_->SubmitForm(form, TimeTicks::Now());
2532 histogram_tester.ExpectBucketCount( 2558 histogram_tester.ExpectBucketCount(
2533 "Autofill.FormEvents.CreditCard", 2559 "Autofill.FormEvents.CreditCard",
2560 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0);
2561 histogram_tester.ExpectBucketCount(
2562 "Autofill.FormEvents.CreditCard",
2563 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0);
2564 histogram_tester.ExpectBucketCount(
2565 "Autofill.FormEvents.CreditCard",
2566 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0);
2567 histogram_tester.ExpectBucketCount(
2568 "Autofill.FormEvents.CreditCard",
2569 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
2570 histogram_tester.ExpectBucketCount(
2571 "Autofill.FormEvents.CreditCard",
2572 AutofillMetrics::
2573 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE,
2574 0);
2575 histogram_tester.ExpectBucketCount(
2576 "Autofill.FormEvents.CreditCard",
2577 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0);
2578 histogram_tester.ExpectBucketCount(
2579 "Autofill.FormEvents.CreditCard",
2534 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0); 2580 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0);
2535 histogram_tester.ExpectBucketCount( 2581 histogram_tester.ExpectBucketCount(
2536 "Autofill.FormEvents.CreditCard", 2582 "Autofill.FormEvents.CreditCard",
2537 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); 2583 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0);
2538 histogram_tester.ExpectBucketCount( 2584 histogram_tester.ExpectBucketCount(
2539 "Autofill.FormEvents.CreditCard", 2585 "Autofill.FormEvents.CreditCard",
2540 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); 2586 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0);
2541 histogram_tester.ExpectBucketCount( 2587 histogram_tester.ExpectBucketCount(
2542 "Autofill.FormEvents.CreditCard", 2588 "Autofill.FormEvents.CreditCard",
2543 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); 2589 AutofillMetrics::
2544 histogram_tester.ExpectBucketCount( 2590 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE,
2545 "Autofill.FormEvents.CreditCard", 2591 0);
2546 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
2547 histogram_tester.ExpectBucketCount(
2548 "Autofill.FormEvents.CreditCard",
2549 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
2550 } 2592 }
2551 } 2593 }
2552 2594
2553 // Test that we log "will submit" (but not submitted) form events for credit 2595 // Test that we log "will submit" (but not submitted) form events for credit
2554 // cards. Mirrors CreditCardSubmittedFormEvents test but does not expect any 2596 // cards. Mirrors CreditCardSubmittedFormEvents test but does not expect any
2555 // "submitted" metrics. 2597 // "submitted" metrics.
2556 TEST_F(AutofillMetricsTest, CreditCardWillSubmitFormEvents) { 2598 TEST_F(AutofillMetricsTest, CreditCardWillSubmitFormEvents) {
2557 EnableWalletSync(); 2599 EnableWalletSync();
2558 // Creating all kinds of cards. 2600 // Creating all kinds of cards.
2559 personal_data_->RecreateCreditCards( 2601 personal_data_->RecreateCreditCards(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 histogram_tester.ExpectBucketCount( 2635 histogram_tester.ExpectBucketCount(
2594 "Autofill.FormEvents.CreditCard", 2636 "Autofill.FormEvents.CreditCard",
2595 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); 2637 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0);
2596 } 2638 }
2597 2639
2598 // Reset the autofill manager state. 2640 // Reset the autofill manager state.
2599 autofill_manager_->Reset(); 2641 autofill_manager_->Reset();
2600 autofill_manager_->AddSeenForm(form, field_types, field_types); 2642 autofill_manager_->AddSeenForm(form, field_types, field_types);
2601 2643
2602 { 2644 {
2645 // Simulating submission with suggestion shown.
2646 base::HistogramTester histogram_tester;
2647 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
2648 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
2649 autofill_manager_->WillSubmitForm(form, TimeTicks::Now());
2650 histogram_tester.ExpectBucketCount(
2651 "Autofill.FormEvents.CreditCard",
2652 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 1);
2653 histogram_tester.ExpectBucketCount(
2654 "Autofill.FormEvents.CreditCard",
2655 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0);
2656 }
2657
2658 // Reset the autofill manager state.
2659 autofill_manager_->Reset();
2660 autofill_manager_->AddSeenForm(form, field_types, field_types);
2661
2662 {
2603 // Simulating submission with filled local data. 2663 // Simulating submission with filled local data.
2604 base::HistogramTester histogram_tester; 2664 base::HistogramTester histogram_tester;
2605 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); 2665 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
2606 std::string guid("10000000-0000-0000-0000-000000000001"); // local card 2666 std::string guid("10000000-0000-0000-0000-000000000001"); // local card
2607 autofill_manager_->FillOrPreviewForm( 2667 autofill_manager_->FillOrPreviewForm(
2608 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), 2668 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(),
2609 autofill_manager_->MakeFrontendID(guid, std::string())); 2669 autofill_manager_->MakeFrontendID(guid, std::string()));
2610 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); 2670 autofill_manager_->WillSubmitForm(form, TimeTicks::Now());
2611 histogram_tester.ExpectBucketCount( 2671 histogram_tester.ExpectBucketCount(
2612 "Autofill.FormEvents.CreditCard", 2672 "Autofill.FormEvents.CreditCard",
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 // Simulating multiple submissions. 2736 // Simulating multiple submissions.
2677 base::HistogramTester histogram_tester; 2737 base::HistogramTester histogram_tester;
2678 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); 2738 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
2679 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); 2739 autofill_manager_->WillSubmitForm(form, TimeTicks::Now());
2680 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); 2740 autofill_manager_->WillSubmitForm(form, TimeTicks::Now());
2681 histogram_tester.ExpectBucketCount( 2741 histogram_tester.ExpectBucketCount(
2682 "Autofill.FormEvents.CreditCard", 2742 "Autofill.FormEvents.CreditCard",
2683 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); 2743 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1);
2684 histogram_tester.ExpectBucketCount( 2744 histogram_tester.ExpectBucketCount(
2685 "Autofill.FormEvents.CreditCard", 2745 "Autofill.FormEvents.CreditCard",
2746 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0);
2747 histogram_tester.ExpectBucketCount(
2748 "Autofill.FormEvents.CreditCard",
2686 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0); 2749 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0);
2687 histogram_tester.ExpectBucketCount( 2750 histogram_tester.ExpectBucketCount(
2688 "Autofill.FormEvents.CreditCard", 2751 "Autofill.FormEvents.CreditCard",
2689 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); 2752 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0);
2690 histogram_tester.ExpectBucketCount( 2753 histogram_tester.ExpectBucketCount(
2691 "Autofill.FormEvents.CreditCard", 2754 "Autofill.FormEvents.CreditCard",
2692 AutofillMetrics:: 2755 AutofillMetrics::
2693 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE, 2756 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE,
2694 0); 2757 0);
2695 histogram_tester.ExpectBucketCount( 2758 histogram_tester.ExpectBucketCount(
2696 "Autofill.FormEvents.CreditCard", 2759 "Autofill.FormEvents.CreditCard",
2697 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); 2760 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0);
2698 histogram_tester.ExpectBucketCount( 2761 histogram_tester.ExpectBucketCount(
2699 "Autofill.FormEvents.CreditCard", 2762 "Autofill.FormEvents.CreditCard",
2763 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0);
2764 histogram_tester.ExpectBucketCount(
2765 "Autofill.FormEvents.CreditCard",
2700 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); 2766 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0);
2701 histogram_tester.ExpectBucketCount( 2767 histogram_tester.ExpectBucketCount(
2702 "Autofill.FormEvents.CreditCard", 2768 "Autofill.FormEvents.CreditCard",
2703 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); 2769 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
2704 histogram_tester.ExpectBucketCount( 2770 histogram_tester.ExpectBucketCount(
2705 "Autofill.FormEvents.CreditCard", 2771 "Autofill.FormEvents.CreditCard",
2706 AutofillMetrics 2772 AutofillMetrics
2707 ::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, 2773 ::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE,
2708 0); 2774 0);
2709 } 2775 }
2710 2776
2711 // Reset the autofill manager state. 2777 // Reset the autofill manager state.
2712 autofill_manager_->Reset(); 2778 autofill_manager_->Reset();
2713 autofill_manager_->AddSeenForm(form, field_types, field_types); 2779 autofill_manager_->AddSeenForm(form, field_types, field_types);
2714 2780
2715 { 2781 {
2716 // Simulating submission without previous interaction. 2782 // Simulating submission with suggestion shown but without previous
2783 // interaction.
2717 base::HistogramTester histogram_tester; 2784 base::HistogramTester histogram_tester;
2785 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
2718 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); 2786 autofill_manager_->WillSubmitForm(form, TimeTicks::Now());
2719 histogram_tester.ExpectBucketCount( 2787 histogram_tester.ExpectBucketCount(
2720 "Autofill.FormEvents.CreditCard", 2788 "Autofill.FormEvents.CreditCard",
2789 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0);
2790 histogram_tester.ExpectBucketCount(
2791 "Autofill.FormEvents.CreditCard",
2792 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0);
2793 histogram_tester.ExpectBucketCount(
2794 "Autofill.FormEvents.CreditCard",
2795 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0);
2796 histogram_tester.ExpectBucketCount(
2797 "Autofill.FormEvents.CreditCard",
2798 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
2799 histogram_tester.ExpectBucketCount(
2800 "Autofill.FormEvents.CreditCard",
2801 AutofillMetrics::
2802 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE,
2803 0);
2804 histogram_tester.ExpectBucketCount(
2805 "Autofill.FormEvents.CreditCard",
2806 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0);
2807 histogram_tester.ExpectBucketCount(
2808 "Autofill.FormEvents.CreditCard",
2721 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0); 2809 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0);
2722 histogram_tester.ExpectBucketCount( 2810 histogram_tester.ExpectBucketCount(
2723 "Autofill.FormEvents.CreditCard", 2811 "Autofill.FormEvents.CreditCard",
2724 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); 2812 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0);
Jared Saul 2016/12/15 22:20:59 Nice fix!
Shanfeng 2016/12/15 23:28:12 Thanks.
2725 histogram_tester.ExpectBucketCount( 2813 histogram_tester.ExpectBucketCount(
2726 "Autofill.FormEvents.CreditCard", 2814 "Autofill.FormEvents.CreditCard",
2727 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); 2815 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0);
2728 histogram_tester.ExpectBucketCount( 2816 histogram_tester.ExpectBucketCount(
2729 "Autofill.FormEvents.CreditCard", 2817 "Autofill.FormEvents.CreditCard",
2730 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); 2818 AutofillMetrics::
2731 histogram_tester.ExpectBucketCount( 2819 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE,
2732 "Autofill.FormEvents.CreditCard", 2820 0);
2733 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
2734 histogram_tester.ExpectBucketCount(
2735 "Autofill.FormEvents.CreditCard",
2736 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
2737 } 2821 }
2738 } 2822 }
2739 2823
2740 // Test that we log interacted form events for address. 2824 // Test that we log interacted form events for address.
2741 TEST_F(AutofillMetricsTest, AddressInteractedFormEvents) { 2825 TEST_F(AutofillMetricsTest, AddressInteractedFormEvents) {
2742 // Set up our form data. 2826 // Set up our form data.
2743 FormData form; 2827 FormData form;
2744 form.name = ASCIIToUTF16("TestForm"); 2828 form.name = ASCIIToUTF16("TestForm");
2745 form.origin = GURL("http://example.com/form.html"); 2829 form.origin = GURL("http://example.com/form.html");
2746 form.action = GURL("http://example.com/submit.html"); 2830 form.action = GURL("http://example.com/submit.html");
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 histogram_tester.ExpectBucketCount( 3068 histogram_tester.ExpectBucketCount(
2985 "Autofill.FormEvents.Address", 3069 "Autofill.FormEvents.Address",
2986 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); 3070 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1);
2987 } 3071 }
2988 3072
2989 // Reset the autofill manager state. 3073 // Reset the autofill manager state.
2990 autofill_manager_->Reset(); 3074 autofill_manager_->Reset();
2991 autofill_manager_->AddSeenForm(form, field_types, field_types); 3075 autofill_manager_->AddSeenForm(form, field_types, field_types);
2992 3076
2993 { 3077 {
3078 // Simulating submission with suggestion shown.
3079 base::HistogramTester histogram_tester;
3080 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
3081 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
3082 autofill_manager_->SubmitForm(form, TimeTicks::Now());
3083 histogram_tester.ExpectBucketCount(
3084 "Autofill.FormEvents.Address",
3085 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 1);
3086 histogram_tester.ExpectBucketCount(
3087 "Autofill.FormEvents.Address",
3088 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 1);
3089 }
3090
3091 // Reset the autofill manager state.
3092 autofill_manager_->Reset();
3093 autofill_manager_->AddSeenForm(form, field_types, field_types);
3094
3095 {
2994 // Simulating submission with filled local data. 3096 // Simulating submission with filled local data.
2995 base::HistogramTester histogram_tester; 3097 base::HistogramTester histogram_tester;
2996 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); 3098 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
2997 std::string guid("00000000-0000-0000-0000-000000000001"); // local profile 3099 std::string guid("00000000-0000-0000-0000-000000000001"); // local profile
2998 autofill_manager_->FillOrPreviewForm( 3100 autofill_manager_->FillOrPreviewForm(
2999 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), 3101 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(),
3000 autofill_manager_->MakeFrontendID(std::string(), guid)); 3102 autofill_manager_->MakeFrontendID(std::string(), guid));
3001 autofill_manager_->SubmitForm(form, TimeTicks::Now()); 3103 autofill_manager_->SubmitForm(form, TimeTicks::Now());
3002 histogram_tester.ExpectBucketCount( 3104 histogram_tester.ExpectBucketCount(
3003 "Autofill.FormEvents.Address", 3105 "Autofill.FormEvents.Address",
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3036 // Simulating multiple submissions. 3138 // Simulating multiple submissions.
3037 base::HistogramTester histogram_tester; 3139 base::HistogramTester histogram_tester;
3038 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); 3140 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
3039 autofill_manager_->SubmitForm(form, TimeTicks::Now()); 3141 autofill_manager_->SubmitForm(form, TimeTicks::Now());
3040 autofill_manager_->SubmitForm(form, TimeTicks::Now()); 3142 autofill_manager_->SubmitForm(form, TimeTicks::Now());
3041 histogram_tester.ExpectBucketCount( 3143 histogram_tester.ExpectBucketCount(
3042 "Autofill.FormEvents.Address", 3144 "Autofill.FormEvents.Address",
3043 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); 3145 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1);
3044 histogram_tester.ExpectBucketCount( 3146 histogram_tester.ExpectBucketCount(
3045 "Autofill.FormEvents.Address", 3147 "Autofill.FormEvents.Address",
3148 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0);
3149 histogram_tester.ExpectBucketCount(
3150 "Autofill.FormEvents.Address",
3046 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0); 3151 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0);
3047 histogram_tester.ExpectBucketCount( 3152 histogram_tester.ExpectBucketCount(
3048 "Autofill.FormEvents.Address", 3153 "Autofill.FormEvents.Address",
3049 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); 3154 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0);
3050 histogram_tester.ExpectBucketCount( 3155 histogram_tester.ExpectBucketCount(
3051 "Autofill.FormEvents.Address", 3156 "Autofill.FormEvents.Address",
3052 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); 3157 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1);
3053 histogram_tester.ExpectBucketCount( 3158 histogram_tester.ExpectBucketCount(
3054 "Autofill.FormEvents.Address", 3159 "Autofill.FormEvents.Address",
3160 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0);
3161 histogram_tester.ExpectBucketCount(
3162 "Autofill.FormEvents.Address",
3055 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); 3163 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0);
3056 histogram_tester.ExpectBucketCount( 3164 histogram_tester.ExpectBucketCount(
3057 "Autofill.FormEvents.Address", 3165 "Autofill.FormEvents.Address",
3058 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); 3166 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
3059 } 3167 }
3060 3168
3061 // Reset the autofill manager state. 3169 // Reset the autofill manager state.
3062 autofill_manager_->Reset(); 3170 autofill_manager_->Reset();
3063 autofill_manager_->AddSeenForm(form, field_types, field_types); 3171 autofill_manager_->AddSeenForm(form, field_types, field_types);
3064 3172
3065 { 3173 {
3066 // Simulating submission without previous interaction. 3174 // Simulating submission with suggestion show but without previous
3175 // interaction.
3067 base::HistogramTester histogram_tester; 3176 base::HistogramTester histogram_tester;
3177 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
3068 autofill_manager_->SubmitForm(form, TimeTicks::Now()); 3178 autofill_manager_->SubmitForm(form, TimeTicks::Now());
3069 histogram_tester.ExpectBucketCount( 3179 histogram_tester.ExpectBucketCount(
3070 "Autofill.FormEvents.Address", 3180 "Autofill.FormEvents.Address",
3181 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0);
3182 histogram_tester.ExpectBucketCount(
3183 "Autofill.FormEvents.Address",
3071 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0); 3184 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0);
3072 histogram_tester.ExpectBucketCount( 3185 histogram_tester.ExpectBucketCount(
3073 "Autofill.FormEvents.Address", 3186 "Autofill.FormEvents.Address",
3074 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0); 3187 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0);
3075 histogram_tester.ExpectBucketCount( 3188 histogram_tester.ExpectBucketCount(
3076 "Autofill.FormEvents.Address", 3189 "Autofill.FormEvents.Address",
3077 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); 3190 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0);
3078 histogram_tester.ExpectBucketCount( 3191 histogram_tester.ExpectBucketCount(
3079 "Autofill.FormEvents.Address", 3192 "Autofill.FormEvents.Address",
3193 AutofillMetrics::
3194 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE,
3195 0);
3196 histogram_tester.ExpectBucketCount(
3197 "Autofill.FormEvents.Address",
3198 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0);
3199 histogram_tester.ExpectBucketCount(
3200 "Autofill.FormEvents.Address",
3080 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); 3201 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0);
3081 histogram_tester.ExpectBucketCount( 3202 histogram_tester.ExpectBucketCount(
3082 "Autofill.FormEvents.Address", 3203 "Autofill.FormEvents.Address",
3083 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); 3204 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0);
3084 histogram_tester.ExpectBucketCount( 3205 histogram_tester.ExpectBucketCount(
3085 "Autofill.FormEvents.Address", 3206 "Autofill.FormEvents.Address",
3086 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); 3207 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
3208 histogram_tester.ExpectBucketCount(
3209 "Autofill.FormEvents.Address",
3210 AutofillMetrics::
3211 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE,
3212 0);
3087 } 3213 }
3088 } 3214 }
3089 3215
3090 // Test that we log "will submit" (but not submitted) form events for address. 3216 // Test that we log "will submit" (but not submitted) form events for address.
3091 // Mirrors AddressSubmittedFormEvents test but does not expect any "submitted" 3217 // Mirrors AddressSubmittedFormEvents test but does not expect any "submitted"
3092 // metrics. 3218 // metrics.
3093 TEST_F(AutofillMetricsTest, AddressWillSubmitFormEvents) { 3219 TEST_F(AutofillMetricsTest, AddressWillSubmitFormEvents) {
3094 EnableWalletSync(); 3220 EnableWalletSync();
3095 // Creating all kinds of profiles. 3221 // Creating all kinds of profiles.
3096 personal_data_->RecreateProfiles(true /* include_local_profile */, 3222 personal_data_->RecreateProfiles(true /* include_local_profile */,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3128 histogram_tester.ExpectBucketCount( 3254 histogram_tester.ExpectBucketCount(
3129 "Autofill.FormEvents.Address", 3255 "Autofill.FormEvents.Address",
3130 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); 3256 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0);
3131 } 3257 }
3132 3258
3133 // Reset the autofill manager state. 3259 // Reset the autofill manager state.
3134 autofill_manager_->Reset(); 3260 autofill_manager_->Reset();
3135 autofill_manager_->AddSeenForm(form, field_types, field_types); 3261 autofill_manager_->AddSeenForm(form, field_types, field_types);
3136 3262
3137 { 3263 {
3264 // Simulating submission with suggestion shown.
3265 base::HistogramTester histogram_tester;
3266 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
3267 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
3268 autofill_manager_->WillSubmitForm(form, TimeTicks::Now());
3269 histogram_tester.ExpectBucketCount(
3270 "Autofill.FormEvents.Address",
3271 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 1);
3272 histogram_tester.ExpectBucketCount(
3273 "Autofill.FormEvents.Address",
3274 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0);
3275 }
3276
3277 // Reset the autofill manager state.
3278 autofill_manager_->Reset();
3279 autofill_manager_->AddSeenForm(form, field_types, field_types);
3280
3281 {
3138 // Simulating submission with filled local data. 3282 // Simulating submission with filled local data.
3139 base::HistogramTester histogram_tester; 3283 base::HistogramTester histogram_tester;
3140 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); 3284 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
3141 std::string guid("00000000-0000-0000-0000-000000000001"); // local profile 3285 std::string guid("00000000-0000-0000-0000-000000000001"); // local profile
3142 autofill_manager_->FillOrPreviewForm( 3286 autofill_manager_->FillOrPreviewForm(
3143 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(), 3287 AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.front(),
3144 autofill_manager_->MakeFrontendID(std::string(), guid)); 3288 autofill_manager_->MakeFrontendID(std::string(), guid));
3145 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); 3289 autofill_manager_->WillSubmitForm(form, TimeTicks::Now());
3146 histogram_tester.ExpectBucketCount( 3290 histogram_tester.ExpectBucketCount(
3147 "Autofill.FormEvents.Address", 3291 "Autofill.FormEvents.Address",
(...skipping 29 matching lines...) Expand all
3177 autofill_manager_->AddSeenForm(form, field_types, field_types); 3321 autofill_manager_->AddSeenForm(form, field_types, field_types);
3178 3322
3179 { 3323 {
3180 // Simulating multiple submissions. 3324 // Simulating multiple submissions.
3181 base::HistogramTester histogram_tester; 3325 base::HistogramTester histogram_tester;
3182 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); 3326 autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF());
3183 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); 3327 autofill_manager_->WillSubmitForm(form, TimeTicks::Now());
3184 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); 3328 autofill_manager_->WillSubmitForm(form, TimeTicks::Now());
3185 histogram_tester.ExpectBucketCount( 3329 histogram_tester.ExpectBucketCount(
3186 "Autofill.FormEvents.Address", 3330 "Autofill.FormEvents.Address",
3331 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0);
3332 histogram_tester.ExpectBucketCount(
3333 "Autofill.FormEvents.Address",
3187 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); 3334 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1);
3188 histogram_tester.ExpectBucketCount( 3335 histogram_tester.ExpectBucketCount(
3189 "Autofill.FormEvents.Address", 3336 "Autofill.FormEvents.Address",
3337 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0);
3338 histogram_tester.ExpectBucketCount(
3339 "Autofill.FormEvents.Address",
3340 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0);
3341 histogram_tester.ExpectBucketCount(
3342 "Autofill.FormEvents.Address",
3343 AutofillMetrics::
3344 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE,
3345 0);
3346 histogram_tester.ExpectBucketCount(
3347 "Autofill.FormEvents.Address",
3348 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0);
3349 histogram_tester.ExpectBucketCount(
3350 "Autofill.FormEvents.Address",
3190 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); 3351 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0);
3191 histogram_tester.ExpectBucketCount( 3352 histogram_tester.ExpectBucketCount(
3192 "Autofill.FormEvents.Address", 3353 "Autofill.FormEvents.Address",
3193 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); 3354 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0);
3194 histogram_tester.ExpectBucketCount( 3355 histogram_tester.ExpectBucketCount(
3195 "Autofill.FormEvents.Address", 3356 "Autofill.FormEvents.Address",
3196 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); 3357 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
3358 histogram_tester.ExpectBucketCount(
3359 "Autofill.FormEvents.Address",
3360 AutofillMetrics::
3361 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE,
3362 0);
3197 } 3363 }
3198 3364
3199 // Reset the autofill manager state. 3365 // Reset the autofill manager state.
3200 autofill_manager_->Reset(); 3366 autofill_manager_->Reset();
3201 autofill_manager_->AddSeenForm(form, field_types, field_types); 3367 autofill_manager_->AddSeenForm(form, field_types, field_types);
3202 3368
3203 { 3369 {
3204 // Simulating submission without previous interaction. 3370 // Simulating submission with suggestion shown but without previous
3371 // interaction.
3205 base::HistogramTester histogram_tester; 3372 base::HistogramTester histogram_tester;
3373 autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field);
3206 autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); 3374 autofill_manager_->WillSubmitForm(form, TimeTicks::Now());
3207 histogram_tester.ExpectBucketCount( 3375 histogram_tester.ExpectBucketCount(
3208 "Autofill.FormEvents.Address", 3376 "Autofill.FormEvents.Address",
3377 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0);
3378 histogram_tester.ExpectBucketCount(
3379 "Autofill.FormEvents.Address",
3209 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0); 3380 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0);
3210 histogram_tester.ExpectBucketCount( 3381 histogram_tester.ExpectBucketCount(
3211 "Autofill.FormEvents.Address", 3382 "Autofill.FormEvents.Address",
3212 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0); 3383 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0);
3213 histogram_tester.ExpectBucketCount( 3384 histogram_tester.ExpectBucketCount(
3214 "Autofill.FormEvents.Address", 3385 "Autofill.FormEvents.Address",
3215 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); 3386 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0);
3216 histogram_tester.ExpectBucketCount( 3387 histogram_tester.ExpectBucketCount(
3217 "Autofill.FormEvents.Address", 3388 "Autofill.FormEvents.Address",
3389 AutofillMetrics::
3390 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE,
3391 0);
3392 histogram_tester.ExpectBucketCount(
3393 "Autofill.FormEvents.Address",
3394 AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0);
3395 histogram_tester.ExpectBucketCount(
3396 "Autofill.FormEvents.Address",
3218 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); 3397 AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0);
3219 histogram_tester.ExpectBucketCount( 3398 histogram_tester.ExpectBucketCount(
3220 "Autofill.FormEvents.Address", 3399 "Autofill.FormEvents.Address",
3221 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); 3400 AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0);
3222 histogram_tester.ExpectBucketCount( 3401 histogram_tester.ExpectBucketCount(
3223 "Autofill.FormEvents.Address", 3402 "Autofill.FormEvents.Address",
3224 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); 3403 AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0);
3404 histogram_tester.ExpectBucketCount(
3405 "Autofill.FormEvents.Address",
3406 AutofillMetrics::
3407 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE,
3408 0);
3225 } 3409 }
3226 } 3410 }
3227 3411
3228 // Test that we log interacted form event for credit cards only once. 3412 // Test that we log interacted form event for credit cards only once.
3229 TEST_F(AutofillMetricsTest, CreditCardFormEventsAreSegmented) { 3413 TEST_F(AutofillMetricsTest, CreditCardFormEventsAreSegmented) {
3230 EnableWalletSync(); 3414 EnableWalletSync();
3231 3415
3232 // Set up our form data. 3416 // Set up our form data.
3233 FormData form; 3417 FormData form;
3234 form.name = ASCIIToUTF16("TestForm"); 3418 form.name = ASCIIToUTF16("TestForm");
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
4133 EXPECT_THAT( 4317 EXPECT_THAT(
4134 histogram_tester.GetAllSamples("Autofill.ServerResponseHasDataForForm"), 4318 histogram_tester.GetAllSamples("Autofill.ServerResponseHasDataForForm"),
4135 ElementsAre(Bucket(true, 2))); 4319 ElementsAre(Bucket(true, 2)));
4136 4320
4137 // No RAPPOR metrics are logged in the case there is at least some server data 4321 // No RAPPOR metrics are logged in the case there is at least some server data
4138 // available for all forms. 4322 // available for all forms.
4139 EXPECT_EQ(0, rappor_service_.GetReportsCount()); 4323 EXPECT_EQ(0, rappor_service_.GetReportsCount());
4140 } 4324 }
4141 4325
4142 } // namespace autofill 4326 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698