Chromium Code Reviews| 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 3764d3fe4b9bd3f20c26c96a7cb12a1612925b12..9336b89362ea0768d113caf8890b0428a85e1477 100644 |
| --- a/components/autofill/core/browser/autofill_metrics_unittest.cc |
| +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc |
| @@ -1299,6 +1299,16 @@ TEST_F(AutofillMetricsTest, CreditCardSelectedFormEvents) { |
| form.fields.push_back(field); |
| field_types.push_back(CREDIT_CARD_NUMBER); |
| + // On iOS, the credit card field will only be filled out if that's the one |
| + // selected, since we only fill out one field at a time. On other platforms, |
| + // it doesn't matter which field is selected. |
| + FormFieldData selected_field; |
|
Evan Stade
2015/05/14 22:41:38
why not just makes this form.fields[2] for all pla
Justin Donnelly
2015/05/14 22:43:45
I figured it would be better to continue to test t
Evan Stade
2015/05/14 22:45:34
that's not really what this test is testing. The o
Justin Donnelly
2015/05/15 19:26:58
Understood that we're testing the logging here. I
|
| +#if defined(OS_IOS) |
| + selected_field = form.fields[2]; // credit card field |
| +#else |
| + selected_field = form.fields[0]; |
| +#endif // defined(OS_IOS) |
| + |
| // Simulate having seen this form on page load. |
| // |form_structure| will be owned by |autofill_manager_|. |
| autofill_manager_->AddSeenForm(form, field_types, field_types); |
| @@ -1310,7 +1320,7 @@ TEST_F(AutofillMetricsTest, CreditCardSelectedFormEvents) { |
| "10000000-0000-0000-0000-000000000002", 0); // masked server card |
| autofill_manager_->FillOrPreviewForm( |
| AutofillDriver::FORM_DATA_ACTION_FILL, |
| - 0, form, form.fields.front(), |
| + 0, form, selected_field, |
| autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); |
| histogram_tester.ExpectBucketCount( |
| "Autofill.FormEvents.CreditCard", |
| @@ -1332,11 +1342,11 @@ TEST_F(AutofillMetricsTest, CreditCardSelectedFormEvents) { |
| "10000000-0000-0000-0000-000000000002", 0); // masked server card |
| autofill_manager_->FillOrPreviewForm( |
| AutofillDriver::FORM_DATA_ACTION_FILL, |
| - 0, form, form.fields.front(), |
| + 0, form, selected_field, |
| autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); |
| autofill_manager_->FillOrPreviewForm( |
| AutofillDriver::FORM_DATA_ACTION_FILL, |
| - 0, form, form.fields.front(), |
| + 0, form, selected_field, |
| autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); |
| histogram_tester.ExpectBucketCount( |
| "Autofill.FormEvents.CreditCard", |