| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/blockfile/addr.h" | 5 #include "net/disk_cache/blockfile/addr.h" |
| 6 #include "net/disk_cache/disk_cache_test_base.h" | 6 #include "net/disk_cache/disk_cache_test_base.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace disk_cache { | 9 namespace disk_cache { |
| 10 | 10 |
| 11 TEST_F(DiskCacheTest, CacheAddr_Size) { | 11 TEST_F(DiskCacheTest, CacheAddr_Size) { |
| 12 Addr addr1(0); | 12 Addr addr1(0); |
| 13 EXPECT_FALSE(addr1.is_initialized()); | 13 EXPECT_FALSE(addr1.is_initialized()); |
| 14 | 14 |
| 15 // The object should not be more expensive than the actual address. | 15 // The object should not be more expensive than the actual address. |
| 16 EXPECT_EQ(sizeof(uint32), sizeof(addr1)); | 16 EXPECT_EQ(sizeof(uint32_t), sizeof(addr1)); |
| 17 } | 17 } |
| 18 | 18 |
| 19 TEST_F(DiskCacheTest, CacheAddr_ValidValues) { | 19 TEST_F(DiskCacheTest, CacheAddr_ValidValues) { |
| 20 Addr addr2(BLOCK_1K, 3, 5, 25); | 20 Addr addr2(BLOCK_1K, 3, 5, 25); |
| 21 EXPECT_EQ(BLOCK_1K, addr2.file_type()); | 21 EXPECT_EQ(BLOCK_1K, addr2.file_type()); |
| 22 EXPECT_EQ(3, addr2.num_blocks()); | 22 EXPECT_EQ(3, addr2.num_blocks()); |
| 23 EXPECT_EQ(5, addr2.FileNumber()); | 23 EXPECT_EQ(5, addr2.FileNumber()); |
| 24 EXPECT_EQ(25, addr2.start_block()); | 24 EXPECT_EQ(25, addr2.start_block()); |
| 25 EXPECT_EQ(1024, addr2.BlockSize()); | 25 EXPECT_EQ(1024, addr2.BlockSize()); |
| 26 } | 26 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 50 EXPECT_FALSE(Addr(0xD0001000).SanityCheckV2()); | 50 EXPECT_FALSE(Addr(0xD0001000).SanityCheckV2()); |
| 51 EXPECT_FALSE(Addr(0xE0001000).SanityCheckV3()); | 51 EXPECT_FALSE(Addr(0xE0001000).SanityCheckV3()); |
| 52 EXPECT_FALSE(Addr(0xF0000000).SanityCheckV2()); | 52 EXPECT_FALSE(Addr(0xF0000000).SanityCheckV2()); |
| 53 | 53 |
| 54 // Reserved bits. | 54 // Reserved bits. |
| 55 EXPECT_FALSE(Addr(0x14000000).SanityCheckV2()); | 55 EXPECT_FALSE(Addr(0x14000000).SanityCheckV2()); |
| 56 EXPECT_FALSE(Addr(0x18000000).SanityCheckV2()); | 56 EXPECT_FALSE(Addr(0x18000000).SanityCheckV2()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace disk_cache | 59 } // namespace disk_cache |
| OLD | NEW |