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

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

Issue 52713006: Parameterize the PrefService that PersonalDataManager uses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 EXPECT_CALL(*personal_data_->metric_logger(), 997 EXPECT_CALL(*personal_data_->metric_logger(),
998 LogStoredProfileCount(::testing::_)).Times(0); 998 LogStoredProfileCount(::testing::_)).Times(0);
999 personal_data_->LoadProfiles(); 999 personal_data_->LoadProfiles();
1000 } 1000 }
1001 1001
1002 // Test that we correctly log when Autofill is enabled. 1002 // Test that we correctly log when Autofill is enabled.
1003 TEST_F(AutofillMetricsTest, AutofillIsEnabledAtStartup) { 1003 TEST_F(AutofillMetricsTest, AutofillIsEnabledAtStartup) {
1004 personal_data_->set_autofill_enabled(true); 1004 personal_data_->set_autofill_enabled(true);
1005 EXPECT_CALL(*personal_data_->metric_logger(), 1005 EXPECT_CALL(*personal_data_->metric_logger(),
1006 LogIsAutofillEnabledAtStartup(true)).Times(1); 1006 LogIsAutofillEnabledAtStartup(true)).Times(1);
1007 personal_data_->Init(profile()); 1007 personal_data_->Init(profile(), profile()->GetPrefs());
1008 } 1008 }
1009 1009
1010 // Test that we correctly log when Autofill is disabled. 1010 // Test that we correctly log when Autofill is disabled.
1011 TEST_F(AutofillMetricsTest, AutofillIsDisabledAtStartup) { 1011 TEST_F(AutofillMetricsTest, AutofillIsDisabledAtStartup) {
1012 personal_data_->set_autofill_enabled(false); 1012 personal_data_->set_autofill_enabled(false);
1013 EXPECT_CALL(*personal_data_->metric_logger(), 1013 EXPECT_CALL(*personal_data_->metric_logger(),
1014 LogIsAutofillEnabledAtStartup(false)).Times(1); 1014 LogIsAutofillEnabledAtStartup(false)).Times(1);
1015 personal_data_->Init(profile()); 1015 personal_data_->Init(profile(), profile()->GetPrefs());
1016 } 1016 }
1017 1017
1018 // Test that we log the number of Autofill suggestions when filling a form. 1018 // Test that we log the number of Autofill suggestions when filling a form.
1019 TEST_F(AutofillMetricsTest, AddressSuggestionsCount) { 1019 TEST_F(AutofillMetricsTest, AddressSuggestionsCount) {
1020 // Set up our form data. 1020 // Set up our form data.
1021 FormData form; 1021 FormData form;
1022 form.name = ASCIIToUTF16("TestForm"); 1022 form.name = ASCIIToUTF16("TestForm");
1023 form.method = ASCIIToUTF16("POST"); 1023 form.method = ASCIIToUTF16("POST");
1024 form.origin = GURL("http://example.com/form.html"); 1024 form.origin = GURL("http://example.com/form.html");
1025 form.action = GURL("http://example.com/submit.html"); 1025 form.action = GURL("http://example.com/submit.html");
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 TimeTicks::FromInternalValue(5)); 1547 TimeTicks::FromInternalValue(5));
1548 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1548 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1549 TimeTicks::FromInternalValue(3)); 1549 TimeTicks::FromInternalValue(3));
1550 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1550 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1551 autofill_manager_->Reset(); 1551 autofill_manager_->Reset();
1552 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1552 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1553 } 1553 }
1554 } 1554 }
1555 1555
1556 } // namespace autofill 1556 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698