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

Unified Diff: chrome/test/testing_pref_service.h

Issue 5646003: Sanitize PrefStore interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, fix up unit tests. Created 10 years 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
Index: chrome/test/testing_pref_service.h
diff --git a/chrome/test/testing_pref_service.h b/chrome/test/testing_pref_service.h
index c5adc0210fd375c23d3c6ac528bb2b0b58abe7a2..ffa82faa972bcdf00b35c2df4bcd45e0e1214337 100644
--- a/chrome/test/testing_pref_service.h
+++ b/chrome/test/testing_pref_service.h
@@ -8,11 +8,7 @@
#include "chrome/browser/prefs/pref_service.h"
-class CommandLine;
-namespace policy {
-class ConfigurationPolicyProvider;
-}
-class PrefStore;
+class TestingPrefStore;
// A PrefService subclass for testing. It operates totally in memory and
// provides additional API for manipulating preferences at the different levels
@@ -22,19 +18,6 @@ class TestingPrefService : public PrefService {
// Create an empty instance.
TestingPrefService();
- // Create an instance that has a managed PrefStore and a command- line
- // PrefStore. |managed_platform_provider| contains the provider with which to
- // initialize the managed platform PrefStore. If it is NULL, then a
- // TestingPrefStore will be created. |device_management_provider| contains the
- // provider with which to initialize the device management
- // PrefStore. |command_line| contains the provider with which to initialize
- // the command line PrefStore. If it is NULL then a TestingPrefStore will be
- // created as the command line PrefStore.
- TestingPrefService(
- policy::ConfigurationPolicyProvider* managed_platform_provider,
- policy::ConfigurationPolicyProvider* device_management_provider,
- CommandLine* command_line);
-
// 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 char* path);
@@ -47,48 +30,26 @@ class TestingPrefService : public PrefService {
// preference has been defined previously.
void RemoveManagedPref(const char* path);
- // Set a preference on the managed layer. Assumes ownership of |value|.
- // We don't fire observers for each change because in the real code, the
- // notification is sent after all the prefs have been loaded. See
- // ConfigurationPolicyPrefStore::ReadPrefs().
- void SetManagedPrefWithoutNotification(const char* path, Value* value);
-
- // Clear the preference on the managed layer.
- // We don't fire observers for each change because in the real code, the
- // notification is sent after all the prefs have been loaded. See
- // ConfigurationPolicyPrefStore::ReadPrefs().
- void RemoveManagedPrefWithoutNotification(const char* path);
-
// Similar to the above, but for user preferences.
const Value* GetUserPref(const char* path);
void SetUserPref(const char* path, Value* value);
void RemoveUserPref(const char* path);
private:
- // Creates a ConfigurationPolicyPrefStore based on the provided
- // |provider| or a TestingPrefStore if |provider| is NULL.
- PrefStore* CreatePolicyPrefStoreFromProvider(
- policy::ConfigurationPolicyProvider* provider);
-
- // Creates a CommandLinePrefStore based on the supplied
- // |command_line| or a TestingPrefStore if |command_line| is NULL.
- PrefStore* CreateCommandLinePrefStore(CommandLine* command_line);
-
// 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 char* path);
+ const Value* GetPref(TestingPrefStore* pref_store, const char* path);
battre (please use the other) 2010/12/08 12:24:15 Any reason why this has to be a TestingPrefStore i
battre (please use the other) 2010/12/08 12:24:15 const? maybe not because it is a Testing class
Mattias Nissler (ping if slow) 2010/12/09 10:20:20 Because we know it'll be a TestingPrefStore and fo
// Sets the value for |path| in |pref_store|.
- void SetPref(PrefStore* pref_store, const char* path, Value* value);
+ void SetPref(TestingPrefStore* pref_store, const char* path, Value* value);
battre (please use the other) 2010/12/08 12:24:15 Any reason why this has to be a TestingPrefStore i
Mattias Nissler (ping if slow) 2010/12/09 10:20:20 See the other comment.
// Removes the preference identified by |path| from |pref_store|.
- void RemovePref(PrefStore* pref_store, const char* path);
+ void RemovePref(TestingPrefStore* pref_store, const char* path);
// Pointers to the pref stores our value store uses.
- PrefStore* managed_platform_prefs_; // weak
- PrefStore* device_management_prefs_; // weak
- PrefStore* user_prefs_; // weak
- PrefStore* default_prefs_; // weak
+ TestingPrefStore* managed_platform_prefs_; // weak
+ TestingPrefStore* device_management_prefs_; // weak
+ TestingPrefStore* user_prefs_; // weak
DISALLOW_COPY_AND_ASSIGN(TestingPrefService);
};

Powered by Google App Engine
This is Rietveld 408576698