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

Unified Diff: chrome/browser/dom_ui/shown_sections_handler_unittest.cc

Issue 2823037: Add an ExtensionPrefStore, layered between the user prefs nad the managed pre... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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/browser/dom_ui/new_tab_ui_uitest.cc ('k') | chrome/browser/extensions/extension_pref_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/shown_sections_handler_unittest.cc
===================================================================
--- chrome/browser/dom_ui/shown_sections_handler_unittest.cc (revision 52073)
+++ chrome/browser/dom_ui/shown_sections_handler_unittest.cc (working copy)
@@ -19,20 +19,16 @@
TEST_F(ShownSectionsHandlerTest, MigrateUserPrefs) {
// 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 */));
+ FilePath user_prefs = FilePath();
+ scoped_ptr<PrefService> pref(PrefService::CreateUserPrefService(user_prefs));
// Set an *old* value
- pref.RegisterIntegerPref(prefs::kNTPShownSections, 0);
- pref.SetInteger(prefs::kNTPShownSections, THUMB);
+ pref->RegisterIntegerPref(prefs::kNTPShownSections, 0);
+ pref->SetInteger(prefs::kNTPShownSections, THUMB);
- ShownSectionsHandler::MigrateUserPrefs(&pref, 0, 1);
+ ShownSectionsHandler::MigrateUserPrefs(pref.get(), 0, 1);
- int shown_sections = pref.GetInteger(prefs::kNTPShownSections);
+ int shown_sections = pref->GetInteger(prefs::kNTPShownSections);
EXPECT_TRUE(shown_sections & THUMB);
EXPECT_FALSE(shown_sections & LIST);
@@ -42,20 +38,16 @@
}
TEST_F(ShownSectionsHandlerTest, MigrateUserPrefs1To2) {
- PrefService pref(new PrefValueStore(
- NULL, /* no managed preferences */
- new JsonPrefStore(
- FilePath(),
- ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)),
- NULL /* no suggested preferences */));
+ FilePath user_prefs = FilePath();
+ scoped_ptr<PrefService> pref(PrefService::CreateUserPrefService(user_prefs));
// Set an *old* value
- pref.RegisterIntegerPref(prefs::kNTPShownSections, 0);
- pref.SetInteger(prefs::kNTPShownSections, LIST);
+ pref->RegisterIntegerPref(prefs::kNTPShownSections, 0);
+ pref->SetInteger(prefs::kNTPShownSections, LIST);
- ShownSectionsHandler::MigrateUserPrefs(&pref, 1, 2);
+ ShownSectionsHandler::MigrateUserPrefs(pref.get(), 1, 2);
- int shown_sections = pref.GetInteger(prefs::kNTPShownSections);
+ int shown_sections = pref->GetInteger(prefs::kNTPShownSections);
EXPECT_TRUE(shown_sections & THUMB);
EXPECT_FALSE(shown_sections & LIST);
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui_uitest.cc ('k') | chrome/browser/extensions/extension_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698