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

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

Powered by Google App Engine
This is Rietveld 408576698