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

Side by Side Diff: net/disk_cache/blockfile/block_files_unittest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/simple/simple_index_file.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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/files/file_enumerator.h" 6 #include "base/files/file_enumerator.h"
7 #include "net/disk_cache/blockfile/block_files.h" 7 #include "net/disk_cache/blockfile/block_files.h"
8 #include "net/disk_cache/disk_cache.h" 8 #include "net/disk_cache/disk_cache.h"
9 #include "net/disk_cache/disk_cache_test_base.h" 9 #include "net/disk_cache/disk_cache_test_base.h"
10 #include "net/disk_cache/disk_cache_test_util.h" 10 #include "net/disk_cache/disk_cache_test_util.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 // Let's access block 10 of file 5. (There is no file). 264 // Let's access block 10 of file 5. (There is no file).
265 Addr addr(BLOCK_256, 1, 5, 10); 265 Addr addr(BLOCK_256, 1, 5, 10);
266 EXPECT_TRUE(NULL == files.GetFile(addr)); 266 EXPECT_TRUE(NULL == files.GetFile(addr));
267 267
268 // Let's create an invalid file. 268 // Let's create an invalid file.
269 base::FilePath filename(files.Name(5)); 269 base::FilePath filename(files.Name(5));
270 char header[kBlockHeaderSize]; 270 char header[kBlockHeaderSize];
271 memset(header, 'a', kBlockHeaderSize); 271 memset(header, 'a', kBlockHeaderSize);
272 EXPECT_EQ(kBlockHeaderSize, 272 EXPECT_EQ(kBlockHeaderSize,
273 file_util::WriteFile(filename, header, kBlockHeaderSize)); 273 base::WriteFile(filename, header, kBlockHeaderSize));
274 274
275 EXPECT_TRUE(NULL == files.GetFile(addr)); 275 EXPECT_TRUE(NULL == files.GetFile(addr));
276 276
277 // The file should not have been changed (it is still invalid). 277 // The file should not have been changed (it is still invalid).
278 EXPECT_TRUE(NULL == files.GetFile(addr)); 278 EXPECT_TRUE(NULL == files.GetFile(addr));
279 } 279 }
280 280
281 // Tests that we generate the correct file stats. 281 // Tests that we generate the correct file stats.
282 TEST_F(DiskCacheTest, BlockFiles_Stats) { 282 TEST_F(DiskCacheTest, BlockFiles_Stats) {
283 ASSERT_TRUE(CopyTestCache("remove_load1")); 283 ASSERT_TRUE(CopyTestCache("remove_load1"));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 341 }
342 342
343 // The allocation map should be empty. 343 // The allocation map should be empty.
344 for (int i =0; i < 50; i++) { 344 for (int i =0; i < 50; i++) {
345 SCOPED_TRACE(i); 345 SCOPED_TRACE(i);
346 EXPECT_EQ(0, buffer[i]); 346 EXPECT_EQ(0, buffer[i]);
347 } 347 }
348 } 348 }
349 349
350 } // namespace disk_cache 350 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/simple/simple_index_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698