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

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

Issue 13264002: Requery the autofill server when forms and input fields are dynamically added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fun with merging Created 7 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <vector> 5 #include <vector>
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" 12 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
13 #include "chrome/browser/autofill/personal_data_manager_factory.h" 13 #include "chrome/browser/autofill/personal_data_manager_factory.h"
14 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" 14 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h"
15 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 15 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
16 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
17 #include "components/autofill/browser/autocheckout_page_meta_data.h" 17 #include "components/autofill/browser/autocheckout_page_meta_data.h"
18 #include "components/autofill/browser/autofill_common_test.h" 18 #include "components/autofill/browser/autofill_common_test.h"
19 #include "components/autofill/browser/autofill_manager.h" 19 #include "components/autofill/browser/autofill_manager.h"
20 #include "components/autofill/browser/autofill_manager_delegate.h" 20 #include "components/autofill/browser/autofill_manager_delegate.h"
21 #include "components/autofill/browser/autofill_metrics.h" 21 #include "components/autofill/browser/autofill_metrics.h"
22 #include "components/autofill/browser/personal_data_manager.h" 22 #include "components/autofill/browser/personal_data_manager.h"
23 #include "components/autofill/common/form_data.h" 23 #include "components/autofill/common/form_data.h"
24 #include "components/autofill/common/form_field_data.h" 24 #include "components/autofill/common/form_field_data.h"
25 #include "components/autofill/common/forms_seen_state.h"
25 #include "components/webdata/common/web_data_results.h" 26 #include "components/webdata/common/web_data_results.h"
26 #include "content/public/test/test_browser_thread.h" 27 #include "content/public/test/test_browser_thread.h"
27 #include "content/public/test/test_utils.h" 28 #include "content/public/test/test_utils.h"
28 #include "googleurl/src/gurl.h" 29 #include "googleurl/src/gurl.h"
29 #include "testing/gmock/include/gmock/gmock.h" 30 #include "testing/gmock/include/gmock/gmock.h"
30 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
31 #include "ui/gfx/rect.h" 32 #include "ui/gfx/rect.h"
32 33
33 using content::BrowserThread; 34 using content::BrowserThread;
34 using ::testing::_; 35 using ::testing::_;
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 form.fields.push_back(field); 771 form.fields.push_back(field);
771 test::CreateTestFormField("Email", "email", "", "text", &field); 772 test::CreateTestFormField("Email", "email", "", "text", &field);
772 form.fields.push_back(field); 773 form.fields.push_back(field);
773 774
774 std::vector<FormData> forms(1, form); 775 std::vector<FormData> forms(1, form);
775 776
776 // Ensure no metrics are logged when loading a non-fillable form. 777 // Ensure no metrics are logged when loading a non-fillable form.
777 { 778 {
778 EXPECT_CALL(*autofill_manager_->metric_logger(), 779 EXPECT_CALL(*autofill_manager_->metric_logger(),
779 LogDeveloperEngagementMetric(_)).Times(0); 780 LogDeveloperEngagementMetric(_)).Times(0);
780 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 781 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
782 autofill::NO_SPECIAL_FORMS_SEEN);
781 autofill_manager_->Reset(); 783 autofill_manager_->Reset();
782 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 784 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
783 } 785 }
784 786
785 // Add another field to the form, so that it becomes fillable. 787 // Add another field to the form, so that it becomes fillable.
786 test::CreateTestFormField("Phone", "phone", "", "text", &field); 788 test::CreateTestFormField("Phone", "phone", "", "text", &field);
787 forms.back().fields.push_back(field); 789 forms.back().fields.push_back(field);
788 790
789 // Expect only the "form parsed" metric to be logged; no metrics about 791 // Expect only the "form parsed" metric to be logged; no metrics about
790 // author-specified field type hints. 792 // author-specified field type hints.
791 { 793 {
792 EXPECT_CALL( 794 EXPECT_CALL(
793 *autofill_manager_->metric_logger(), 795 *autofill_manager_->metric_logger(),
794 LogDeveloperEngagementMetric( 796 LogDeveloperEngagementMetric(
795 AutofillMetrics::FILLABLE_FORM_PARSED)).Times(1); 797 AutofillMetrics::FILLABLE_FORM_PARSED)).Times(1);
796 EXPECT_CALL( 798 EXPECT_CALL(
797 *autofill_manager_->metric_logger(), 799 *autofill_manager_->metric_logger(),
798 LogDeveloperEngagementMetric( 800 LogDeveloperEngagementMetric(
799 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS)).Times(0); 801 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS)).Times(0);
800 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 802 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
803 autofill::NO_SPECIAL_FORMS_SEEN);
801 autofill_manager_->Reset(); 804 autofill_manager_->Reset();
802 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 805 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
803 } 806 }
804 807
805 // Add some fields with an author-specified field type to the form. 808 // Add some fields with an author-specified field type to the form.
806 // We need to add at least three fields, because a form must have at least 809 // We need to add at least three fields, because a form must have at least
807 // three fillable fields to be considered to be autofillable; and if at least 810 // three fillable fields to be considered to be autofillable; and if at least
808 // one field specifies an explicit type hint, we don't apply any of our usual 811 // one field specifies an explicit type hint, we don't apply any of our usual
809 // local heuristics to detect field types in the rest of the form. 812 // local heuristics to detect field types in the rest of the form.
810 test::CreateTestFormField("", "", "", "text", &field); 813 test::CreateTestFormField("", "", "", "text", &field);
(...skipping 10 matching lines...) Expand all
821 // hints metric to be logged. 824 // hints metric to be logged.
822 { 825 {
823 EXPECT_CALL( 826 EXPECT_CALL(
824 *autofill_manager_->metric_logger(), 827 *autofill_manager_->metric_logger(),
825 LogDeveloperEngagementMetric( 828 LogDeveloperEngagementMetric(
826 AutofillMetrics::FILLABLE_FORM_PARSED)).Times(1); 829 AutofillMetrics::FILLABLE_FORM_PARSED)).Times(1);
827 EXPECT_CALL( 830 EXPECT_CALL(
828 *autofill_manager_->metric_logger(), 831 *autofill_manager_->metric_logger(),
829 LogDeveloperEngagementMetric( 832 LogDeveloperEngagementMetric(
830 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS)).Times(1); 833 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS)).Times(1);
831 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 834 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
835 autofill::NO_SPECIAL_FORMS_SEEN);
832 autofill_manager_->Reset(); 836 autofill_manager_->Reset();
833 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 837 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
834 } 838 }
835 } 839 }
836 840
837 // Test that we don't log quality metrics for non-autofillable forms. 841 // Test that we don't log quality metrics for non-autofillable forms.
838 TEST_F(AutofillMetricsTest, NoQualityMetricsForNonAutofillableForms) { 842 TEST_F(AutofillMetricsTest, NoQualityMetricsForNonAutofillableForms) {
839 // Forms must include at least three fields to be auto-fillable. 843 // Forms must include at least three fields to be auto-fillable.
840 FormData form; 844 FormData form;
841 form.name = ASCIIToUTF16("TestForm"); 845 form.name = ASCIIToUTF16("TestForm");
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 } 1100 }
1097 1101
1098 // Test that we log whether Autofill is enabled when filling a form. 1102 // Test that we log whether Autofill is enabled when filling a form.
1099 TEST_F(AutofillMetricsTest, AutofillIsEnabledAtPageLoad) { 1103 TEST_F(AutofillMetricsTest, AutofillIsEnabledAtPageLoad) {
1100 // Establish our expectations. 1104 // Establish our expectations.
1101 ::testing::InSequence dummy; 1105 ::testing::InSequence dummy;
1102 EXPECT_CALL(*autofill_manager_->metric_logger(), 1106 EXPECT_CALL(*autofill_manager_->metric_logger(),
1103 LogIsAutofillEnabledAtPageLoad(true)).Times(1); 1107 LogIsAutofillEnabledAtPageLoad(true)).Times(1);
1104 1108
1105 autofill_manager_->set_autofill_enabled(true); 1109 autofill_manager_->set_autofill_enabled(true);
1106 autofill_manager_->OnFormsSeen(std::vector<FormData>(), TimeTicks(), false); 1110 autofill_manager_->OnFormsSeen(std::vector<FormData>(), TimeTicks(),
1111 autofill::NO_SPECIAL_FORMS_SEEN);
1107 1112
1108 // Reset the autofill manager state. 1113 // Reset the autofill manager state.
1109 autofill_manager_->Reset(); 1114 autofill_manager_->Reset();
1110 1115
1111 // Establish our expectations. 1116 // Establish our expectations.
1112 EXPECT_CALL(*autofill_manager_->metric_logger(), 1117 EXPECT_CALL(*autofill_manager_->metric_logger(),
1113 LogIsAutofillEnabledAtPageLoad(false)).Times(1); 1118 LogIsAutofillEnabledAtPageLoad(false)).Times(1);
1114 1119
1115 autofill_manager_->set_autofill_enabled(false); 1120 autofill_manager_->set_autofill_enabled(false);
1116 autofill_manager_->OnFormsSeen(std::vector<FormData>(), TimeTicks(), false); 1121 autofill_manager_->OnFormsSeen(std::vector<FormData>(), TimeTicks(),
1122 autofill::NO_SPECIAL_FORMS_SEEN);
1117 } 1123 }
1118 1124
1119 // Test that credit card infobar metrics are logged correctly. 1125 // Test that credit card infobar metrics are logged correctly.
1120 TEST_F(AutofillMetricsTest, CreditCardInfoBar) { 1126 TEST_F(AutofillMetricsTest, CreditCardInfoBar) {
1121 testing::NiceMock<MockAutofillMetrics> metric_logger; 1127 testing::NiceMock<MockAutofillMetrics> metric_logger;
1122 ::testing::InSequence dummy; 1128 ::testing::InSequence dummy;
1123 1129
1124 // Accept the infobar. 1130 // Accept the infobar.
1125 { 1131 {
1126 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger)); 1132 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger));
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 form.fields.push_back(field); 1225 form.fields.push_back(field);
1220 test::CreateTestFormField("Email", "email", "", "text", &field); 1226 test::CreateTestFormField("Email", "email", "", "text", &field);
1221 form.fields.push_back(field); 1227 form.fields.push_back(field);
1222 1228
1223 std::vector<FormData> forms(1, form); 1229 std::vector<FormData> forms(1, form);
1224 1230
1225 // Expect no notifications when the form is first seen. 1231 // Expect no notifications when the form is first seen.
1226 { 1232 {
1227 EXPECT_CALL(*autofill_manager_->metric_logger(), 1233 EXPECT_CALL(*autofill_manager_->metric_logger(),
1228 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED)).Times(0); 1234 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED)).Times(0);
1229 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 1235 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
1236 autofill::NO_SPECIAL_FORMS_SEEN);
1230 } 1237 }
1231 1238
1232 1239
1233 // Expect no notifications when the form is submitted. 1240 // Expect no notifications when the form is submitted.
1234 { 1241 {
1235 EXPECT_CALL( 1242 EXPECT_CALL(
1236 *autofill_manager_->metric_logger(), 1243 *autofill_manager_->metric_logger(),
1237 LogUserHappinessMetric( 1244 LogUserHappinessMetric(
1238 AutofillMetrics::SUBMITTED_FILLABLE_FORM_AUTOFILLED_ALL)).Times(0); 1245 AutofillMetrics::SUBMITTED_FILLABLE_FORM_AUTOFILLED_ALL)).Times(0);
1239 EXPECT_CALL( 1246 EXPECT_CALL(
(...skipping 15 matching lines...) Expand all
1255 test::CreateTestFormField("Phone", "phone", "", "text", &field); 1262 test::CreateTestFormField("Phone", "phone", "", "text", &field);
1256 form.fields.push_back(field); 1263 form.fields.push_back(field);
1257 test::CreateTestFormField("Unknown", "unknown", "", "text", &field); 1264 test::CreateTestFormField("Unknown", "unknown", "", "text", &field);
1258 form.fields.push_back(field); 1265 form.fields.push_back(field);
1259 forms.front() = form; 1266 forms.front() = form;
1260 1267
1261 // Expect a notification when the form is first seen. 1268 // Expect a notification when the form is first seen.
1262 { 1269 {
1263 EXPECT_CALL(*autofill_manager_->metric_logger(), 1270 EXPECT_CALL(*autofill_manager_->metric_logger(),
1264 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED)); 1271 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED));
1265 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 1272 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
1273 autofill::NO_SPECIAL_FORMS_SEEN);
1266 } 1274 }
1267 1275
1268 // Expect a notification when the form is submitted. 1276 // Expect a notification when the form is submitted.
1269 { 1277 {
1270 EXPECT_CALL(*autofill_manager_->metric_logger(), 1278 EXPECT_CALL(*autofill_manager_->metric_logger(),
1271 LogUserHappinessMetric( 1279 LogUserHappinessMetric(
1272 AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM)); 1280 AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM));
1273 autofill_manager_->FormSubmitted(form, TimeTicks::Now()); 1281 autofill_manager_->FormSubmitted(form, TimeTicks::Now());
1274 } 1282 }
1275 1283
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 form.fields.push_back(field); 1363 form.fields.push_back(field);
1356 test::CreateTestFormField("Phone", "phone", "", "text", &field); 1364 test::CreateTestFormField("Phone", "phone", "", "text", &field);
1357 form.fields.push_back(field); 1365 form.fields.push_back(field);
1358 1366
1359 std::vector<FormData> forms(1, form); 1367 std::vector<FormData> forms(1, form);
1360 1368
1361 // Expect a notification when the form is first seen. 1369 // Expect a notification when the form is first seen.
1362 { 1370 {
1363 EXPECT_CALL(*autofill_manager_->metric_logger(), 1371 EXPECT_CALL(*autofill_manager_->metric_logger(),
1364 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED)); 1372 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED));
1365 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 1373 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
1374 autofill::NO_SPECIAL_FORMS_SEEN);
1366 } 1375 }
1367 1376
1368 // Simulate typing. 1377 // Simulate typing.
1369 { 1378 {
1370 EXPECT_CALL(*autofill_manager_->metric_logger(), 1379 EXPECT_CALL(*autofill_manager_->metric_logger(),
1371 LogUserHappinessMetric(AutofillMetrics::USER_DID_TYPE)); 1380 LogUserHappinessMetric(AutofillMetrics::USER_DID_TYPE));
1372 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1381 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1373 TimeTicks()); 1382 TimeTicks());
1374 } 1383 }
1375 1384
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 EXPECT_CALL(*autofill_manager_->metric_logger(), 1484 EXPECT_CALL(*autofill_manager_->metric_logger(),
1476 LogFormFillDurationFromLoadWithAutofill(_)).Times(0); 1485 LogFormFillDurationFromLoadWithAutofill(_)).Times(0);
1477 EXPECT_CALL(*autofill_manager_->metric_logger(), 1486 EXPECT_CALL(*autofill_manager_->metric_logger(),
1478 LogFormFillDurationFromLoadWithoutAutofill( 1487 LogFormFillDurationFromLoadWithoutAutofill(
1479 TimeDelta::FromInternalValue(16))); 1488 TimeDelta::FromInternalValue(16)));
1480 EXPECT_CALL(*autofill_manager_->metric_logger(), 1489 EXPECT_CALL(*autofill_manager_->metric_logger(),
1481 LogFormFillDurationFromInteractionWithAutofill(_)).Times(0); 1490 LogFormFillDurationFromInteractionWithAutofill(_)).Times(0);
1482 EXPECT_CALL(*autofill_manager_->metric_logger(), 1491 EXPECT_CALL(*autofill_manager_->metric_logger(),
1483 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0); 1492 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0);
1484 autofill_manager_->OnFormsSeen( 1493 autofill_manager_->OnFormsSeen(
1485 forms, TimeTicks::FromInternalValue(1), false); 1494 forms, TimeTicks::FromInternalValue(1),
1495 autofill::NO_SPECIAL_FORMS_SEEN);
1486 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1496 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1487 autofill_manager_->Reset(); 1497 autofill_manager_->Reset();
1488 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1498 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1489 } 1499 }
1490 1500
1491 // Expect metric to be logged if the user manually edited a form field. 1501 // Expect metric to be logged if the user manually edited a form field.
1492 { 1502 {
1493 EXPECT_CALL(*autofill_manager_->metric_logger(), 1503 EXPECT_CALL(*autofill_manager_->metric_logger(),
1494 LogFormFillDurationFromLoadWithAutofill(_)).Times(0); 1504 LogFormFillDurationFromLoadWithAutofill(_)).Times(0);
1495 EXPECT_CALL(*autofill_manager_->metric_logger(), 1505 EXPECT_CALL(*autofill_manager_->metric_logger(),
1496 LogFormFillDurationFromLoadWithoutAutofill( 1506 LogFormFillDurationFromLoadWithoutAutofill(
1497 TimeDelta::FromInternalValue(16))); 1507 TimeDelta::FromInternalValue(16)));
1498 EXPECT_CALL(*autofill_manager_->metric_logger(), 1508 EXPECT_CALL(*autofill_manager_->metric_logger(),
1499 LogFormFillDurationFromInteractionWithAutofill(_)).Times(0); 1509 LogFormFillDurationFromInteractionWithAutofill(_)).Times(0);
1500 EXPECT_CALL(*autofill_manager_->metric_logger(), 1510 EXPECT_CALL(*autofill_manager_->metric_logger(),
1501 LogFormFillDurationFromInteractionWithoutAutofill( 1511 LogFormFillDurationFromInteractionWithoutAutofill(
1502 TimeDelta::FromInternalValue(14))); 1512 TimeDelta::FromInternalValue(14)));
1503 autofill_manager_->OnFormsSeen( 1513 autofill_manager_->OnFormsSeen(
1504 forms, TimeTicks::FromInternalValue(1), false); 1514 forms, TimeTicks::FromInternalValue(1),
1515 autofill::NO_SPECIAL_FORMS_SEEN);
1505 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1516 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1506 TimeTicks::FromInternalValue(3)); 1517 TimeTicks::FromInternalValue(3));
1507 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1518 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1508 autofill_manager_->Reset(); 1519 autofill_manager_->Reset();
1509 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1520 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1510 } 1521 }
1511 1522
1512 // Expect metric to be logged if the user autofilled the form. 1523 // Expect metric to be logged if the user autofilled the form.
1513 form.fields[0].is_autofilled = true; 1524 form.fields[0].is_autofilled = true;
1514 { 1525 {
1515 EXPECT_CALL(*autofill_manager_->metric_logger(), 1526 EXPECT_CALL(*autofill_manager_->metric_logger(),
1516 LogFormFillDurationFromLoadWithAutofill( 1527 LogFormFillDurationFromLoadWithAutofill(
1517 TimeDelta::FromInternalValue(16))); 1528 TimeDelta::FromInternalValue(16)));
1518 EXPECT_CALL(*autofill_manager_->metric_logger(), 1529 EXPECT_CALL(*autofill_manager_->metric_logger(),
1519 LogFormFillDurationFromLoadWithoutAutofill(_)).Times(0); 1530 LogFormFillDurationFromLoadWithoutAutofill(_)).Times(0);
1520 EXPECT_CALL(*autofill_manager_->metric_logger(), 1531 EXPECT_CALL(*autofill_manager_->metric_logger(),
1521 LogFormFillDurationFromInteractionWithAutofill( 1532 LogFormFillDurationFromInteractionWithAutofill(
1522 TimeDelta::FromInternalValue(12))); 1533 TimeDelta::FromInternalValue(12)));
1523 EXPECT_CALL(*autofill_manager_->metric_logger(), 1534 EXPECT_CALL(*autofill_manager_->metric_logger(),
1524 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0); 1535 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0);
1525 autofill_manager_->OnFormsSeen( 1536 autofill_manager_->OnFormsSeen(
1526 forms, TimeTicks::FromInternalValue(1), false); 1537 forms, TimeTicks::FromInternalValue(1),
1538 autofill::NO_SPECIAL_FORMS_SEEN);
1527 autofill_manager_->OnDidFillAutofillFormData( 1539 autofill_manager_->OnDidFillAutofillFormData(
1528 TimeTicks::FromInternalValue(5)); 1540 TimeTicks::FromInternalValue(5));
1529 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1541 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1530 autofill_manager_->Reset(); 1542 autofill_manager_->Reset();
1531 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1543 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1532 } 1544 }
1533 1545
1534 // Expect metric to be logged if the user both manually filled some fields 1546 // Expect metric to be logged if the user both manually filled some fields
1535 // and autofilled others. Messages can arrive out of order, so make sure they 1547 // and autofilled others. Messages can arrive out of order, so make sure they
1536 // take precedence appropriately. 1548 // take precedence appropriately.
1537 { 1549 {
1538 EXPECT_CALL(*autofill_manager_->metric_logger(), 1550 EXPECT_CALL(*autofill_manager_->metric_logger(),
1539 LogFormFillDurationFromLoadWithAutofill( 1551 LogFormFillDurationFromLoadWithAutofill(
1540 TimeDelta::FromInternalValue(16))); 1552 TimeDelta::FromInternalValue(16)));
1541 EXPECT_CALL(*autofill_manager_->metric_logger(), 1553 EXPECT_CALL(*autofill_manager_->metric_logger(),
1542 LogFormFillDurationFromLoadWithoutAutofill(_)).Times(0); 1554 LogFormFillDurationFromLoadWithoutAutofill(_)).Times(0);
1543 EXPECT_CALL(*autofill_manager_->metric_logger(), 1555 EXPECT_CALL(*autofill_manager_->metric_logger(),
1544 LogFormFillDurationFromInteractionWithAutofill( 1556 LogFormFillDurationFromInteractionWithAutofill(
1545 TimeDelta::FromInternalValue(14))); 1557 TimeDelta::FromInternalValue(14)));
1546 EXPECT_CALL(*autofill_manager_->metric_logger(), 1558 EXPECT_CALL(*autofill_manager_->metric_logger(),
1547 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0); 1559 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0);
1548 autofill_manager_->OnFormsSeen( 1560 autofill_manager_->OnFormsSeen(
1549 forms, TimeTicks::FromInternalValue(1), false); 1561 forms, TimeTicks::FromInternalValue(1),
1562 autofill::NO_SPECIAL_FORMS_SEEN);
1550 autofill_manager_->OnDidFillAutofillFormData( 1563 autofill_manager_->OnDidFillAutofillFormData(
1551 TimeTicks::FromInternalValue(5)); 1564 TimeTicks::FromInternalValue(5));
1552 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1565 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1553 TimeTicks::FromInternalValue(3)); 1566 TimeTicks::FromInternalValue(3));
1554 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1567 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1555 autofill_manager_->Reset(); 1568 autofill_manager_->Reset();
1556 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1569 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1557 } 1570 }
1558 } 1571 }
1559 1572
1560 } // namespace autofill 1573 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/browser/autofill_manager_unittest.cc ('k') | components/autofill/common/autofill_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698