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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 // |form_structure| will be owned by |autofill_manager_|. | 1303 // |form_structure| will be owned by |autofill_manager_|. |
1304 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1304 autofill_manager_->AddSeenForm(form, field_types, field_types); |
1305 | 1305 |
1306 { | 1306 { |
1307 // Simulating selecting a masked card server suggestion. | 1307 // Simulating selecting a masked card server suggestion. |
1308 base::HistogramTester histogram_tester; | 1308 base::HistogramTester histogram_tester; |
1309 SuggestionBackendID guid( | 1309 SuggestionBackendID guid( |
1310 "10000000-0000-0000-0000-000000000002", 0); // masked server card | 1310 "10000000-0000-0000-0000-000000000002", 0); // masked server card |
1311 autofill_manager_->FillOrPreviewForm( | 1311 autofill_manager_->FillOrPreviewForm( |
1312 AutofillDriver::FORM_DATA_ACTION_FILL, | 1312 AutofillDriver::FORM_DATA_ACTION_FILL, |
1313 0, form, form.fields.front(), | 1313 0, form, form.fields[2], |
1314 autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); | 1314 autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); |
1315 histogram_tester.ExpectBucketCount( | 1315 histogram_tester.ExpectBucketCount( |
1316 "Autofill.FormEvents.CreditCard", | 1316 "Autofill.FormEvents.CreditCard", |
1317 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED, 1); | 1317 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED, 1); |
1318 histogram_tester.ExpectBucketCount( | 1318 histogram_tester.ExpectBucketCount( |
1319 "Autofill.FormEvents.CreditCard", | 1319 "Autofill.FormEvents.CreditCard", |
1320 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED_ONCE, | 1320 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED_ONCE, |
1321 1); | 1321 1); |
1322 } | 1322 } |
1323 | 1323 |
1324 // Reset the autofill manager state. | 1324 // Reset the autofill manager state. |
1325 autofill_manager_->Reset(); | 1325 autofill_manager_->Reset(); |
1326 autofill_manager_->AddSeenForm(form, field_types, field_types); | 1326 autofill_manager_->AddSeenForm(form, field_types, field_types); |
1327 | 1327 |
1328 { | 1328 { |
1329 // Simulating selecting multiple times a masked card server. | 1329 // Simulating selecting multiple times a masked card server. |
1330 base::HistogramTester histogram_tester; | 1330 base::HistogramTester histogram_tester; |
1331 SuggestionBackendID guid( | 1331 SuggestionBackendID guid( |
1332 "10000000-0000-0000-0000-000000000002", 0); // masked server card | 1332 "10000000-0000-0000-0000-000000000002", 0); // masked server card |
1333 autofill_manager_->FillOrPreviewForm( | 1333 autofill_manager_->FillOrPreviewForm( |
1334 AutofillDriver::FORM_DATA_ACTION_FILL, | 1334 AutofillDriver::FORM_DATA_ACTION_FILL, |
1335 0, form, form.fields.front(), | 1335 0, form, form.fields[2], |
1336 autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); | 1336 autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); |
1337 autofill_manager_->FillOrPreviewForm( | 1337 autofill_manager_->FillOrPreviewForm( |
1338 AutofillDriver::FORM_DATA_ACTION_FILL, | 1338 AutofillDriver::FORM_DATA_ACTION_FILL, |
1339 0, form, form.fields.front(), | 1339 0, form, form.fields[2], |
1340 autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); | 1340 autofill_manager_->MakeFrontendID(guid, SuggestionBackendID())); |
1341 histogram_tester.ExpectBucketCount( | 1341 histogram_tester.ExpectBucketCount( |
1342 "Autofill.FormEvents.CreditCard", | 1342 "Autofill.FormEvents.CreditCard", |
1343 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED, 2); | 1343 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED, 2); |
1344 histogram_tester.ExpectBucketCount( | 1344 histogram_tester.ExpectBucketCount( |
1345 "Autofill.FormEvents.CreditCard", | 1345 "Autofill.FormEvents.CreditCard", |
1346 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED_ONCE, | 1346 AutofillMetrics::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED_ONCE, |
1347 1); | 1347 1); |
1348 } | 1348 } |
1349 } | 1349 } |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3040 histogram_tester.ExpectTotalCount( | 3040 histogram_tester.ExpectTotalCount( |
3041 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); | 3041 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); |
3042 histogram_tester.ExpectTotalCount( | 3042 histogram_tester.ExpectTotalCount( |
3043 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 3043 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
3044 | 3044 |
3045 autofill_manager_->Reset(); | 3045 autofill_manager_->Reset(); |
3046 } | 3046 } |
3047 } | 3047 } |
3048 | 3048 |
3049 } // namespace autofill | 3049 } // namespace autofill |
OLD | NEW |