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

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

Issue 3051001: Adjust preference sync code to only sync user modifiable preferences. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: separate out the download_manager_unittest.cc fixes Created 10 years, 5 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
« no previous file with comments | « chrome/test/data/profiles/chrome_prefs/Preferences ('k') | chrome/test/testing_pref_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_TEST_TESTING_PREF_SERVICE_H_
6 #define CHROME_TEST_TESTING_PREF_SERVICE_H_
7
8 #include <chrome/browser/pref_service.h>
9
10 // A PrefService subclass for testing. It operates totally in memory and
11 // provides additional API for manipulating preferences at the different levels
12 // (managed, extension, user) conveniently.
13 class TestingPrefService : public PrefService {
14 public:
15 // Create an empty instance.
16 TestingPrefService();
17
18 // Read the value of a preference from the managed layer. Returns NULL if the
19 // preference is not defined at the managed layer.
20 const Value* GetManagedPref(const wchar_t* path);
21
22 // Set a preference on the managed layer and fire observers if the preference
23 // changed. Assumes ownership of |value|.
24 void SetManagedPref(const wchar_t* path, Value* value);
25
26 // Clear the preference on the managed layer and fire observers if the
27 // preference has been defined previously.
28 void RemoveManagedPref(const wchar_t* path);
29
30 // Similar to the above, but for user preferences.
31 const Value* GetUserPref(const wchar_t* path);
32 void SetUserPref(const wchar_t* path, Value* value);
33 void RemoveUserPref(const wchar_t* path);
34
35 private:
36 // Reads the value of the preference indicated by |path| from |pref_store|.
37 // Returns NULL if the preference was not found.
38 const Value* GetPref(PrefStore* pref_store, const wchar_t* path);
39
40 // Sets the value for |path| in |pref_store|.
41 void SetPref(PrefStore* pref_store, const wchar_t* path, Value* value);
42
43 // Removes the preference identified by |path| from |pref_store|.
44 void RemovePref(PrefStore* pref_store, const wchar_t* path);
45
46 // Pointers to the pref stores our value store uses.
47 PrefStore* managed_prefs_;
48 PrefStore* user_prefs_;
49 };
50
51 #endif // CHROME_TEST_TESTING_PREF_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/test/data/profiles/chrome_prefs/Preferences ('k') | chrome/test/testing_pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698