 Chromium Code Reviews
 Chromium Code Reviews Issue 2575263002:
  [Autofill] Add a new metric for upstream.   (Closed)
    
  
    Issue 2575263002:
  [Autofill] Add a new metric for upstream.   (Closed) 
  | Index: components/autofill/core/browser/autofill_metrics_unittest.cc | 
| diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc | 
| index 459e871f029ce707dce4b3a961f7f8b451d45c45..83fd0624d16a65da25cc6a973e481971d3c4faab 100644 | 
| --- a/components/autofill/core/browser/autofill_metrics_unittest.cc | 
| +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc | 
| @@ -2413,6 +2413,24 @@ TEST_F(AutofillMetricsTest, CreditCardSubmittedFormEvents) { | 
| autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| { | 
| + // Simulating submission with suggestion shown. | 
| + base::HistogramTester histogram_tester; | 
| + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 
| + autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 
| + autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 1); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 1); | 
| + } | 
| + | 
| + // Reset the autofill manager state. | 
| + autofill_manager_->Reset(); | 
| + autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| + | 
| + { | 
| // Simulating submission with filled local data. | 
| base::HistogramTester histogram_tester; | 
| autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 
| @@ -2496,6 +2514,9 @@ TEST_F(AutofillMetricsTest, CreditCardSubmittedFormEvents) { | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| @@ -2510,6 +2531,9 @@ TEST_F(AutofillMetricsTest, CreditCardSubmittedFormEvents) { | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| @@ -2526,27 +2550,45 @@ TEST_F(AutofillMetricsTest, CreditCardSubmittedFormEvents) { | 
| autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| { | 
| - // Simulating submission without previous interaction. | 
| + // Simulating submission with suggestion shown but without previous | 
| + // interaction. | 
| base::HistogramTester histogram_tester; | 
| + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 
| autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); | 
| + AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 
| + AutofillMetrics:: | 
| + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, | 
| + 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics:: | 
| + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE, | 
| + 0); | 
| } | 
| } | 
| @@ -2600,6 +2642,24 @@ TEST_F(AutofillMetricsTest, CreditCardWillSubmitFormEvents) { | 
| autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| { | 
| + // Simulating submission with suggestion shown. | 
| + base::HistogramTester histogram_tester; | 
| + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 
| + autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 
| + autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 1); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0); | 
| + } | 
| + | 
| + // Reset the autofill manager state. | 
| + autofill_manager_->Reset(); | 
| + autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| + | 
| + { | 
| // Simulating submission with filled local data. | 
| base::HistogramTester histogram_tester; | 
| autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 
| @@ -2683,6 +2743,9 @@ TEST_F(AutofillMetricsTest, CreditCardWillSubmitFormEvents) { | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| @@ -2697,6 +2760,9 @@ TEST_F(AutofillMetricsTest, CreditCardWillSubmitFormEvents) { | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| @@ -2713,27 +2779,45 @@ TEST_F(AutofillMetricsTest, CreditCardWillSubmitFormEvents) { | 
| autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| { | 
| - // Simulating submission without previous interaction. | 
| + // Simulating submission with suggestion shown but without previous | 
| + // interaction. | 
| base::HistogramTester histogram_tester; | 
| + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 
| autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); | 
| + AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 
| + AutofillMetrics:: | 
| + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, | 
| + 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.CreditCard", | 
| - AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + 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.
 | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.CreditCard", | 
| + AutofillMetrics:: | 
| + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE, | 
| + 0); | 
| } | 
| } | 
| @@ -2991,6 +3075,24 @@ TEST_F(AutofillMetricsTest, AddressSubmittedFormEvents) { | 
| autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| { | 
| + // Simulating submission with suggestion shown. | 
| + base::HistogramTester histogram_tester; | 
| + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 
| + autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 
| + autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 1); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 1); | 
| + } | 
| + | 
| + // Reset the autofill manager state. | 
| + autofill_manager_->Reset(); | 
| + autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| + | 
| + { | 
| // Simulating submission with filled local data. | 
| base::HistogramTester histogram_tester; | 
| autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 
| @@ -3043,6 +3145,9 @@ TEST_F(AutofillMetricsTest, AddressSubmittedFormEvents) { | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| @@ -3052,6 +3157,9 @@ TEST_F(AutofillMetricsTest, AddressSubmittedFormEvents) { | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| @@ -3063,11 +3171,16 @@ TEST_F(AutofillMetricsTest, AddressSubmittedFormEvents) { | 
| autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| { | 
| - // Simulating submission without previous interaction. | 
| + // Simulating submission with suggestion show but without previous | 
| + // interaction. | 
| base::HistogramTester histogram_tester; | 
| + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 
| autofill_manager_->SubmitForm(form, TimeTicks::Now()); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| @@ -3077,6 +3190,14 @@ TEST_F(AutofillMetricsTest, AddressSubmittedFormEvents) { | 
| AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| + AutofillMetrics:: | 
| + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE, | 
| + 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| @@ -3084,6 +3205,11 @@ TEST_F(AutofillMetricsTest, AddressSubmittedFormEvents) { | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics:: | 
| + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, | 
| + 0); | 
| } | 
| } | 
| @@ -3135,6 +3261,24 @@ TEST_F(AutofillMetricsTest, AddressWillSubmitFormEvents) { | 
| autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| { | 
| + // Simulating submission with suggestion shown. | 
| + base::HistogramTester histogram_tester; | 
| + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 
| + autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 
| + autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 1); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0); | 
| + } | 
| + | 
| + // Reset the autofill manager state. | 
| + autofill_manager_->Reset(); | 
| + autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| + | 
| + { | 
| // Simulating submission with filled local data. | 
| base::HistogramTester histogram_tester; | 
| autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); | 
| @@ -3184,9 +3328,26 @@ TEST_F(AutofillMetricsTest, AddressWillSubmitFormEvents) { | 
| autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics:: | 
| + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE, | 
| + 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| @@ -3194,6 +3355,11 @@ TEST_F(AutofillMetricsTest, AddressWillSubmitFormEvents) { | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics:: | 
| + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, | 
| + 0); | 
| } | 
| // Reset the autofill manager state. | 
| @@ -3201,11 +3367,16 @@ TEST_F(AutofillMetricsTest, AddressWillSubmitFormEvents) { | 
| autofill_manager_->AddSeenForm(form, field_types, field_types); | 
| { | 
| - // Simulating submission without previous interaction. | 
| + // Simulating submission with suggestion shown but without previous | 
| + // interaction. | 
| base::HistogramTester histogram_tester; | 
| + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); | 
| autofill_manager_->WillSubmitForm(form, TimeTicks::Now()); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| @@ -3215,6 +3386,14 @@ TEST_F(AutofillMetricsTest, AddressWillSubmitFormEvents) { | 
| AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| + AutofillMetrics:: | 
| + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE, | 
| + 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 0); | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| @@ -3222,6 +3401,11 @@ TEST_F(AutofillMetricsTest, AddressWillSubmitFormEvents) { | 
| histogram_tester.ExpectBucketCount( | 
| "Autofill.FormEvents.Address", | 
| AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE, 0); | 
| + histogram_tester.ExpectBucketCount( | 
| + "Autofill.FormEvents.Address", | 
| + AutofillMetrics:: | 
| + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, | 
| + 0); | 
| } | 
| } |