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

Side by Side Diff: chrome/test/base/testing_pref_service.h

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
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 #ifndef CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_ 5 #ifndef CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_
6 #define CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_ 6 #define CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/prefs/testing_pref_store.h" 9 #include "base/prefs/testing_pref_store.h"
10 #include "chrome/browser/prefs/pref_registrar_simple.h"
10 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
11 12
12 class DefaultPrefStore; 13 class DefaultPrefStore;
13 class PrefModelAssociator; 14 class PrefModelAssociator;
14 class PrefNotifierImpl; 15 class PrefNotifierImpl;
15 class TestingBrowserProcess; 16 class TestingBrowserProcess;
16 class TestingPrefStore; 17 class TestingPrefStore;
17 18
18 // A PrefService subclass for testing. It operates totally in memory and 19 // A PrefService subclass for testing. It operates totally in memory and
19 // provides additional API for manipulating preferences at the different levels 20 // provides additional API for manipulating preferences at the different levels
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void RemovePref(TestingPrefStore* pref_store, const char* path); 69 void RemovePref(TestingPrefStore* pref_store, const char* path);
69 70
70 // Pointers to the pref stores our value store uses. 71 // Pointers to the pref stores our value store uses.
71 scoped_refptr<TestingPrefStore> managed_prefs_; 72 scoped_refptr<TestingPrefStore> managed_prefs_;
72 scoped_refptr<TestingPrefStore> user_prefs_; 73 scoped_refptr<TestingPrefStore> user_prefs_;
73 scoped_refptr<TestingPrefStore> recommended_prefs_; 74 scoped_refptr<TestingPrefStore> recommended_prefs_;
74 75
75 DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceBase); 76 DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceBase);
76 }; 77 };
77 78
78 // Test version of PrefServiceSimple. 79 // Test version of PrefService.
79 class TestingPrefServiceSimple 80 class TestingPrefServiceSimple
80 : public TestingPrefServiceBase<PrefServiceSimple> { 81 : public TestingPrefServiceBase<PrefService> {
81 public: 82 public:
82 TestingPrefServiceSimple(); 83 TestingPrefServiceSimple();
83 virtual ~TestingPrefServiceSimple(); 84 virtual ~TestingPrefServiceSimple();
84 85
86 PrefRegistrarSimple* registrar() { return &registrar_; }
87
85 private: 88 private:
89 PrefRegistrarSimple registrar_;
90
86 DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceSimple); 91 DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceSimple);
87 }; 92 };
88 93
89 // Test version of PrefServiceSyncable. 94 // Test version of PrefServiceSyncable.
90 class TestingPrefServiceSyncable 95 class TestingPrefServiceSyncable
91 : public TestingPrefServiceBase<PrefServiceSyncable> { 96 : public TestingPrefServiceBase<PrefServiceSyncable> {
92 public: 97 public:
93 TestingPrefServiceSyncable(); 98 TestingPrefServiceSyncable();
94 virtual ~TestingPrefServiceSyncable(); 99 virtual ~TestingPrefServiceSyncable();
95 100
(...skipping 13 matching lines...) Expand all
109 } 114 }
110 115
111 private: 116 private:
112 TestingBrowserProcess* browser_process_; 117 TestingBrowserProcess* browser_process_;
113 TestingPrefServiceSimple local_state_; 118 TestingPrefServiceSimple local_state_;
114 119
115 DISALLOW_COPY_AND_ASSIGN(ScopedTestingLocalState); 120 DISALLOW_COPY_AND_ASSIGN(ScopedTestingLocalState);
116 }; 121 };
117 122
118 template<> 123 template<>
119 TestingPrefServiceBase<PrefServiceSimple>::TestingPrefServiceBase( 124 TestingPrefServiceBase<PrefService>::TestingPrefServiceBase(
120 TestingPrefStore* managed_prefs, 125 TestingPrefStore* managed_prefs,
121 TestingPrefStore* user_prefs, 126 TestingPrefStore* user_prefs,
122 TestingPrefStore* recommended_prefs, 127 TestingPrefStore* recommended_prefs,
123 DefaultPrefStore* default_store, 128 DefaultPrefStore* default_store,
124 PrefNotifierImpl* pref_notifier); 129 PrefNotifierImpl* pref_notifier);
125 130
126 template<> 131 template<>
127 TestingPrefServiceBase<PrefServiceSyncable>::TestingPrefServiceBase( 132 TestingPrefServiceBase<PrefServiceSyncable>::TestingPrefServiceBase(
128 TestingPrefStore* managed_prefs, 133 TestingPrefStore* managed_prefs,
129 TestingPrefStore* user_prefs, 134 TestingPrefStore* user_prefs,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 pref_store->SetValue(path, value); 207 pref_store->SetValue(path, value);
203 } 208 }
204 209
205 template<class SuperPrefService> 210 template<class SuperPrefService>
206 void TestingPrefServiceBase<SuperPrefService>::RemovePref( 211 void TestingPrefServiceBase<SuperPrefService>::RemovePref(
207 TestingPrefStore* pref_store, const char* path) { 212 TestingPrefStore* pref_store, const char* path) {
208 pref_store->RemoveValue(path); 213 pref_store->RemoveValue(path);
209 } 214 }
210 215
211 #endif // CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_ 216 #endif // CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698