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

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

Issue 16950028: Move file_util::Delete to the base namespace (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.h » ('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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 EXPECT_TRUE(actual->GetAsString(&string_value)); 141 EXPECT_TRUE(actual->GetAsString(&string_value));
142 int64 value; 142 int64 value;
143 base::StringToInt64(string_value, &value); 143 base::StringToInt64(string_value, &value);
144 EXPECT_EQ(214748364842LL, value); 144 EXPECT_EQ(214748364842LL, value);
145 145
146 // Serialize and compare to expected output. 146 // Serialize and compare to expected output.
147 ASSERT_TRUE(file_util::PathExists(golden_output_file)); 147 ASSERT_TRUE(file_util::PathExists(golden_output_file));
148 pref_store->CommitPendingWrite(); 148 pref_store->CommitPendingWrite();
149 RunLoop().RunUntilIdle(); 149 RunLoop().RunUntilIdle();
150 EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, output_file)); 150 EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, output_file));
151 ASSERT_TRUE(file_util::Delete(output_file, false)); 151 ASSERT_TRUE(base::Delete(output_file, false));
152 } 152 }
153 153
154 TEST_F(JsonPrefStoreTest, Basic) { 154 TEST_F(JsonPrefStoreTest, Basic) {
155 ASSERT_TRUE(file_util::CopyFile(data_dir_.AppendASCII("read.json"), 155 ASSERT_TRUE(file_util::CopyFile(data_dir_.AppendASCII("read.json"),
156 temp_dir_.path().AppendASCII("write.json"))); 156 temp_dir_.path().AppendASCII("write.json")));
157 157
158 // Test that the persistent value can be loaded. 158 // Test that the persistent value can be loaded.
159 base::FilePath input_file = temp_dir_.path().AppendASCII("write.json"); 159 base::FilePath input_file = temp_dir_.path().AppendASCII("write.json");
160 ASSERT_TRUE(file_util::PathExists(input_file)); 160 ASSERT_TRUE(file_util::PathExists(input_file));
161 scoped_refptr<JsonPrefStore> pref_store = 161 scoped_refptr<JsonPrefStore> pref_store =
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 RunLoop().RunUntilIdle(); 279 RunLoop().RunUntilIdle();
280 280
281 // Compare to expected output. 281 // Compare to expected output.
282 base::FilePath golden_output_file = 282 base::FilePath golden_output_file =
283 data_dir_.AppendASCII("write.golden.need_empty_value.json"); 283 data_dir_.AppendASCII("write.golden.need_empty_value.json");
284 ASSERT_TRUE(file_util::PathExists(golden_output_file)); 284 ASSERT_TRUE(file_util::PathExists(golden_output_file));
285 EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file)); 285 EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file));
286 } 286 }
287 287
288 } // namespace base 288 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_posix.cc ('k') | base/test/test_file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698