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

Unified 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: Response to review, fix unit tests 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_metrics_unittest.cc
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc
index c12b2ff5f544f4a2be25cb50fb28f861ca30b9aa..c9dec86e159dabb8714e734227b3311aa73514f3 100644
--- a/components/autofill/core/browser/autofill_metrics_unittest.cc
+++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -98,6 +98,10 @@ class TestPersonalDataManager : public PersonalDataManager {
set_browser_context(context);
}
+ void SetPrefService(PrefService* pref_service) {
+ set_pref_service(pref_service);
+ }
+
// Overridden to avoid a trip to the database. This should be a no-op except
// for the side-effect of logging the profile count.
virtual void LoadProfiles() OVERRIDE {
@@ -287,6 +291,7 @@ void AutofillMetricsTest::SetUp() {
personal_data_.reset(new TestPersonalDataManager());
personal_data_->SetBrowserContext(profile());
+ personal_data_->SetPrefService(profile()->GetPrefs());
autofill_driver_.reset(new TestAutofillDriver(web_contents()));
autofill_manager_.reset(new TestAutofillManager(
autofill_driver_.get(),
@@ -1004,7 +1009,7 @@ TEST_F(AutofillMetricsTest, AutofillIsEnabledAtStartup) {
personal_data_->set_autofill_enabled(true);
EXPECT_CALL(*personal_data_->metric_logger(),
LogIsAutofillEnabledAtStartup(true)).Times(1);
- personal_data_->Init(profile());
+ personal_data_->Init(profile(), profile()->GetPrefs());
}
// Test that we correctly log when Autofill is disabled.
@@ -1012,7 +1017,7 @@ TEST_F(AutofillMetricsTest, AutofillIsDisabledAtStartup) {
personal_data_->set_autofill_enabled(false);
EXPECT_CALL(*personal_data_->metric_logger(),
LogIsAutofillEnabledAtStartup(false)).Times(1);
- personal_data_->Init(profile());
+ personal_data_->Init(profile(), profile()->GetPrefs());
}
// Test that we log the number of Autofill suggestions when filling a form.

Powered by Google App Engine
This is Rietveld 408576698