Chromium Code Reviews| Index: chrome/test/testing_pref_service.cc |
| diff --git a/chrome/test/testing_pref_service.cc b/chrome/test/testing_pref_service.cc |
| index acb4be2579f22dfaa41528a33434b8b1e597cde1..3b16a7c96d939f10572ff8c511a5fc3afb7b9aa7 100644 |
| --- a/chrome/test/testing_pref_service.cc |
| +++ b/chrome/test/testing_pref_service.cc |
| @@ -1,64 +1,92 @@ |
| -// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "chrome/test/testing_pref_service.h" |
| +#include "chrome/browser/extensions/extension_pref_store.h" |
| #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| #include "chrome/browser/prefs/command_line_pref_store.h" |
| +#include "chrome/browser/prefs/default_pref_store.h" |
| #include "chrome/browser/prefs/pref_notifier.h" |
| #include "chrome/browser/prefs/pref_value_store.h" |
| #include "chrome/browser/prefs/testing_pref_store.h" |
| // TODO(pamg): Instantiate no PrefStores by default. Allow callers to specify |
| // which they want, and expand usage of this class to more unit tests. |
|
Mattias Nissler (ping if slow)
2011/01/05 12:08:07
This comment is outdated, just remove it. The solu
battre
2011/01/05 20:23:08
Done.
|
| -TestingPrefService::TestingPrefService() |
| - : PrefService( |
| - managed_platform_prefs_ = new TestingPrefStore(), |
| - device_management_prefs_ = new TestingPrefStore(), |
| - NULL, |
| - NULL, |
| - user_prefs_ = new TestingPrefStore(), |
| - NULL) { |
| +TestingPrefServiceBase::TestingPrefServiceBase( |
| + TestingPrefStore* managed_platform_prefs, |
| + TestingPrefStore* device_management_prefs, |
| + ExtensionPrefStore* extension_prefs, |
| + TestingPrefStore* user_prefs) |
| + : PrefService(managed_platform_prefs, |
| + device_management_prefs, |
| + extension_prefs, |
| + NULL, |
| + user_prefs, |
| + NULL, |
| + new DefaultPrefStore(), |
| + true), |
| + managed_platform_prefs_(managed_platform_prefs), |
| + device_management_prefs_(device_management_prefs), |
| + extension_prefs_(extension_prefs), |
| + user_prefs_(user_prefs) { |
| +} |
| + |
| +TestingPrefServiceBase::~TestingPrefServiceBase() { |
| } |
| -const Value* TestingPrefService::GetManagedPref(const char* path) const { |
| +const Value* TestingPrefServiceBase::GetManagedPref(const char* path) const { |
| return GetPref(managed_platform_prefs_, path); |
| } |
| -void TestingPrefService::SetManagedPref(const char* path, Value* value) { |
| +void TestingPrefServiceBase::SetManagedPref(const char* path, Value* value) { |
| SetPref(managed_platform_prefs_, path, value); |
| } |
| -void TestingPrefService::RemoveManagedPref(const char* path) { |
| +void TestingPrefServiceBase::RemoveManagedPref(const char* path) { |
| RemovePref(managed_platform_prefs_, path); |
| } |
| -const Value* TestingPrefService::GetUserPref(const char* path) const { |
| +const Value* TestingPrefServiceBase::GetUserPref(const char* path) const { |
| return GetPref(user_prefs_, path); |
| } |
| -void TestingPrefService::SetUserPref(const char* path, Value* value) { |
| +void TestingPrefServiceBase::SetUserPref(const char* path, Value* value) { |
| SetPref(user_prefs_, path, value); |
| } |
| -void TestingPrefService::RemoveUserPref(const char* path) { |
| +void TestingPrefServiceBase::RemoveUserPref(const char* path) { |
| RemovePref(user_prefs_, path); |
| } |
| -const Value* TestingPrefService::GetPref(TestingPrefStore* pref_store, |
| +const Value* TestingPrefServiceBase::GetPref(TestingPrefStore* pref_store, |
| const char* path) const { |
| Value* res; |
| return pref_store->GetValue(path, &res) == PrefStore::READ_OK ? res : NULL; |
| } |
| -void TestingPrefService::SetPref(TestingPrefStore* pref_store, |
| +void TestingPrefServiceBase::SetPref(TestingPrefStore* pref_store, |
| const char* path, |
| Value* value) { |
| pref_store->SetValue(path, value); |
| } |
| -void TestingPrefService::RemovePref(TestingPrefStore* pref_store, |
| +void TestingPrefServiceBase::RemovePref(TestingPrefStore* pref_store, |
| const char* path) { |
| pref_store->RemoveValue(path); |
| } |
| + |
| +ExtensionPrefStore* TestingPrefServiceBase::GetExtensionPrefs() { |
| + return extension_prefs_.get(); |
| +} |
| + |
| +TestingPrefService::TestingPrefService() |
| + : TestingPrefServiceBase(new TestingPrefStore(), |
| + new TestingPrefStore(), |
| + new ExtensionPrefStore(false), |
| + new TestingPrefStore()) { |
| +} |
| + |
| +TestingPrefService::~TestingPrefService() { |
| +} |