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

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: rename some things, move around others Created 7 years, 8 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/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" 11 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
12 #include "chrome/browser/autofill/personal_data_manager_factory.h" 12 #include "chrome/browser/autofill/personal_data_manager_factory.h"
13 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" 13 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h"
14 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 14 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
15 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
16 #include "components/autofill/browser/autocheckout_page_meta_data.h" 16 #include "components/autofill/browser/autocheckout_page_meta_data.h"
17 #include "components/autofill/browser/autofill_common_test.h" 17 #include "components/autofill/browser/autofill_common_test.h"
18 #include "components/autofill/browser/autofill_manager.h" 18 #include "components/autofill/browser/autofill_manager.h"
19 #include "components/autofill/browser/autofill_manager_delegate.h" 19 #include "components/autofill/browser/autofill_manager_delegate.h"
20 #include "components/autofill/browser/autofill_metrics.h" 20 #include "components/autofill/browser/autofill_metrics.h"
21 #include "components/autofill/browser/personal_data_manager.h" 21 #include "components/autofill/browser/personal_data_manager.h"
22 #include "components/autofill/common/form_data.h" 22 #include "components/autofill/common/form_data.h"
23 #include "components/autofill/common/form_field_data.h" 23 #include "components/autofill/common/form_field_data.h"
24 #include "components/autofill/common/forms_seen_param.h"
24 #include "components/webdata/common/web_data_results.h" 25 #include "components/webdata/common/web_data_results.h"
25 #include "content/public/test/test_browser_thread.h" 26 #include "content/public/test/test_browser_thread.h"
26 #include "googleurl/src/gurl.h" 27 #include "googleurl/src/gurl.h"
27 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 #include "ui/gfx/rect.h" 30 #include "ui/gfx/rect.h"
30 31
31 using content::BrowserThread; 32 using content::BrowserThread;
32 using ::testing::_; 33 using ::testing::_;
33 using ::testing::AnyNumber; 34 using ::testing::AnyNumber;
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 form.fields.push_back(field); 786 form.fields.push_back(field);
786 autofill_test::CreateTestFormField("Email", "email", "", "text", &field); 787 autofill_test::CreateTestFormField("Email", "email", "", "text", &field);
787 form.fields.push_back(field); 788 form.fields.push_back(field);
788 789
789 std::vector<FormData> forms(1, form); 790 std::vector<FormData> forms(1, form);
790 791
791 // Ensure no metrics are logged when loading a non-fillable form. 792 // Ensure no metrics are logged when loading a non-fillable form.
792 { 793 {
793 EXPECT_CALL(*autofill_manager_->metric_logger(), 794 EXPECT_CALL(*autofill_manager_->metric_logger(),
794 LogDeveloperEngagementMetric(_)).Times(0); 795 LogDeveloperEngagementMetric(_)).Times(0);
795 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 796 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
797 autofill::NO_SPECIAL_FORMS_SEEN);
796 autofill_manager_->Reset(); 798 autofill_manager_->Reset();
797 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 799 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
798 } 800 }
799 801
800 // Add another field to the form, so that it becomes fillable. 802 // Add another field to the form, so that it becomes fillable.
801 autofill_test::CreateTestFormField("Phone", "phone", "", "text", &field); 803 autofill_test::CreateTestFormField("Phone", "phone", "", "text", &field);
802 forms.back().fields.push_back(field); 804 forms.back().fields.push_back(field);
803 805
804 // Expect only the "form parsed" metric to be logged; no metrics about 806 // Expect only the "form parsed" metric to be logged; no metrics about
805 // author-specified field type hints. 807 // author-specified field type hints.
806 { 808 {
807 EXPECT_CALL( 809 EXPECT_CALL(
808 *autofill_manager_->metric_logger(), 810 *autofill_manager_->metric_logger(),
809 LogDeveloperEngagementMetric( 811 LogDeveloperEngagementMetric(
810 AutofillMetrics::FILLABLE_FORM_PARSED)).Times(1); 812 AutofillMetrics::FILLABLE_FORM_PARSED)).Times(1);
811 EXPECT_CALL( 813 EXPECT_CALL(
812 *autofill_manager_->metric_logger(), 814 *autofill_manager_->metric_logger(),
813 LogDeveloperEngagementMetric( 815 LogDeveloperEngagementMetric(
814 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS)).Times(0); 816 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS)).Times(0);
815 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 817 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
818 autofill::NO_SPECIAL_FORMS_SEEN);
816 autofill_manager_->Reset(); 819 autofill_manager_->Reset();
817 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 820 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
818 } 821 }
819 822
820 // Add some fields with an author-specified field type to the form. 823 // Add some fields with an author-specified field type to the form.
821 // We need to add at least three fields, because a form must have at least 824 // We need to add at least three fields, because a form must have at least
822 // three fillable fields to be considered to be autofillable; and if at least 825 // three fillable fields to be considered to be autofillable; and if at least
823 // one field specifies an explicit type hint, we don't apply any of our usual 826 // one field specifies an explicit type hint, we don't apply any of our usual
824 // local heuristics to detect field types in the rest of the form. 827 // local heuristics to detect field types in the rest of the form.
825 autofill_test::CreateTestFormField("", "", "", "text", &field); 828 autofill_test::CreateTestFormField("", "", "", "text", &field);
(...skipping 10 matching lines...) Expand all
836 // hints metric to be logged. 839 // hints metric to be logged.
837 { 840 {
838 EXPECT_CALL( 841 EXPECT_CALL(
839 *autofill_manager_->metric_logger(), 842 *autofill_manager_->metric_logger(),
840 LogDeveloperEngagementMetric( 843 LogDeveloperEngagementMetric(
841 AutofillMetrics::FILLABLE_FORM_PARSED)).Times(1); 844 AutofillMetrics::FILLABLE_FORM_PARSED)).Times(1);
842 EXPECT_CALL( 845 EXPECT_CALL(
843 *autofill_manager_->metric_logger(), 846 *autofill_manager_->metric_logger(),
844 LogDeveloperEngagementMetric( 847 LogDeveloperEngagementMetric(
845 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS)).Times(1); 848 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS)).Times(1);
846 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 849 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
850 autofill::NO_SPECIAL_FORMS_SEEN);
847 autofill_manager_->Reset(); 851 autofill_manager_->Reset();
848 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 852 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
849 } 853 }
850 } 854 }
851 855
852 // Test that we don't log quality metrics for non-autofillable forms. 856 // Test that we don't log quality metrics for non-autofillable forms.
853 TEST_F(AutofillMetricsTest, NoQualityMetricsForNonAutofillableForms) { 857 TEST_F(AutofillMetricsTest, NoQualityMetricsForNonAutofillableForms) {
854 // Forms must include at least three fields to be auto-fillable. 858 // Forms must include at least three fields to be auto-fillable.
855 FormData form; 859 FormData form;
856 form.name = ASCIIToUTF16("TestForm"); 860 form.name = ASCIIToUTF16("TestForm");
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 } 1119 }
1116 1120
1117 // Test that we log whether Autofill is enabled when filling a form. 1121 // Test that we log whether Autofill is enabled when filling a form.
1118 TEST_F(AutofillMetricsTest, AutofillIsEnabledAtPageLoad) { 1122 TEST_F(AutofillMetricsTest, AutofillIsEnabledAtPageLoad) {
1119 // Establish our expectations. 1123 // Establish our expectations.
1120 ::testing::InSequence dummy; 1124 ::testing::InSequence dummy;
1121 EXPECT_CALL(*autofill_manager_->metric_logger(), 1125 EXPECT_CALL(*autofill_manager_->metric_logger(),
1122 LogIsAutofillEnabledAtPageLoad(true)).Times(1); 1126 LogIsAutofillEnabledAtPageLoad(true)).Times(1);
1123 1127
1124 autofill_manager_->set_autofill_enabled(true); 1128 autofill_manager_->set_autofill_enabled(true);
1125 autofill_manager_->OnFormsSeen(std::vector<FormData>(), TimeTicks(), false); 1129 autofill_manager_->OnFormsSeen(std::vector<FormData>(), TimeTicks(),
1130 autofill::NO_SPECIAL_FORMS_SEEN);
1126 1131
1127 // Reset the autofill manager state. 1132 // Reset the autofill manager state.
1128 autofill_manager_->Reset(); 1133 autofill_manager_->Reset();
1129 1134
1130 // Establish our expectations. 1135 // Establish our expectations.
1131 EXPECT_CALL(*autofill_manager_->metric_logger(), 1136 EXPECT_CALL(*autofill_manager_->metric_logger(),
1132 LogIsAutofillEnabledAtPageLoad(false)).Times(1); 1137 LogIsAutofillEnabledAtPageLoad(false)).Times(1);
1133 1138
1134 autofill_manager_->set_autofill_enabled(false); 1139 autofill_manager_->set_autofill_enabled(false);
1135 autofill_manager_->OnFormsSeen(std::vector<FormData>(), TimeTicks(), false); 1140 autofill_manager_->OnFormsSeen(std::vector<FormData>(), TimeTicks(),
1141 autofill::NO_SPECIAL_FORMS_SEEN);
1136 } 1142 }
1137 1143
1138 // Test that credit card infobar metrics are logged correctly. 1144 // Test that credit card infobar metrics are logged correctly.
1139 TEST_F(AutofillMetricsTest, CreditCardInfoBar) { 1145 TEST_F(AutofillMetricsTest, CreditCardInfoBar) {
1140 testing::NiceMock<MockAutofillMetrics> metric_logger; 1146 testing::NiceMock<MockAutofillMetrics> metric_logger;
1141 ::testing::InSequence dummy; 1147 ::testing::InSequence dummy;
1142 1148
1143 // Accept the infobar. 1149 // Accept the infobar.
1144 { 1150 {
1145 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger)); 1151 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger));
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 form.fields.push_back(field); 1244 form.fields.push_back(field);
1239 autofill_test::CreateTestFormField("Email", "email", "", "text", &field); 1245 autofill_test::CreateTestFormField("Email", "email", "", "text", &field);
1240 form.fields.push_back(field); 1246 form.fields.push_back(field);
1241 1247
1242 std::vector<FormData> forms(1, form); 1248 std::vector<FormData> forms(1, form);
1243 1249
1244 // Expect no notifications when the form is first seen. 1250 // Expect no notifications when the form is first seen.
1245 { 1251 {
1246 EXPECT_CALL(*autofill_manager_->metric_logger(), 1252 EXPECT_CALL(*autofill_manager_->metric_logger(),
1247 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED)).Times(0); 1253 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED)).Times(0);
1248 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 1254 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
1255 autofill::NO_SPECIAL_FORMS_SEEN);
1249 } 1256 }
1250 1257
1251 1258
1252 // Expect no notifications when the form is submitted. 1259 // Expect no notifications when the form is submitted.
1253 { 1260 {
1254 EXPECT_CALL( 1261 EXPECT_CALL(
1255 *autofill_manager_->metric_logger(), 1262 *autofill_manager_->metric_logger(),
1256 LogUserHappinessMetric( 1263 LogUserHappinessMetric(
1257 AutofillMetrics::SUBMITTED_FILLABLE_FORM_AUTOFILLED_ALL)).Times(0); 1264 AutofillMetrics::SUBMITTED_FILLABLE_FORM_AUTOFILLED_ALL)).Times(0);
1258 EXPECT_CALL( 1265 EXPECT_CALL(
(...skipping 15 matching lines...) Expand all
1274 autofill_test::CreateTestFormField("Phone", "phone", "", "text", &field); 1281 autofill_test::CreateTestFormField("Phone", "phone", "", "text", &field);
1275 form.fields.push_back(field); 1282 form.fields.push_back(field);
1276 autofill_test::CreateTestFormField("Unknown", "unknown", "", "text", &field); 1283 autofill_test::CreateTestFormField("Unknown", "unknown", "", "text", &field);
1277 form.fields.push_back(field); 1284 form.fields.push_back(field);
1278 forms.front() = form; 1285 forms.front() = form;
1279 1286
1280 // Expect a notification when the form is first seen. 1287 // Expect a notification when the form is first seen.
1281 { 1288 {
1282 EXPECT_CALL(*autofill_manager_->metric_logger(), 1289 EXPECT_CALL(*autofill_manager_->metric_logger(),
1283 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED)); 1290 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED));
1284 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 1291 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
1292 autofill::NO_SPECIAL_FORMS_SEEN);
1285 } 1293 }
1286 1294
1287 // Expect a notification when the form is submitted. 1295 // Expect a notification when the form is submitted.
1288 { 1296 {
1289 EXPECT_CALL(*autofill_manager_->metric_logger(), 1297 EXPECT_CALL(*autofill_manager_->metric_logger(),
1290 LogUserHappinessMetric( 1298 LogUserHappinessMetric(
1291 AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM)); 1299 AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM));
1292 autofill_manager_->FormSubmitted(form, TimeTicks::Now()); 1300 autofill_manager_->FormSubmitted(form, TimeTicks::Now());
1293 } 1301 }
1294 1302
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 form.fields.push_back(field); 1382 form.fields.push_back(field);
1375 autofill_test::CreateTestFormField("Phone", "phone", "", "text", &field); 1383 autofill_test::CreateTestFormField("Phone", "phone", "", "text", &field);
1376 form.fields.push_back(field); 1384 form.fields.push_back(field);
1377 1385
1378 std::vector<FormData> forms(1, form); 1386 std::vector<FormData> forms(1, form);
1379 1387
1380 // Expect a notification when the form is first seen. 1388 // Expect a notification when the form is first seen.
1381 { 1389 {
1382 EXPECT_CALL(*autofill_manager_->metric_logger(), 1390 EXPECT_CALL(*autofill_manager_->metric_logger(),
1383 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED)); 1391 LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED));
1384 autofill_manager_->OnFormsSeen(forms, TimeTicks(), false); 1392 autofill_manager_->OnFormsSeen(forms, TimeTicks(),
1393 autofill::NO_SPECIAL_FORMS_SEEN);
1385 } 1394 }
1386 1395
1387 // Simulate typing. 1396 // Simulate typing.
1388 { 1397 {
1389 EXPECT_CALL(*autofill_manager_->metric_logger(), 1398 EXPECT_CALL(*autofill_manager_->metric_logger(),
1390 LogUserHappinessMetric(AutofillMetrics::USER_DID_TYPE)); 1399 LogUserHappinessMetric(AutofillMetrics::USER_DID_TYPE));
1391 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1400 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1392 TimeTicks()); 1401 TimeTicks());
1393 } 1402 }
1394 1403
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 EXPECT_CALL(*autofill_manager_->metric_logger(), 1503 EXPECT_CALL(*autofill_manager_->metric_logger(),
1495 LogFormFillDurationFromLoadWithAutofill(_)).Times(0); 1504 LogFormFillDurationFromLoadWithAutofill(_)).Times(0);
1496 EXPECT_CALL(*autofill_manager_->metric_logger(), 1505 EXPECT_CALL(*autofill_manager_->metric_logger(),
1497 LogFormFillDurationFromLoadWithoutAutofill( 1506 LogFormFillDurationFromLoadWithoutAutofill(
1498 TimeDelta::FromInternalValue(16))); 1507 TimeDelta::FromInternalValue(16)));
1499 EXPECT_CALL(*autofill_manager_->metric_logger(), 1508 EXPECT_CALL(*autofill_manager_->metric_logger(),
1500 LogFormFillDurationFromInteractionWithAutofill(_)).Times(0); 1509 LogFormFillDurationFromInteractionWithAutofill(_)).Times(0);
1501 EXPECT_CALL(*autofill_manager_->metric_logger(), 1510 EXPECT_CALL(*autofill_manager_->metric_logger(),
1502 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0); 1511 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0);
1503 autofill_manager_->OnFormsSeen( 1512 autofill_manager_->OnFormsSeen(
1504 forms, TimeTicks::FromInternalValue(1), false); 1513 forms, TimeTicks::FromInternalValue(1),
1514 autofill::NO_SPECIAL_FORMS_SEEN);
1505 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1515 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1506 autofill_manager_->Reset(); 1516 autofill_manager_->Reset();
1507 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1517 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1508 } 1518 }
1509 1519
1510 // Expect metric to be logged if the user manually edited a form field. 1520 // Expect metric to be logged if the user manually edited a form field.
1511 { 1521 {
1512 EXPECT_CALL(*autofill_manager_->metric_logger(), 1522 EXPECT_CALL(*autofill_manager_->metric_logger(),
1513 LogFormFillDurationFromLoadWithAutofill(_)).Times(0); 1523 LogFormFillDurationFromLoadWithAutofill(_)).Times(0);
1514 EXPECT_CALL(*autofill_manager_->metric_logger(), 1524 EXPECT_CALL(*autofill_manager_->metric_logger(),
1515 LogFormFillDurationFromLoadWithoutAutofill( 1525 LogFormFillDurationFromLoadWithoutAutofill(
1516 TimeDelta::FromInternalValue(16))); 1526 TimeDelta::FromInternalValue(16)));
1517 EXPECT_CALL(*autofill_manager_->metric_logger(), 1527 EXPECT_CALL(*autofill_manager_->metric_logger(),
1518 LogFormFillDurationFromInteractionWithAutofill(_)).Times(0); 1528 LogFormFillDurationFromInteractionWithAutofill(_)).Times(0);
1519 EXPECT_CALL(*autofill_manager_->metric_logger(), 1529 EXPECT_CALL(*autofill_manager_->metric_logger(),
1520 LogFormFillDurationFromInteractionWithoutAutofill( 1530 LogFormFillDurationFromInteractionWithoutAutofill(
1521 TimeDelta::FromInternalValue(14))); 1531 TimeDelta::FromInternalValue(14)));
1522 autofill_manager_->OnFormsSeen( 1532 autofill_manager_->OnFormsSeen(
1523 forms, TimeTicks::FromInternalValue(1), false); 1533 forms, TimeTicks::FromInternalValue(1),
1534 autofill::NO_SPECIAL_FORMS_SEEN);
1524 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1535 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1525 TimeTicks::FromInternalValue(3)); 1536 TimeTicks::FromInternalValue(3));
1526 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1537 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1527 autofill_manager_->Reset(); 1538 autofill_manager_->Reset();
1528 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1539 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1529 } 1540 }
1530 1541
1531 // Expect metric to be logged if the user autofilled the form. 1542 // Expect metric to be logged if the user autofilled the form.
1532 form.fields[0].is_autofilled = true; 1543 form.fields[0].is_autofilled = true;
1533 { 1544 {
1534 EXPECT_CALL(*autofill_manager_->metric_logger(), 1545 EXPECT_CALL(*autofill_manager_->metric_logger(),
1535 LogFormFillDurationFromLoadWithAutofill( 1546 LogFormFillDurationFromLoadWithAutofill(
1536 TimeDelta::FromInternalValue(16))); 1547 TimeDelta::FromInternalValue(16)));
1537 EXPECT_CALL(*autofill_manager_->metric_logger(), 1548 EXPECT_CALL(*autofill_manager_->metric_logger(),
1538 LogFormFillDurationFromLoadWithoutAutofill(_)).Times(0); 1549 LogFormFillDurationFromLoadWithoutAutofill(_)).Times(0);
1539 EXPECT_CALL(*autofill_manager_->metric_logger(), 1550 EXPECT_CALL(*autofill_manager_->metric_logger(),
1540 LogFormFillDurationFromInteractionWithAutofill( 1551 LogFormFillDurationFromInteractionWithAutofill(
1541 TimeDelta::FromInternalValue(12))); 1552 TimeDelta::FromInternalValue(12)));
1542 EXPECT_CALL(*autofill_manager_->metric_logger(), 1553 EXPECT_CALL(*autofill_manager_->metric_logger(),
1543 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0); 1554 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0);
1544 autofill_manager_->OnFormsSeen( 1555 autofill_manager_->OnFormsSeen(
1545 forms, TimeTicks::FromInternalValue(1), false); 1556 forms, TimeTicks::FromInternalValue(1),
1557 autofill::NO_SPECIAL_FORMS_SEEN);
1546 autofill_manager_->OnDidFillAutofillFormData( 1558 autofill_manager_->OnDidFillAutofillFormData(
1547 TimeTicks::FromInternalValue(5)); 1559 TimeTicks::FromInternalValue(5));
1548 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1560 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1549 autofill_manager_->Reset(); 1561 autofill_manager_->Reset();
1550 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1562 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1551 } 1563 }
1552 1564
1553 // Expect metric to be logged if the user both manually filled some fields 1565 // Expect metric to be logged if the user both manually filled some fields
1554 // and autofilled others. Messages can arrive out of order, so make sure they 1566 // and autofilled others. Messages can arrive out of order, so make sure they
1555 // take precedence appropriately. 1567 // take precedence appropriately.
1556 { 1568 {
1557 EXPECT_CALL(*autofill_manager_->metric_logger(), 1569 EXPECT_CALL(*autofill_manager_->metric_logger(),
1558 LogFormFillDurationFromLoadWithAutofill( 1570 LogFormFillDurationFromLoadWithAutofill(
1559 TimeDelta::FromInternalValue(16))); 1571 TimeDelta::FromInternalValue(16)));
1560 EXPECT_CALL(*autofill_manager_->metric_logger(), 1572 EXPECT_CALL(*autofill_manager_->metric_logger(),
1561 LogFormFillDurationFromLoadWithoutAutofill(_)).Times(0); 1573 LogFormFillDurationFromLoadWithoutAutofill(_)).Times(0);
1562 EXPECT_CALL(*autofill_manager_->metric_logger(), 1574 EXPECT_CALL(*autofill_manager_->metric_logger(),
1563 LogFormFillDurationFromInteractionWithAutofill( 1575 LogFormFillDurationFromInteractionWithAutofill(
1564 TimeDelta::FromInternalValue(14))); 1576 TimeDelta::FromInternalValue(14)));
1565 EXPECT_CALL(*autofill_manager_->metric_logger(), 1577 EXPECT_CALL(*autofill_manager_->metric_logger(),
1566 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0); 1578 LogFormFillDurationFromInteractionWithoutAutofill(_)).Times(0);
1567 autofill_manager_->OnFormsSeen( 1579 autofill_manager_->OnFormsSeen(
1568 forms, TimeTicks::FromInternalValue(1), false); 1580 forms, TimeTicks::FromInternalValue(1),
1581 autofill::NO_SPECIAL_FORMS_SEEN);
1569 autofill_manager_->OnDidFillAutofillFormData( 1582 autofill_manager_->OnDidFillAutofillFormData(
1570 TimeTicks::FromInternalValue(5)); 1583 TimeTicks::FromInternalValue(5));
1571 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1584 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1572 TimeTicks::FromInternalValue(3)); 1585 TimeTicks::FromInternalValue(3));
1573 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1586 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1574 autofill_manager_->Reset(); 1587 autofill_manager_->Reset();
1575 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1588 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1576 } 1589 }
1577 } 1590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698