Index: chrome/test/testing_pref_service.cc |
diff --git a/chrome/test/testing_pref_service.cc b/chrome/test/testing_pref_service.cc |
index 9cc532121d43f845950179f62a55ffe15efc84a6..66342bc471b83327431e8980b7614c972c1d15d2 100644 |
--- a/chrome/test/testing_pref_service.cc |
+++ b/chrome/test/testing_pref_service.cc |
@@ -4,11 +4,11 @@ |
#include "chrome/test/testing_pref_service.h" |
+#include "chrome/browser/policy/configuration_policy_pref_store.h" |
#include "chrome/browser/prefs/command_line_pref_store.h" |
-#include "chrome/browser/prefs/testing_pref_store.h" |
#include "chrome/browser/prefs/pref_notifier.h" |
#include "chrome/browser/prefs/pref_value_store.h" |
-#include "chrome/browser/policy/configuration_policy_pref_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. |
@@ -23,37 +23,7 @@ TestingPrefService::TestingPrefService() |
NULL) { |
} |
-TestingPrefService::TestingPrefService( |
- policy::ConfigurationPolicyProvider* managed_platform_provider, |
- policy::ConfigurationPolicyProvider* device_management_provider, |
- CommandLine* command_line) |
- : PrefService( |
- managed_platform_prefs_ = CreatePolicyPrefStoreFromProvider( |
- managed_platform_provider), |
- device_management_prefs_ = |
- CreatePolicyPrefStoreFromProvider(device_management_provider), |
- NULL, |
- CreateCommandLinePrefStore(command_line), |
- user_prefs_ = new TestingPrefStore(), |
- NULL, |
- NULL) { |
-} |
- |
-PrefStore* TestingPrefService::CreatePolicyPrefStoreFromProvider( |
- policy::ConfigurationPolicyProvider* provider) { |
- if (provider) |
- return new policy::ConfigurationPolicyPrefStore(provider); |
- return new TestingPrefStore(); |
-} |
- |
-PrefStore* TestingPrefService::CreateCommandLinePrefStore( |
- CommandLine* command_line) { |
- if (command_line) |
- return new CommandLinePrefStore(command_line); |
- return new TestingPrefStore(); |
-} |
- |
-const Value* TestingPrefService::GetManagedPref(const char* path) { |
+const Value* TestingPrefService::GetManagedPref(const char* path) const { |
return GetPref(managed_platform_prefs_, path); |
} |
@@ -65,17 +35,7 @@ void TestingPrefService::RemoveManagedPref(const char* path) { |
RemovePref(managed_platform_prefs_, path); |
} |
-void TestingPrefService::SetManagedPrefWithoutNotification(const char* path, |
- Value* value) { |
- managed_platform_prefs_->prefs()->Set(path, value); |
-} |
- |
-void TestingPrefService::RemoveManagedPrefWithoutNotification( |
- const char* path) { |
- managed_platform_prefs_->prefs()->Remove(path, NULL); |
-} |
- |
-const Value* TestingPrefService::GetUserPref(const char* path) { |
+const Value* TestingPrefService::GetUserPref(const char* path) const { |
return GetPref(user_prefs_, path); |
} |
@@ -87,21 +47,19 @@ void TestingPrefService::RemoveUserPref(const char* path) { |
RemovePref(user_prefs_, path); |
} |
-const Value* TestingPrefService::GetPref(PrefStore* pref_store, |
- const char* path) { |
- Value* result; |
- return pref_store->prefs()->Get(path, &result) ? result : NULL; |
+const Value* TestingPrefService::GetPref(TestingPrefStore* pref_store, |
+ const char* path) const { |
+ Value* res; |
+ return pref_store->GetValue(path, &res) == PrefStore::READ_OK ? res : NULL; |
} |
-void TestingPrefService::SetPref(PrefStore* pref_store, |
+void TestingPrefService::SetPref(TestingPrefStore* pref_store, |
const char* path, |
Value* value) { |
- pref_store->prefs()->Set(path, value); |
- pref_notifier()->OnPreferenceChanged(path); |
+ pref_store->SetValue(path, value); |
} |
-void TestingPrefService::RemovePref(PrefStore* pref_store, |
+void TestingPrefService::RemovePref(TestingPrefStore* pref_store, |
const char* path) { |
- pref_store->prefs()->Remove(path, NULL); |
- pref_notifier()->OnPreferenceChanged(path); |
+ pref_store->RemoveValue(path); |
} |