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

Side by Side Diff: base/prefs/json_pref_store_unittest.cc

Issue 18584011: Rename base::Delete to base::DeleteFile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/memory/shared_memory_posix.cc ('k') | base/test/test_file_util_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/prefs/json_pref_store.h" 5 #include "base/prefs/json_pref_store.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 EXPECT_TRUE(actual->GetAsString(&string_value)); 140 EXPECT_TRUE(actual->GetAsString(&string_value));
141 int64 value; 141 int64 value;
142 base::StringToInt64(string_value, &value); 142 base::StringToInt64(string_value, &value);
143 EXPECT_EQ(214748364842LL, value); 143 EXPECT_EQ(214748364842LL, value);
144 144
145 // Serialize and compare to expected output. 145 // Serialize and compare to expected output.
146 ASSERT_TRUE(PathExists(golden_output_file)); 146 ASSERT_TRUE(PathExists(golden_output_file));
147 pref_store->CommitPendingWrite(); 147 pref_store->CommitPendingWrite();
148 RunLoop().RunUntilIdle(); 148 RunLoop().RunUntilIdle();
149 EXPECT_TRUE(TextContentsEqual(golden_output_file, output_file)); 149 EXPECT_TRUE(TextContentsEqual(golden_output_file, output_file));
150 ASSERT_TRUE(base::Delete(output_file, false)); 150 ASSERT_TRUE(base::DeleteFile(output_file, false));
151 } 151 }
152 152
153 TEST_F(JsonPrefStoreTest, Basic) { 153 TEST_F(JsonPrefStoreTest, Basic) {
154 ASSERT_TRUE(base::CopyFile(data_dir_.AppendASCII("read.json"), 154 ASSERT_TRUE(base::CopyFile(data_dir_.AppendASCII("read.json"),
155 temp_dir_.path().AppendASCII("write.json"))); 155 temp_dir_.path().AppendASCII("write.json")));
156 156
157 // Test that the persistent value can be loaded. 157 // Test that the persistent value can be loaded.
158 base::FilePath input_file = temp_dir_.path().AppendASCII("write.json"); 158 base::FilePath input_file = temp_dir_.path().AppendASCII("write.json");
159 ASSERT_TRUE(PathExists(input_file)); 159 ASSERT_TRUE(PathExists(input_file));
160 scoped_refptr<JsonPrefStore> pref_store = 160 scoped_refptr<JsonPrefStore> pref_store =
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 RunLoop().RunUntilIdle(); 278 RunLoop().RunUntilIdle();
279 279
280 // Compare to expected output. 280 // Compare to expected output.
281 base::FilePath golden_output_file = 281 base::FilePath golden_output_file =
282 data_dir_.AppendASCII("write.golden.need_empty_value.json"); 282 data_dir_.AppendASCII("write.golden.need_empty_value.json");
283 ASSERT_TRUE(PathExists(golden_output_file)); 283 ASSERT_TRUE(PathExists(golden_output_file));
284 EXPECT_TRUE(TextContentsEqual(golden_output_file, pref_file)); 284 EXPECT_TRUE(TextContentsEqual(golden_output_file, pref_file));
285 } 285 }
286 286
287 } // namespace base 287 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_posix.cc ('k') | base/test/test_file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698