| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/test/testing_pref_service.h" | 5 #include "chrome/test/testing_pref_service.h" |
| 6 | 6 |
| 7 #include "chrome/browser/prefs/command_line_pref_store.h" | 7 #include "chrome/browser/prefs/command_line_pref_store.h" |
| 8 #include "chrome/browser/prefs/dummy_pref_store.h" | 8 #include "chrome/browser/prefs/dummy_pref_store.h" |
| 9 #include "chrome/browser/prefs/pref_value_store.h" | 9 #include "chrome/browser/prefs/pref_value_store.h" |
| 10 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 10 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 11 #include "chrome/test/testing_pref_value_store.h" | 11 #include "chrome/test/testing_pref_value_store.h" |
| 12 | 12 |
| 13 // TODO(pamg): Instantiate no PrefStores by default. Allow callers to specify | 13 // TODO(pamg): Instantiate no PrefStores by default. Allow callers to specify |
| 14 // which they want, and expand usage of this class to more unit tests. | 14 // which they want, and expand usage of this class to more unit tests. |
| 15 TestingPrefService::TestingPrefService() | 15 TestingPrefService::TestingPrefService() |
| 16 : PrefService(new TestingPrefValueStore( | 16 : PrefService(new TestingPrefValueStore( |
| 17 managed_platform_prefs_ = new DummyPrefStore(), | 17 managed_platform_prefs_ = new DummyPrefStore(), |
| 18 device_management_prefs_ = new DummyPrefStore(), | 18 device_management_prefs_ = new DummyPrefStore(), |
| 19 NULL, | 19 NULL, |
| 20 NULL, | 20 NULL, |
| 21 user_prefs_ = new DummyPrefStore(), | 21 user_prefs_ = new DummyPrefStore(), |
| 22 NULL, | 22 NULL, |
| 23 default_prefs_ = new DummyPrefStore())) { | 23 default_prefs_ = new DummyPrefStore())) { |
| 24 } | 24 } |
| 25 | 25 |
| 26 TestingPrefService::TestingPrefService( | 26 TestingPrefService::TestingPrefService( |
| 27 policy::ConfigurationPolicyProvider* managed_platform_provider, | 27 policy::ConfigurationPolicyProvider* managed_platform_provider, |
| 28 policy::ConfigurationPolicyProvider* device_management_provider, | 28 policy::ConfigurationPolicyProvider* device_management_provider, |
| 29 CommandLine* command_line) | 29 CommandLine* command_line) |
| 30 : PrefService(new TestingPrefValueStore( | 30 : PrefService(new TestingPrefValueStore( |
| 31 managed_platform_prefs_ = CreatePolicyPrefStoreFromProvider( | 31 managed_platform_prefs_ = CreatePolicyPrefStoreFromProvider( |
| 32 managed_platform_provider), | 32 managed_platform_provider), |
| 33 device_management_prefs_ = | 33 device_management_prefs_ = |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 Value* value) { | 98 Value* value) { |
| 99 pref_store->prefs()->Set(path, value); | 99 pref_store->prefs()->Set(path, value); |
| 100 pref_notifier()->FireObservers(path); | 100 pref_notifier()->FireObservers(path); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void TestingPrefService::RemovePref(PrefStore* pref_store, | 103 void TestingPrefService::RemovePref(PrefStore* pref_store, |
| 104 const char* path) { | 104 const char* path) { |
| 105 pref_store->prefs()->Remove(path, NULL); | 105 pref_store->prefs()->Remove(path, NULL); |
| 106 pref_notifier()->FireObservers(path); | 106 pref_notifier()->FireObservers(path); |
| 107 } | 107 } |
| OLD | NEW |