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..75b956c276940ce6a8a3bd457920bd04b93da7d8 100644 |
| --- a/chrome/test/testing_pref_service.h |
| +++ b/chrome/test/testing_pref_service.h |
| @@ -6,18 +6,40 @@ |
| #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; |
| +// Helper base class to allow simple construction of TestPrefService objects. |
| +class TestingPrefServiceBase : public PrefService { |
| + public: |
| + virtual ~TestingPrefServiceBase(); |
| + |
| + protected: |
| + TestingPrefServiceBase( |
| + TestingPrefStore* managed_platform_prefs, |
| + TestingPrefStore* device_management_prefs, |
| + ExtensionPrefStore* extension_prefs, |
| + TestingPrefStore* user_prefs); |
| + |
| + // Pointers to the pref stores our value store uses. |
| + scoped_refptr<TestingPrefStore> managed_platform_prefs_; |
| + scoped_refptr<TestingPrefStore> device_management_prefs_; |
| + scoped_refptr<ExtensionPrefStore> extension_prefs_; |
| + scoped_refptr<TestingPrefStore> user_prefs_; |
|
Mattias Nissler (ping if slow)
2010/12/22 12:09:03
Didn't we agree to just move all the interface int
battre
2010/12/22 18:34:53
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceBase); |
| +}; |
| + |
| // 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 { |
| +class TestingPrefService : public TestingPrefServiceBase { |
| public: |
| - // Create an empty instance. |
| TestingPrefService(); |
| - virtual ~TestingPrefService() {} |
| + virtual ~TestingPrefService(); |
| // Read the value of a preference from the managed layer. Returns NULL if the |
| // preference is not defined at the managed layer. |
| @@ -36,6 +58,8 @@ class TestingPrefService : public PrefService { |
| void SetUserPref(const char* path, Value* value); |
| void RemoveUserPref(const char* path); |
| + ExtensionPrefStore* GetExtensionPrefs(); |
|
Mattias Nissler (ping if slow)
2010/12/22 12:09:03
No! This class is meant for the case when you need
battre
2010/12/22 18:34:53
This method was introduced because the ExtensionPr
|
| + |
| private: |
| // Reads the value of the preference indicated by |path| from |pref_store|. |
| // Returns NULL if the preference was not found. |
| @@ -47,11 +71,6 @@ class TestingPrefService : public PrefService { |
| // Removes the preference identified by |path| from |pref_store|. |
| void RemovePref(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 |
| - |
| DISALLOW_COPY_AND_ASSIGN(TestingPrefService); |
| }; |