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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
777 } | 777 } |
778 | 778 |
779 // We'll be leaking memory from this test. | 779 // We'll be leaking memory from this test. |
780 TEST_F(DiskCacheBackendTest, NewEvictionTrimInvalidEntry) { | 780 TEST_F(DiskCacheBackendTest, NewEvictionTrimInvalidEntry) { |
781 SetNewEviction(); | 781 SetNewEviction(); |
782 BackendTrimInvalidEntry(); | 782 BackendTrimInvalidEntry(); |
783 } | 783 } |
784 | 784 |
785 // We'll be leaking memory from this test. | 785 // We'll be leaking memory from this test. |
786 void DiskCacheBackendTest::BackendTrimInvalidEntry2() { | 786 void DiskCacheBackendTest::BackendTrimInvalidEntry2() { |
787 ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN(); | |
rvargas (doing something else)
2011/10/28 03:03:06
I'm assuming that it is fine if the test asserts a
kcc2
2011/10/28 03:15:32
If the test asserts and then exits -- fine.
But i
Timur Iskhodzhanov
2011/10/28 12:14:02
Assert indeed interrupts the test.
On 2011/10/28
| |
787 // Use the implementation directly... we need to simulate a crash. | 788 // Use the implementation directly... we need to simulate a crash. |
788 SetDirectMode(); | 789 SetDirectMode(); |
789 SetMask(0xf); // 16-entry table. | 790 SetMask(0xf); // 16-entry table. |
790 | 791 |
791 const int kSize = 0x3000; // 12 kB | 792 const int kSize = 0x3000; // 12 kB |
792 SetMaxSize(kSize * 40); | 793 SetMaxSize(kSize * 40); |
793 InitCache(); | 794 InitCache(); |
794 | 795 |
795 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); | 796 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); |
796 memset(buffer->data(), 0, kSize); | 797 memset(buffer->data(), 0, kSize); |
(...skipping 24 matching lines...) Expand all Loading... | |
821 if (new_eviction_) { | 822 if (new_eviction_) { |
822 EXPECT_EQ(net::OK, DoomAllEntries()); | 823 EXPECT_EQ(net::OK, DoomAllEntries()); |
823 } | 824 } |
824 | 825 |
825 entry->Close(); // Trim the cache. | 826 entry->Close(); // Trim the cache. |
826 FlushQueueForTest(); | 827 FlushQueueForTest(); |
827 | 828 |
828 // We may abort the eviction before cleaning up everything. | 829 // We may abort the eviction before cleaning up everything. |
829 MessageLoop::current()->RunAllPending(); | 830 MessageLoop::current()->RunAllPending(); |
830 FlushQueueForTest(); | 831 FlushQueueForTest(); |
831 EXPECT_GE(30, cache_->GetEntryCount()); | 832 EXPECT_GE(30, cache_->GetEntryCount()); |
Timur Iskhodzhanov
2011/10/28 12:14:02
ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN();
int cach
| |
833 ANNOTATE_IGNORE_READS_AND_WRITES_END(); | |
832 } | 834 } |
833 | 835 |
834 // We'll be leaking memory from this test. | 836 // We'll be leaking memory from this test. |
835 TEST_F(DiskCacheBackendTest, TrimInvalidEntry2) { | 837 TEST_F(DiskCacheBackendTest, TrimInvalidEntry2) { |
836 BackendTrimInvalidEntry2(); | 838 BackendTrimInvalidEntry2(); |
837 } | 839 } |
838 | 840 |
839 // We'll be leaking memory from this test. | 841 // We'll be leaking memory from this test. |
840 TEST_F(DiskCacheBackendTest, NewEvictionTrimInvalidEntry2) { | 842 TEST_F(DiskCacheBackendTest, NewEvictionTrimInvalidEntry2) { |
841 SetNewEviction(); | 843 SetNewEviction(); |
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2478 // Ping the oldest entry. | 2480 // Ping the oldest entry. |
2479 cache_->OnExternalCacheHit("key0"); | 2481 cache_->OnExternalCacheHit("key0"); |
2480 | 2482 |
2481 TrimForTest(false); | 2483 TrimForTest(false); |
2482 | 2484 |
2483 // Make sure the older key remains. | 2485 // Make sure the older key remains. |
2484 EXPECT_EQ(1, cache_->GetEntryCount()); | 2486 EXPECT_EQ(1, cache_->GetEntryCount()); |
2485 ASSERT_EQ(net::OK, OpenEntry("key0", &entry)); | 2487 ASSERT_EQ(net::OK, OpenEntry("key0", &entry)); |
2486 entry->Close(); | 2488 entry->Close(); |
2487 } | 2489 } |
OLD | NEW |