summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-07 13:13:28 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-07 13:13:28 +0000
commitd8b08c98289cc59828a9f9bef0de16252ef9da18 (patch)
tree2cadb8879a5923827f98810c4ca87f31a4d4ef25 /chrome/browser/dom_ui
parentffcaeac917f846d978c5d5b216ccb06def6d22be (diff)
downloadchromium_src-d8b08c98289cc59828a9f9bef0de16252ef9da18.zip
chromium_src-d8b08c98289cc59828a9f9bef0de16252ef9da18.tar.gz
chromium_src-d8b08c98289cc59828a9f9bef0de16252ef9da18.tar.bz2
Support multiple PrefStores
Add interface for multi_pref_store_manager. BUG=40259 TEST=Unittests in pref_service_unittest.cc, pref_value_store_unittest.cc Review URL: http://codereview.chromium.org/1957005 Patch from Markus Heintz <markusheintz@google.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49048 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/new_tab_ui_uitest.cc9
-rw-r--r--chrome/browser/dom_ui/shown_sections_handler_unittest.cc22
2 files changed, 22 insertions, 9 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui_uitest.cc b/chrome/browser/dom_ui/new_tab_ui_uitest.cc
index daf6ce7..7bd8357 100644
--- a/chrome/browser/dom_ui/new_tab_ui_uitest.cc
+++ b/chrome/browser/dom_ui/new_tab_ui_uitest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/dom_ui/new_tab_ui.h"
#include "chrome/browser/pref_service.h"
+#include "chrome/browser/pref_value_store.h"
#include "chrome/common/json_pref_store.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/automation/browser_proxy.h"
@@ -76,10 +77,14 @@ TEST_F(NewTabUITest, ChromeInternalLoadsNTP) {
}
TEST_F(NewTabUITest, UpdateUserPrefsVersion) {
- PrefService prefs(
+ // PrefService with JSON user-pref file only, no enforced or advised prefs.
+ PrefService prefs(new PrefValueStore(
+ NULL, /* no enforced prefs */
new JsonPrefStore(
FilePath(),
- ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)));
+ ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)),
+ /* user prefs */
+ NULL /* no advised prefs */));
// Does the migration
NewTabUI::RegisterUserPrefs(&prefs);
diff --git a/chrome/browser/dom_ui/shown_sections_handler_unittest.cc b/chrome/browser/dom_ui/shown_sections_handler_unittest.cc
index 48530d2..9dc5c872 100644
--- a/chrome/browser/dom_ui/shown_sections_handler_unittest.cc
+++ b/chrome/browser/dom_ui/shown_sections_handler_unittest.cc
@@ -8,6 +8,7 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/pref_service.h"
+#include "chrome/browser/pref_value_store.h"
#include "chrome/common/json_pref_store.h"
#include "chrome/common/pref_names.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -16,10 +17,14 @@ class ShownSectionsHandlerTest : public testing::Test {
};
TEST_F(ShownSectionsHandlerTest, MigrateUserPrefs) {
- PrefService pref(
- new JsonPrefStore(
- FilePath(),
- ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)));
+ // Create a preference value that has only user defined
+ // preference values.
+ PrefService pref(new PrefValueStore(
+ NULL, /* no managed preference values */
+ new JsonPrefStore( /* user defined preference values */
+ FilePath(),
+ ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)),
+ NULL /* no suggested preference values */));
// Set an *old* value
pref.RegisterIntegerPref(prefs::kNTPShownSections, 0);
@@ -37,10 +42,12 @@ TEST_F(ShownSectionsHandlerTest, MigrateUserPrefs) {
}
TEST_F(ShownSectionsHandlerTest, MigrateUserPrefs1To2) {
- PrefService pref(
+ PrefService pref(new PrefValueStore(
+ NULL,
new JsonPrefStore(
- FilePath(),
- ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)));
+ FilePath(),
+ ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)),
+ NULL));
// Set an *old* value
pref.RegisterIntegerPref(prefs::kNTPShownSections, 0);
@@ -53,3 +60,4 @@ TEST_F(ShownSectionsHandlerTest, MigrateUserPrefs1To2) {
EXPECT_TRUE(shown_sections & THUMB);
EXPECT_FALSE(shown_sections & LIST);
}
+