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

Side by Side Diff: net/disk_cache/v3/block_bitmaps_unittest.cc

Issue 17507006: Disk cache v3 ref2 Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Incl IndexTable cl Created 7 years, 1 month 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/v3/block_bitmaps.cc ('k') | net/disk_cache/v3/entry_impl_v3.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 "net/disk_cache/addr.h" 5 #include "net/disk_cache/addr.h"
6 #include "net/disk_cache/block_files.h" 6 #include "net/disk_cache/block_files.h"
7 #include "net/disk_cache/disk_format_base.h" 7 #include "net/disk_cache/disk_format_base.h"
8 #include "net/disk_cache/v3/block_bitmaps.h" 8 #include "net/disk_cache/v3/block_bitmaps.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 // Tests that we add and remove blocks correctly. 11 // Tests that we add and remove blocks correctly.
12 TEST(DiskCacheBlockBitmaps, V3AllocationMap) { 12 TEST(DiskCacheBlockBitmaps, V3AllocationMap) {
13 disk_cache::BlockBitmaps block_bitmaps; 13 disk_cache::BlockBitmaps block_bitmaps(NULL);
14 disk_cache::BlockFilesBitmaps bitmaps; 14 disk_cache::BlockFilesBitmaps bitmaps;
15 15
16 const int kNumHeaders = 10; 16 const int kNumHeaders = 10;
17 disk_cache::BlockFileHeader headers[kNumHeaders]; 17 disk_cache::BlockFileHeader headers[kNumHeaders];
18 for (int i = 0; i < kNumHeaders; i++) { 18 for (int i = 0; i < kNumHeaders; i++) {
19 memset(&headers[i], 0, sizeof(headers[i])); 19 memset(&headers[i], 0, sizeof(headers[i]));
20 headers[i].magic = disk_cache::kBlockMagic; 20 headers[i].magic = disk_cache::kBlockMagic;
21 headers[i].version = disk_cache::kBlockCurrentVersion; 21 headers[i].version = disk_cache::kBlockCurrentVersion;
22 headers[i].this_file = static_cast<int16>(i); 22 headers[i].this_file = static_cast<int16>(i);
23 headers[i].empty[3] = 200; 23 headers[i].empty[3] = 200;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 SCOPED_TRACE(i); 61 SCOPED_TRACE(i);
62 block_bitmaps.DeleteBlock(address[i]); 62 block_bitmaps.DeleteBlock(address[i]);
63 } 63 }
64 64
65 // The allocation map should be empty. 65 // The allocation map should be empty.
66 for (int i =0; i < 50; i++) { 66 for (int i =0; i < 50; i++) {
67 SCOPED_TRACE(i); 67 SCOPED_TRACE(i);
68 EXPECT_EQ(0, buffer[i]); 68 EXPECT_EQ(0, buffer[i]);
69 } 69 }
70 } 70 }
OLDNEW
« no previous file with comments | « net/disk_cache/v3/block_bitmaps.cc ('k') | net/disk_cache/v3/entry_impl_v3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698