Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4836)

Unified Diff: chrome/test/base/testing_pref_service.cc

Issue 12223091: Split testing_pref_service.h/.cc into two parts, generic vs. Chrome-specific. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comment. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/base/testing_pref_service.h ('k') | chrome/test/base/testing_pref_service_syncable.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/testing_pref_service.cc
diff --git a/chrome/test/base/testing_pref_service.cc b/chrome/test/base/testing_pref_service.cc
index 39205a0b238f2ebe517db5f5a5d1609d87bed78a..ae7342e988cfccc837b89635efd4ae4b03e150f6 100644
--- a/chrome/test/base/testing_pref_service.cc
+++ b/chrome/test/base/testing_pref_service.cc
@@ -10,21 +10,10 @@
#include "base/prefs/pref_notifier_impl.h"
#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/pref_value_store.h"
-#include "chrome/browser/prefs/browser_prefs.h"
-#include "chrome/browser/prefs/pref_registry_syncable.h"
-#include "chrome/test/base/testing_browser_process.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace {
-
-// Do-nothing implementation for TestingPrefService.
-void HandleReadError(PersistentPrefStore::PrefReadError error) {
-}
-
-} // namespace
-
template<>
-TestingPrefServiceBase<PrefService>::TestingPrefServiceBase(
+TestingPrefServiceBase<PrefService, PrefRegistry>::TestingPrefServiceBase(
TestingPrefStore* managed_prefs,
TestingPrefStore* user_prefs,
TestingPrefStore* recommended_prefs,
@@ -41,40 +30,17 @@ TestingPrefServiceBase<PrefService>::TestingPrefServiceBase(
pref_notifier),
user_prefs,
pref_registry,
- base::Bind(&HandleReadError),
+ base::Bind(
+ &TestingPrefServiceBase<
+ PrefService, PrefRegistry>::HandleReadError),
false),
managed_prefs_(managed_prefs),
user_prefs_(user_prefs),
recommended_prefs_(recommended_prefs) {
}
-template<>
-TestingPrefServiceBase<PrefServiceSyncable>::TestingPrefServiceBase(
- TestingPrefStore* managed_prefs,
- TestingPrefStore* user_prefs,
- TestingPrefStore* recommended_prefs,
- PrefRegistry* pref_registry,
- PrefNotifierImpl* pref_notifier)
- : PrefServiceSyncable(pref_notifier,
- new PrefValueStore(
- managed_prefs,
- NULL,
- NULL,
- user_prefs,
- recommended_prefs,
- pref_registry->defaults(),
- pref_notifier),
- user_prefs,
- static_cast<PrefRegistrySyncable*>(pref_registry),
- base::Bind(&HandleReadError),
- false),
- managed_prefs_(managed_prefs),
- user_prefs_(user_prefs),
- recommended_prefs_(recommended_prefs) {
-}
-
TestingPrefServiceSimple::TestingPrefServiceSimple()
- : TestingPrefServiceBase<PrefService>(
+ : TestingPrefServiceBase<PrefService, PrefRegistry>(
new TestingPrefStore(),
new TestingPrefStore(),
new TestingPrefStore(),
@@ -88,33 +54,3 @@ TestingPrefServiceSimple::~TestingPrefServiceSimple() {
PrefRegistrySimple* TestingPrefServiceSimple::registry() {
return static_cast<PrefRegistrySimple*>(DeprecatedGetPrefRegistry());
}
-
-TestingPrefServiceSyncable::TestingPrefServiceSyncable()
- : TestingPrefServiceBase<PrefServiceSyncable>(
- new TestingPrefStore(),
- new TestingPrefStore(),
- new TestingPrefStore(),
- new PrefRegistrySyncable(),
- new PrefNotifierImpl()) {
-}
-
-TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
-}
-
-PrefRegistrySyncable* TestingPrefServiceSyncable::registry() {
- return static_cast<PrefRegistrySyncable*>(DeprecatedGetPrefRegistry());
-}
-
-ScopedTestingLocalState::ScopedTestingLocalState(
- TestingBrowserProcess* browser_process)
- : browser_process_(browser_process) {
- chrome::RegisterLocalState(&local_state_,
- local_state_.registry());
- EXPECT_FALSE(browser_process->local_state());
- browser_process->SetLocalState(&local_state_);
-}
-
-ScopedTestingLocalState::~ScopedTestingLocalState() {
- EXPECT_EQ(&local_state_, browser_process_->local_state());
- browser_process_->SetLocalState(NULL);
-}
« no previous file with comments | « chrome/test/base/testing_pref_service.h ('k') | chrome/test/base/testing_pref_service_syncable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698