| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/bitmap.h" | 5 #include "net/disk_cache/blockfile/bitmap.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 TEST(BitmapTest, OverAllocate) { | 8 TEST(BitmapTest, OverAllocate) { |
| 9 // Test that we don't over allocate on boundaries. | 9 // Test that we don't over allocate on boundaries. |
| 10 disk_cache::Bitmap map32(32, false); | 10 disk_cache::Bitmap map32(32, false); |
| 11 EXPECT_EQ(1, map32.ArraySize()); | 11 EXPECT_EQ(1, map32.ArraySize()); |
| 12 | 12 |
| 13 disk_cache::Bitmap map64(64, false); | 13 disk_cache::Bitmap map64(64, false); |
| 14 EXPECT_EQ(2, map64.ArraySize()); | 14 EXPECT_EQ(2, map64.ArraySize()); |
| 15 } | 15 } |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 bitmap.SetMapElement(11, 0xff); | 284 bitmap.SetMapElement(11, 0xff); |
| 285 | 285 |
| 286 index = 0; | 286 index = 0; |
| 287 EXPECT_EQ(16, bitmap.FindBits(&index, 500, true)); | 287 EXPECT_EQ(16, bitmap.FindBits(&index, 500, true)); |
| 288 EXPECT_EQ(344, index); | 288 EXPECT_EQ(344, index); |
| 289 | 289 |
| 290 index = 0; | 290 index = 0; |
| 291 EXPECT_EQ(4, bitmap.FindBits(&index, 348, true)); | 291 EXPECT_EQ(4, bitmap.FindBits(&index, 348, true)); |
| 292 EXPECT_EQ(344, index); | 292 EXPECT_EQ(344, index); |
| 293 } | 293 } |
| OLD | NEW |