Chromium Code Reviews| Index: chrome/test/testing_pref_service.h |
| diff --git a/chrome/test/testing_pref_service.h b/chrome/test/testing_pref_service.h |
| index 25349b63251b810dbd43f2a34fe010fc4dd96f31..25dee85aaf15cf4ff4d0d4d50cdf915b408bdda4 100644 |
| --- a/chrome/test/testing_pref_service.h |
| +++ b/chrome/test/testing_pref_service.h |
| @@ -6,8 +6,10 @@ |
| #define CHROME_TEST_TESTING_PREF_SERVICE_H_ |
| #pragma once |
| +#include "base/ref_counted.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| +class ExtensionPrefStore; |
| class TestingPrefStore; |
| // A PrefService subclass for testing. It operates totally in memory and |
| @@ -15,9 +17,10 @@ class TestingPrefStore; |
| // (managed, extension, user) conveniently. |
| class TestingPrefService : public PrefService { |
| public: |
| + virtual ~TestingPrefService(); |
| + |
| // Create an empty instance. |
| - TestingPrefService(); |
| - virtual ~TestingPrefService() {} |
| + static TestingPrefService* CreateTestingPrefService(); |
|
Mattias Nissler (ping if slow)
2010/12/20 14:50:02
Introducing a factory function here makes it harde
battre
2010/12/21 18:51:59
Done.
|
| // Read the value of a preference from the managed layer. Returns NULL if the |
| // preference is not defined at the managed layer. |
| @@ -36,21 +39,32 @@ class TestingPrefService : public PrefService { |
| void SetUserPref(const char* path, Value* value); |
| void RemoveUserPref(const char* path); |
| + scoped_refptr<ExtensionPrefStore> GetExtensionPrefs(); |
| + protected: |
| + TestingPrefService( |
| + scoped_refptr<TestingPrefStore> managed_platform_prefs, |
| + scoped_refptr<TestingPrefStore> device_management_prefs, |
| + scoped_refptr<ExtensionPrefStore> extension_prefs, |
| + scoped_refptr<TestingPrefStore> user_prefs); |
| + |
| private: |
| // Reads the value of the preference indicated by |path| from |pref_store|. |
| // Returns NULL if the preference was not found. |
| - const Value* GetPref(TestingPrefStore* pref_store, const char* path) const; |
| + const Value* GetPref(scoped_refptr<TestingPrefStore> pref_store, |
| + const char* path) const; |
| // Sets the value for |path| in |pref_store|. |
| - void SetPref(TestingPrefStore* pref_store, const char* path, Value* value); |
| + void SetPref(scoped_refptr<TestingPrefStore> pref_store, |
| + const char* path, Value* value); |
| // Removes the preference identified by |path| from |pref_store|. |
| - void RemovePref(TestingPrefStore* pref_store, const char* path); |
| + void RemovePref(scoped_refptr<TestingPrefStore> pref_store, const char* path); |
| // Pointers to the pref stores our value store uses. |
| - TestingPrefStore* managed_platform_prefs_; // weak |
| - TestingPrefStore* device_management_prefs_; // weak |
| - TestingPrefStore* user_prefs_; // weak |
| + scoped_refptr<TestingPrefStore> managed_platform_prefs_; |
| + scoped_refptr<TestingPrefStore> device_management_prefs_; |
| + scoped_refptr<ExtensionPrefStore> extension_prefs_; |
| + scoped_refptr<TestingPrefStore> user_prefs_; |
| DISALLOW_COPY_AND_ASSIGN(TestingPrefService); |
| }; |