Move creation of the PrefStores into the PrefValueStore, to reduce the knowledge the PrefService has of its two-levels-deep implementation.
Create a TestingPrefService::TestingPrefValueStore to allow tests to set the PrefStores directly, as they used to be able to do.
BUG=50722
TEST=covered by unit tests
Review URL: http://codereview.chromium.org/3032058
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55202 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/test/testing_pref_service.cc b/chrome/test/testing_pref_service.cc
index e6dde83..067b8b9 100644
--- a/chrome/test/testing_pref_service.cc
+++ b/chrome/test/testing_pref_service.cc
@@ -7,8 +7,20 @@
#include "chrome/browser/dummy_pref_store.h"
#include "chrome/browser/pref_value_store.h"
+TestingPrefService::TestingPrefValueStore::TestingPrefValueStore(
+ PrefStore* managed_prefs,
+ PrefStore* extension_prefs,
+ PrefStore* command_line_prefs,
+ PrefStore* user_prefs,
+ PrefStore* recommended_prefs)
+ : PrefValueStore(managed_prefs, extension_prefs, command_line_prefs,
+ user_prefs, recommended_prefs) {
+}
+
+// TODO(pamg): Instantiate no PrefStores by default. Allow callers to specify
+// which they want, and expand usage of this class to more unit tests.
TestingPrefService::TestingPrefService()
- : PrefService(new PrefValueStore(
+ : PrefService(new TestingPrefValueStore(
managed_prefs_ = new DummyPrefStore(),
NULL,
NULL,