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

Side by Side Diff: base/prefs/public/pref_change_registrar_unittest.cc

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix double registration in Chrome Frame test. Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « base/prefs/default_pref_store.cc ('k') | base/prefs/public/pref_member_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/prefs/pref_observer.h" 7 #include "base/prefs/pref_observer.h"
8 #include "base/prefs/public/pref_change_registrar.h" 8 #include "base/prefs/public/pref_change_registrar.h"
9 #include "chrome/browser/prefs/pref_registry_simple.h"
9 #include "chrome/test/base/testing_pref_service.h" 10 #include "chrome/test/base/testing_pref_service.h"
10 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 using testing::Mock; 14 using testing::Mock;
14 using testing::Eq; 15 using testing::Eq;
15 16
16 namespace base { 17 namespace base {
17 namespace { 18 namespace {
18 19
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 122
122 // Explicitly check the expectations now to make sure that the RemoveAll 123 // Explicitly check the expectations now to make sure that the RemoveAll
123 // worked (rather than the registrar destructor doing the work). 124 // worked (rather than the registrar destructor doing the work).
124 Mock::VerifyAndClearExpectations(service()); 125 Mock::VerifyAndClearExpectations(service());
125 } 126 }
126 127
127 class ObserveSetOfPreferencesTest : public testing::Test { 128 class ObserveSetOfPreferencesTest : public testing::Test {
128 public: 129 public:
129 virtual void SetUp() { 130 virtual void SetUp() {
130 pref_service_.reset(new TestingPrefServiceSimple); 131 pref_service_.reset(new TestingPrefServiceSimple);
131 pref_service_->RegisterStringPref(kHomePage, "http://google.com"); 132 PrefRegistrySimple* registry = pref_service_->registry();
132 pref_service_->RegisterBooleanPref(kHomePageIsNewTabPage, false); 133 registry->RegisterStringPref(kHomePage, "http://google.com");
133 pref_service_->RegisterStringPref(kApplicationLocale, ""); 134 registry->RegisterBooleanPref(kHomePageIsNewTabPage, false);
135 registry->RegisterStringPref(kApplicationLocale, "");
134 } 136 }
135 137
136 PrefChangeRegistrar* CreatePrefChangeRegistrar() { 138 PrefChangeRegistrar* CreatePrefChangeRegistrar() {
137 PrefChangeRegistrar* pref_set = new PrefChangeRegistrar(); 139 PrefChangeRegistrar* pref_set = new PrefChangeRegistrar();
138 base::Closure callback = base::Bind(&base::DoNothing); 140 base::Closure callback = base::Bind(&base::DoNothing);
139 pref_set->Init(pref_service_.get()); 141 pref_set->Init(pref_service_.get());
140 pref_set->Add(kHomePage, callback); 142 pref_set->Add(kHomePage, callback);
141 pref_set->Add(kHomePageIsNewTabPage, callback); 143 pref_set->Add(kHomePageIsNewTabPage, callback);
142 return pref_set; 144 return pref_set;
143 } 145 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 pref_service_->SetUserPref(kHomePageIsNewTabPage, 191 pref_service_->SetUserPref(kHomePageIsNewTabPage,
190 new FundamentalValue(true)); 192 new FundamentalValue(true));
191 Mock::VerifyAndClearExpectations(this); 193 Mock::VerifyAndClearExpectations(this);
192 194
193 EXPECT_CALL(*this, OnPreferenceChanged(_)).Times(0); 195 EXPECT_CALL(*this, OnPreferenceChanged(_)).Times(0);
194 pref_service_->SetUserPref(kApplicationLocale, new StringValue("en_US.utf8")); 196 pref_service_->SetUserPref(kApplicationLocale, new StringValue("en_US.utf8"));
195 Mock::VerifyAndClearExpectations(this); 197 Mock::VerifyAndClearExpectations(this);
196 } 198 }
197 199
198 } // namespace base 200 } // namespace base
OLDNEW
« no previous file with comments | « base/prefs/default_pref_store.cc ('k') | base/prefs/public/pref_member_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698