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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/testing_pref_service.h
diff --git a/chrome/test/testing_pref_service.h b/chrome/test/testing_pref_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..8155a846da9ae7b0511e068b9c17b63080ffe9cb
--- /dev/null
+++ b/chrome/test/testing_pref_service.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_TEST_TESTING_PREF_SERVICE_H_
+#define CHROME_TEST_TESTING_PREF_SERVICE_H_
+
+#include <chrome/browser/pref_service.h>
+
+// A PrefService subclass for testing. It operates totally in memory and
+// provides additional API for manipulating preferences at the different levels
+// (managed, extension, user) conveniently.
+class TestingPrefService : public PrefService {
+ public:
+ // Create an empty instance.
+ TestingPrefService();
+
+ // Read the value of a preference from the managed layer. Returns NULL if the
+ // preference is not defined at the managed layer.
+ const Value* GetManagedPref(const wchar_t* path);
+
+ // Set a preference on the managed layer and fire observers if the preference
+ // changed. Assumes ownership of |value|.
+ void SetManagedPref(const wchar_t* path, Value* value);
+
+ // Clear the preference on the managed layer and fire observers if the
+ // preference has been defined previously.
+ void RemoveManagedPref(const wchar_t* path);
+
+ // Similar to the above, but for user preferences.
+ const Value* GetUserPref(const wchar_t* path);
+ void SetUserPref(const wchar_t* path, Value* value);
+ void RemoveUserPref(const wchar_t* path);
+
+ private:
+ // Reads the value of the preference indicated by |path| from |pref_store|.
+ // Returns NULL if the preference was not found.
+ const Value* GetPref(PrefStore* pref_store, const wchar_t* path);
+
+ // Sets the value for |path| in |pref_store|.
+ void SetPref(PrefStore* pref_store, const wchar_t* path, Value* value);
+
+ // Removes the preference identified by |path| from |pref_store|.
+ void RemovePref(PrefStore* pref_store, const wchar_t* path);
+
+ // Pointers to the pref stores our value store uses.
+ PrefStore* managed_prefs_;
+ PrefStore* user_prefs_;
+};
+
+#endif // CHROME_TEST_TESTING_PREF_SERVICE_H_
« 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