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

Side by Side Diff: chrome/browser/prefs/pref_notifier_impl_unittest.cc

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. Created 7 years, 12 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 | « chrome/browser/prefs/pref_model_associator.cc ('k') | chrome/browser/prefs/pref_service.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/callback.h" 6 #include "base/callback.h"
7 #include "base/prefs/pref_observer.h" 7 #include "base/prefs/pref_observer.h"
8 #include "chrome/browser/prefs/mock_pref_change_callback.h" 8 #include "chrome/browser/prefs/mock_pref_change_callback.h"
9 #include "chrome/browser/prefs/pref_notifier_impl.h" 9 #include "chrome/browser/prefs/pref_notifier_impl.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 EXPECT_CALL(*this, OnPreferenceChanged(prefs, pref_name)) 87 EXPECT_CALL(*this, OnPreferenceChanged(prefs, pref_name))
88 .With(PrefValueMatches(prefs, pref_name, value)); 88 .With(PrefValueMatches(prefs, pref_name, value));
89 } 89 }
90 }; 90 };
91 91
92 // Test fixture class. 92 // Test fixture class.
93 class PrefNotifierTest : public testing::Test { 93 class PrefNotifierTest : public testing::Test {
94 protected: 94 protected:
95 virtual void SetUp() { 95 virtual void SetUp() {
96 pref_service_.RegisterBooleanPref(kChangedPref, 96 pref_service_.RegisterBooleanPref(kChangedPref,
97 true, 97 true);
98 PrefService::UNSYNCABLE_PREF);
99 pref_service_.RegisterBooleanPref(kUnchangedPref, 98 pref_service_.RegisterBooleanPref(kUnchangedPref,
100 true, 99 true);
101 PrefService::UNSYNCABLE_PREF);
102 } 100 }
103 101
104 TestingPrefService pref_service_; 102 TestingPrefServiceSimple pref_service_;
105 103
106 PrefObserverMock obs1_; 104 PrefObserverMock obs1_;
107 PrefObserverMock obs2_; 105 PrefObserverMock obs2_;
108 }; 106 };
109 107
110 TEST_F(PrefNotifierTest, OnPreferenceChanged) { 108 TEST_F(PrefNotifierTest, OnPreferenceChanged) {
111 MockPrefNotifier notifier(&pref_service_); 109 MockPrefNotifier notifier(&pref_service_);
112 EXPECT_CALL(notifier, FireObservers(kChangedPref)).Times(1); 110 EXPECT_CALL(notifier, FireObservers(kChangedPref)).Times(1);
113 notifier.OnPreferenceChanged(kChangedPref); 111 notifier.OnPreferenceChanged(kChangedPref);
114 } 112 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 EXPECT_CALL(obs2_, OnPreferenceChanged(&pref_service_, kChangedPref)); 220 EXPECT_CALL(obs2_, OnPreferenceChanged(&pref_service_, kChangedPref));
223 notifier.OnPreferenceChanged(kChangedPref); 221 notifier.OnPreferenceChanged(kChangedPref);
224 Mock::VerifyAndClearExpectations(&obs1_); 222 Mock::VerifyAndClearExpectations(&obs1_);
225 Mock::VerifyAndClearExpectations(&obs2_); 223 Mock::VerifyAndClearExpectations(&obs2_);
226 224
227 notifier.RemovePrefObserver(kChangedPref, &obs2_); 225 notifier.RemovePrefObserver(kChangedPref, &obs2_);
228 notifier.RemovePrefObserver(kUnchangedPref, &obs2_); 226 notifier.RemovePrefObserver(kUnchangedPref, &obs2_);
229 } 227 }
230 228
231 } // namespace 229 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_model_associator.cc ('k') | chrome/browser/prefs/pref_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698