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

Unified Diff: chrome/browser/prefs/chrome_pref_service_unittest.cc

Issue 81183005: Remove JsonPrefStore pruning of empty values on write. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove else Created 7 years, 1 month 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 | « base/values_unittest.cc ('k') | chrome/browser/prefs/pref_metrics_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/chrome_pref_service_unittest.cc
diff --git a/chrome/browser/prefs/chrome_pref_service_unittest.cc b/chrome/browser/prefs/chrome_pref_service_unittest.cc
index 4a453fd4db750ccac398fc9ed1e558376e84975f..0d27501eaca3d2391983ed38b3d259068c07716e 100644
--- a/chrome/browser/prefs/chrome_pref_service_unittest.cc
+++ b/chrome/browser/prefs/chrome_pref_service_unittest.cc
@@ -88,59 +88,6 @@ class ChromePrefServiceUserFilePrefsTest : public testing::Test {
base::MessageLoop message_loop_;
};
-// Verifies that ListValue and DictionaryValue pref with non emtpy default
-// preserves its empty value.
-TEST_F(ChromePrefServiceUserFilePrefsTest, PreserveEmptyValue) {
- base::FilePath pref_file = temp_dir_.path().AppendASCII("write.json");
-
- ASSERT_TRUE(base::CopyFile(
- data_dir_.AppendASCII("read.need_empty_value.json"),
- pref_file));
-
- PrefServiceMockFactory factory;
- factory.SetUserPrefsFile(pref_file,
- message_loop_.message_loop_proxy().get());
- scoped_refptr<user_prefs::PrefRegistrySyncable> registry(
- new user_prefs::PrefRegistrySyncable);
- scoped_ptr<PrefServiceSyncable> prefs(factory.CreateSyncable(registry.get()));
-
- // Register testing prefs.
- registry->RegisterListPref("list",
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
- registry->RegisterDictionaryPref(
- "dict",
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
-
- base::ListValue* non_empty_list = new base::ListValue;
- non_empty_list->Append(base::Value::CreateStringValue("test"));
- registry->RegisterListPref("list_needs_empty_value",
- non_empty_list,
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
-
- base::DictionaryValue* non_empty_dict = new base::DictionaryValue;
- non_empty_dict->SetString("dummy", "whatever");
- registry->RegisterDictionaryPref(
- "dict_needs_empty_value",
- non_empty_dict,
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
-
- // Set all testing prefs to empty.
- ClearListValue(prefs.get(), "list");
- ClearListValue(prefs.get(), "list_needs_empty_value");
- ClearDictionaryValue(prefs.get(), "dict");
- ClearDictionaryValue(prefs.get(), "dict_needs_empty_value");
-
- // Write to file.
- prefs->CommitPendingWrite();
- message_loop_.RunUntilIdle();
-
- // Compare to expected output.
- base::FilePath golden_output_file =
- data_dir_.AppendASCII("write.golden.need_empty_value.json");
- ASSERT_TRUE(base::PathExists(golden_output_file));
- EXPECT_TRUE(base::TextContentsEqual(golden_output_file, pref_file));
-}
-
class ChromePrefServiceWebKitPrefs : public ChromeRenderViewHostTestHarness {
protected:
virtual void SetUp() {
« no previous file with comments | « base/values_unittest.cc ('k') | chrome/browser/prefs/pref_metrics_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698