| 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/policy/configuration_policy_pref_store.h" | 7 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 8 #include "chrome/browser/prefs/command_line_pref_store.h" | 8 #include "chrome/browser/prefs/command_line_pref_store.h" |
| 9 #include "chrome/browser/prefs/pref_notifier.h" | 9 #include "chrome/browser/prefs/pref_notifier.h" |
| 10 #include "chrome/browser/prefs/pref_value_store.h" | 10 #include "chrome/browser/prefs/pref_value_store.h" |
| 11 #include "chrome/browser/prefs/testing_pref_store.h" | 11 #include "chrome/browser/prefs/testing_pref_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( | 16 : PrefService( |
| 17 managed_platform_prefs_ = new TestingPrefStore(), | 17 managed_platform_prefs_ = new TestingPrefStore(), |
| 18 device_management_prefs_ = new TestingPrefStore(), | 18 device_management_prefs_ = new TestingPrefStore(), |
| 19 NULL, | 19 NULL, |
| 20 NULL, | 20 NULL, |
| 21 user_prefs_ = new TestingPrefStore(), | 21 user_prefs_ = new TestingPrefStore(), |
| 22 NULL, | |
| 23 NULL) { | 22 NULL) { |
| 24 } | 23 } |
| 25 | 24 |
| 26 const Value* TestingPrefService::GetManagedPref(const char* path) const { | 25 const Value* TestingPrefService::GetManagedPref(const char* path) const { |
| 27 return GetPref(managed_platform_prefs_, path); | 26 return GetPref(managed_platform_prefs_, path); |
| 28 } | 27 } |
| 29 | 28 |
| 30 void TestingPrefService::SetManagedPref(const char* path, Value* value) { | 29 void TestingPrefService::SetManagedPref(const char* path, Value* value) { |
| 31 SetPref(managed_platform_prefs_, path, value); | 30 SetPref(managed_platform_prefs_, path, value); |
| 32 } | 31 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 56 void TestingPrefService::SetPref(TestingPrefStore* pref_store, | 55 void TestingPrefService::SetPref(TestingPrefStore* pref_store, |
| 57 const char* path, | 56 const char* path, |
| 58 Value* value) { | 57 Value* value) { |
| 59 pref_store->SetValue(path, value); | 58 pref_store->SetValue(path, value); |
| 60 } | 59 } |
| 61 | 60 |
| 62 void TestingPrefService::RemovePref(TestingPrefStore* pref_store, | 61 void TestingPrefService::RemovePref(TestingPrefStore* pref_store, |
| 63 const char* path) { | 62 const char* path) { |
| 64 pref_store->RemoveValue(path); | 63 pref_store->RemoveValue(path); |
| 65 } | 64 } |
| OLD | NEW |