Chromium Code Reviews| Index: base/prefs/json_pref_store_unittest.cc |
| diff --git a/base/prefs/json_pref_store_unittest.cc b/base/prefs/json_pref_store_unittest.cc |
| index 119a29cd96c94eede7e15a9a81c14f3db3dcdfa0..ebc67fb79016482718fc626b71685df5a230bd62 100644 |
| --- a/base/prefs/json_pref_store_unittest.cc |
| +++ b/base/prefs/json_pref_store_unittest.cc |
| @@ -257,6 +257,29 @@ TEST_F(JsonPrefStoreTest, PreserveEmptyValues) { |
| EXPECT_TRUE(DictionaryValue().Equals(result)); |
| } |
| +TEST_F(JsonPrefStoreTest, Remove) { |
| + ASSERT_TRUE(base::CopyFile(data_dir_.AppendASCII("remove.original.json"), |
| + temp_dir_.path().AppendASCII("remove.json"))); |
| + base::FilePath input_output_file = |
| + temp_dir_.path().AppendASCII("remove.json"); |
| + ASSERT_TRUE(PathExists(input_output_file)); |
| + scoped_refptr<JsonPrefStore> pref_store = new JsonPrefStore( |
| + input_output_file, |
| + message_loop_.message_loop_proxy().get(), |
| + scoped_ptr<PrefFilter>()); |
| + ASSERT_EQ(PersistentPrefStore::PREF_READ_ERROR_NONE, pref_store->ReadPrefs()); |
| + ASSERT_FALSE(pref_store->ReadOnly()); |
|
Mattias Nissler (ping if slow)
2014/01/23 09:07:54
Reading this code, I have no idea what the test is
|
| + |
| + pref_store->RemoveValue("long_int.pref"); |
| + |
| + pref_store->CommitPendingWrite(); |
| + RunLoop().RunUntilIdle(); |
| + |
| + base::FilePath golden_output_file = |
| + data_dir_.AppendASCII("remove.golden.json"); |
| + EXPECT_TRUE(TextContentsEqual(golden_output_file, input_output_file)); |
| +} |
| + |
| // Tests asynchronous reading of the file when there is no file. |
| TEST_F(JsonPrefStoreTest, AsyncNonExistingFile) { |
| base::FilePath bogus_input_file = data_dir_.AppendASCII("read.txt"); |