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

Side by Side Diff: chrome/test/testing_pref_service.cc

Issue 3323022: Create a DefaultPrefStore to hold registered application-default preference v... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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) 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 "chrome/test/testing_pref_service.h" 5 #include "chrome/test/testing_pref_service.h"
6 6
7 #include "chrome/browser/prefs/dummy_pref_store.h" 7 #include "chrome/browser/prefs/dummy_pref_store.h"
8 #include "chrome/browser/prefs/pref_value_store.h" 8 #include "chrome/browser/prefs/pref_value_store.h"
9 9
10 TestingPrefService::TestingPrefValueStore::TestingPrefValueStore( 10 TestingPrefService::TestingPrefValueStore::TestingPrefValueStore(
11 PrefStore* managed_prefs, 11 PrefStore* managed_prefs,
12 PrefStore* extension_prefs, 12 PrefStore* extension_prefs,
13 PrefStore* command_line_prefs, 13 PrefStore* command_line_prefs,
14 PrefStore* user_prefs, 14 PrefStore* user_prefs,
15 PrefStore* recommended_prefs) 15 PrefStore* recommended_prefs,
16 PrefStore* default_prefs)
16 : PrefValueStore(managed_prefs, extension_prefs, command_line_prefs, 17 : PrefValueStore(managed_prefs, extension_prefs, command_line_prefs,
17 user_prefs, recommended_prefs) { 18 user_prefs, recommended_prefs, default_prefs) {
18 } 19 }
19 20
20 // TODO(pamg): Instantiate no PrefStores by default. Allow callers to specify 21 // TODO(pamg): Instantiate no PrefStores by default. Allow callers to specify
21 // which they want, and expand usage of this class to more unit tests. 22 // which they want, and expand usage of this class to more unit tests.
22 TestingPrefService::TestingPrefService() 23 TestingPrefService::TestingPrefService()
23 : PrefService(new TestingPrefValueStore( 24 : PrefService(new TestingPrefValueStore(
24 managed_prefs_ = new DummyPrefStore(), 25 managed_prefs_ = new DummyPrefStore(),
25 NULL, 26 NULL,
26 NULL, 27 NULL,
27 user_prefs_ = new DummyPrefStore(), 28 user_prefs_ = new DummyPrefStore(),
28 NULL)) { 29 NULL,
30 default_prefs_ = new DummyPrefStore())) {
29 } 31 }
30 32
31 const Value* TestingPrefService::GetManagedPref(const char* path) { 33 const Value* TestingPrefService::GetManagedPref(const char* path) {
32 return GetPref(managed_prefs_, path); 34 return GetPref(managed_prefs_, path);
33 } 35 }
34 36
35 void TestingPrefService::SetManagedPref(const char* path, Value* value) { 37 void TestingPrefService::SetManagedPref(const char* path, Value* value) {
36 SetPref(managed_prefs_, path, value); 38 SetPref(managed_prefs_, path, value);
37 } 39 }
38 40
(...skipping 24 matching lines...) Expand all
63 Value* value) { 65 Value* value) {
64 pref_store->prefs()->Set(path, value); 66 pref_store->prefs()->Set(path, value);
65 pref_notifier()->FireObservers(path); 67 pref_notifier()->FireObservers(path);
66 } 68 }
67 69
68 void TestingPrefService::RemovePref(PrefStore* pref_store, 70 void TestingPrefService::RemovePref(PrefStore* pref_store,
69 const char* path) { 71 const char* path) {
70 pref_store->prefs()->Remove(path, NULL); 72 pref_store->prefs()->Remove(path, NULL);
71 pref_notifier()->FireObservers(path); 73 pref_notifier()->FireObservers(path);
72 } 74 }
OLDNEW
« chrome/browser/prefs/pref_value_store.cc ('K') | « chrome/test/testing_pref_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698