| 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_BASE_TESTING_PREF_SERVICE_H_ | 5 #ifndef CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_ |
| 6 #define CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_ | 6 #define CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 | 11 |
| 12 class DefaultPrefStore; |
| 13 class PrefModelAssociator; |
| 14 class PrefNotifierImpl; |
| 12 class TestingBrowserProcess; | 15 class TestingBrowserProcess; |
| 13 class TestingPrefStore; | 16 class TestingPrefStore; |
| 14 | 17 |
| 15 // A PrefService subclass for testing. It operates totally in memory and | 18 // A PrefService subclass for testing. It operates totally in memory and |
| 16 // provides additional API for manipulating preferences at the different levels | 19 // provides additional API for manipulating preferences at the different levels |
| 17 // (managed, extension, user) conveniently. | 20 // (managed, extension, user) conveniently. |
| 18 class TestingPrefServiceBase : public PrefService { | 21 class TestingPrefServiceBase : public PrefService { |
| 19 public: | 22 public: |
| 20 virtual ~TestingPrefServiceBase(); | 23 virtual ~TestingPrefServiceBase(); |
| 21 | 24 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 | 41 |
| 39 // Similar to the above, but for recommended policy preferences. | 42 // Similar to the above, but for recommended policy preferences. |
| 40 const Value* GetRecommendedPref(const char* path) const; | 43 const Value* GetRecommendedPref(const char* path) const; |
| 41 void SetRecommendedPref(const char* path, Value* value); | 44 void SetRecommendedPref(const char* path, Value* value); |
| 42 void RemoveRecommendedPref(const char* path); | 45 void RemoveRecommendedPref(const char* path); |
| 43 | 46 |
| 44 protected: | 47 protected: |
| 45 TestingPrefServiceBase( | 48 TestingPrefServiceBase( |
| 46 TestingPrefStore* managed_platform_prefs, | 49 TestingPrefStore* managed_platform_prefs, |
| 47 TestingPrefStore* user_prefs, | 50 TestingPrefStore* user_prefs, |
| 48 TestingPrefStore* recommended_platform_prefs); | 51 TestingPrefStore* recommended_platform_prefs, |
| 52 DefaultPrefStore* default_store, |
| 53 PrefModelAssociator* pref_sync_associator, |
| 54 PrefNotifierImpl* pref_notifier); |
| 49 | 55 |
| 50 private: | 56 private: |
| 51 // Reads the value of the preference indicated by |path| from |pref_store|. | 57 // Reads the value of the preference indicated by |path| from |pref_store|. |
| 52 // Returns NULL if the preference was not found. | 58 // Returns NULL if the preference was not found. |
| 53 const Value* GetPref(TestingPrefStore* pref_store, const char* path) const; | 59 const Value* GetPref(TestingPrefStore* pref_store, const char* path) const; |
| 54 | 60 |
| 55 // Sets the value for |path| in |pref_store|. | 61 // Sets the value for |path| in |pref_store|. |
| 56 void SetPref(TestingPrefStore* pref_store, const char* path, Value* value); | 62 void SetPref(TestingPrefStore* pref_store, const char* path, Value* value); |
| 57 | 63 |
| 58 // Removes the preference identified by |path| from |pref_store|. | 64 // Removes the preference identified by |path| from |pref_store|. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 88 } | 94 } |
| 89 | 95 |
| 90 private: | 96 private: |
| 91 TestingBrowserProcess* browser_process_; | 97 TestingBrowserProcess* browser_process_; |
| 92 TestingPrefService local_state_; | 98 TestingPrefService local_state_; |
| 93 | 99 |
| 94 DISALLOW_COPY_AND_ASSIGN(ScopedTestingLocalState); | 100 DISALLOW_COPY_AND_ASSIGN(ScopedTestingLocalState); |
| 95 }; | 101 }; |
| 96 | 102 |
| 97 #endif // CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_ | 103 #endif // CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_ |
| OLD | NEW |