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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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
« no previous file with comments | « net/disk_cache/blockfile/block_files.h ('k') | net/disk_cache/blockfile/disk_cache_perftest.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/files/file_enumerator.h" 5 #include "base/files/file_enumerator.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 for (int i = 0; i < kSize; i++) { 323 for (int i = 0; i < kSize; i++) {
324 SCOPED_TRACE(i); 324 SCOPED_TRACE(i);
325 EXPECT_TRUE(files.IsValid(address[i])); 325 EXPECT_TRUE(files.IsValid(address[i]));
326 } 326 }
327 327
328 // The first part of the allocation map should be completely filled. We used 328 // The first part of the allocation map should be completely filled. We used
329 // 10 bits per each four entries, so 250 bits total. 329 // 10 bits per each four entries, so 250 bits total.
330 BlockFileHeader* header = 330 BlockFileHeader* header =
331 reinterpret_cast<BlockFileHeader*>(files.GetFile(address[0])->buffer()); 331 reinterpret_cast<BlockFileHeader*>(files.GetFile(address[0])->buffer());
332 uint8* buffer = reinterpret_cast<uint8*>(&header->allocation_map); 332 uint8_t* buffer = reinterpret_cast<uint8_t*>(&header->allocation_map);
333 for (int i =0; i < 29; i++) { 333 for (int i =0; i < 29; i++) {
334 SCOPED_TRACE(i); 334 SCOPED_TRACE(i);
335 EXPECT_EQ(0xff, buffer[i]); 335 EXPECT_EQ(0xff, buffer[i]);
336 } 336 }
337 337
338 for (int i = 0; i < kSize; i++) { 338 for (int i = 0; i < kSize; i++) {
339 SCOPED_TRACE(i); 339 SCOPED_TRACE(i);
340 files.DeleteBlock(address[i], false); 340 files.DeleteBlock(address[i], false);
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/blockfile/block_files.h ('k') | net/disk_cache/blockfile/disk_cache_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698