OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/platform_thread.h" | 6 #include "base/platform_thread.h" |
7 #include "base/timer.h" | 7 #include "base/timer.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 const int kSize1 = 2000; | 802 const int kSize1 = 2000; |
803 const int kSize2 = 2000; | 803 const int kSize2 = 2000; |
804 scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); | 804 scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); |
805 scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize2); | 805 scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize2); |
806 CacheTestFillBuffer(buffer1->data(), kSize1, false); | 806 CacheTestFillBuffer(buffer1->data(), kSize1, false); |
807 memset(buffer2->data(), 0, kSize2); | 807 memset(buffer2->data(), 0, kSize2); |
808 | 808 |
809 EXPECT_EQ(2000, entry->WriteData(0, 0, buffer1, 2000, NULL, false)); | 809 EXPECT_EQ(2000, entry->WriteData(0, 0, buffer1, 2000, NULL, false)); |
810 EXPECT_EQ(2000, entry->ReadData(0, 0, buffer2, 2000, NULL)); | 810 EXPECT_EQ(2000, entry->ReadData(0, 0, buffer2, 2000, NULL)); |
811 EXPECT_EQ(0, memcmp(buffer1->data(), buffer2->data(), kSize1)); | 811 EXPECT_EQ(0, memcmp(buffer1->data(), buffer2->data(), kSize1)); |
| 812 EXPECT_EQ(key, entry->GetKey()); |
812 EXPECT_TRUE(initial < entry->GetLastModified()); | 813 EXPECT_TRUE(initial < entry->GetLastModified()); |
813 EXPECT_TRUE(initial < entry->GetLastUsed()); | 814 EXPECT_TRUE(initial < entry->GetLastUsed()); |
814 | 815 |
815 entry->Close(); | 816 entry->Close(); |
816 } | 817 } |
817 | 818 |
818 TEST_F(DiskCacheEntryTest, DoomedEntry) { | 819 TEST_F(DiskCacheEntryTest, DoomedEntry) { |
819 InitCache(); | 820 InitCache(); |
820 DoomEntry(); | 821 DoomEntry(); |
821 } | 822 } |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 EXPECT_EQ(kSize, entry->WriteSparseData(k1Meg + 16384, buf1, kSize, NULL)); | 1296 EXPECT_EQ(kSize, entry->WriteSparseData(k1Meg + 16384, buf1, kSize, NULL)); |
1296 EXPECT_EQ(0, entry->ReadSparseData(k1Meg + 8192, buf1, kSize, NULL)); | 1297 EXPECT_EQ(0, entry->ReadSparseData(k1Meg + 8192, buf1, kSize, NULL)); |
1297 | 1298 |
1298 // We never touched this one. | 1299 // We never touched this one. |
1299 EXPECT_EQ(kSize, entry->ReadSparseData(8192, buf1, kSize, NULL)); | 1300 EXPECT_EQ(kSize, entry->ReadSparseData(8192, buf1, kSize, NULL)); |
1300 entry->Close(); | 1301 entry->Close(); |
1301 | 1302 |
1302 // We re-created one of the corrupt children. | 1303 // We re-created one of the corrupt children. |
1303 EXPECT_EQ(3, cache_->GetEntryCount()); | 1304 EXPECT_EQ(3, cache_->GetEntryCount()); |
1304 } | 1305 } |
OLD | NEW |