| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_TEST_TESTING_PREF_SERVICE_H_ | 5 #ifndef CHROME_TEST_TESTING_PREF_SERVICE_H_ |
| 6 #define CHROME_TEST_TESTING_PREF_SERVICE_H_ | 6 #define CHROME_TEST_TESTING_PREF_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 void RemoveManagedPref(const char* path); | 31 void RemoveManagedPref(const char* path); |
| 32 | 32 |
| 33 // Similar to the above, but for user preferences. | 33 // Similar to the above, but for user preferences. |
| 34 const Value* GetUserPref(const char* path) const; | 34 const Value* GetUserPref(const char* path) const; |
| 35 void SetUserPref(const char* path, Value* value); | 35 void SetUserPref(const char* path, Value* value); |
| 36 void RemoveUserPref(const char* path); | 36 void RemoveUserPref(const char* path); |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 TestingPrefServiceBase( | 39 TestingPrefServiceBase( |
| 40 TestingPrefStore* managed_platform_prefs, | 40 TestingPrefStore* managed_platform_prefs, |
| 41 TestingPrefStore* device_management_prefs, | |
| 42 TestingPrefStore* user_prefs); | 41 TestingPrefStore* user_prefs); |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 // Reads the value of the preference indicated by |path| from |pref_store|. | 44 // Reads the value of the preference indicated by |path| from |pref_store|. |
| 46 // Returns NULL if the preference was not found. | 45 // Returns NULL if the preference was not found. |
| 47 const Value* GetPref(TestingPrefStore* pref_store, const char* path) const; | 46 const Value* GetPref(TestingPrefStore* pref_store, const char* path) const; |
| 48 | 47 |
| 49 // Sets the value for |path| in |pref_store|. | 48 // Sets the value for |path| in |pref_store|. |
| 50 void SetPref(TestingPrefStore* pref_store, const char* path, Value* value); | 49 void SetPref(TestingPrefStore* pref_store, const char* path, Value* value); |
| 51 | 50 |
| 52 // Removes the preference identified by |path| from |pref_store|. | 51 // Removes the preference identified by |path| from |pref_store|. |
| 53 void RemovePref(TestingPrefStore* pref_store, const char* path); | 52 void RemovePref(TestingPrefStore* pref_store, const char* path); |
| 54 | 53 |
| 55 // Pointers to the pref stores our value store uses. | 54 // Pointers to the pref stores our value store uses. |
| 56 scoped_refptr<TestingPrefStore> managed_platform_prefs_; | 55 scoped_refptr<TestingPrefStore> managed_platform_prefs_; |
| 57 scoped_refptr<TestingPrefStore> device_management_prefs_; | |
| 58 scoped_refptr<TestingPrefStore> user_prefs_; | 56 scoped_refptr<TestingPrefStore> user_prefs_; |
| 59 | 57 |
| 60 DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceBase); | 58 DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceBase); |
| 61 }; | 59 }; |
| 62 | 60 |
| 63 // Class for simplified construction of TestPrefServiceBase objects. | 61 // Class for simplified construction of TestPrefServiceBase objects. |
| 64 class TestingPrefService : public TestingPrefServiceBase { | 62 class TestingPrefService : public TestingPrefServiceBase { |
| 65 public: | 63 public: |
| 66 TestingPrefService(); | 64 TestingPrefService(); |
| 67 virtual ~TestingPrefService(); | 65 virtual ~TestingPrefService(); |
| 68 | 66 |
| 69 private: | 67 private: |
| 70 DISALLOW_COPY_AND_ASSIGN(TestingPrefService); | 68 DISALLOW_COPY_AND_ASSIGN(TestingPrefService); |
| 71 }; | 69 }; |
| 72 | 70 |
| 73 #endif // CHROME_TEST_TESTING_PREF_SERVICE_H_ | 71 #endif // CHROME_TEST_TESTING_PREF_SERVICE_H_ |
| OLD | NEW |