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

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: Fix PrefService mock construction in PrefServiceTest to include command line store. 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
« no previous file with comments | « chrome/test/reliability/page_load_test.cc ('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
index c5adc0210fd375c23d3c6ac528bb2b0b58abe7a2..25349b63251b810dbd43f2a34fe010fc4dd96f31 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
@@ -21,23 +17,11 @@ class TestingPrefService : public PrefService {
public:
// 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);
+ virtual ~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 char* path);
+ const Value* GetManagedPref(const char* path) const;
// Set a preference on the managed layer and fire observers if the preference
// changed. Assumes ownership of |value|.
@@ -47,48 +31,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);
+ const Value* GetUserPref(const char* path) const;
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) const;
// 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);
// 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);
};
« no previous file with comments | « chrome/test/reliability/page_load_test.cc ('k') | chrome/test/testing_pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698