| 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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 if (new_eviction_) { | 821 if (new_eviction_) { |
| 822 EXPECT_EQ(net::OK, DoomAllEntries()); | 822 EXPECT_EQ(net::OK, DoomAllEntries()); |
| 823 } | 823 } |
| 824 | 824 |
| 825 entry->Close(); // Trim the cache. | 825 entry->Close(); // Trim the cache. |
| 826 FlushQueueForTest(); | 826 FlushQueueForTest(); |
| 827 | 827 |
| 828 // We may abort the eviction before cleaning up everything. | 828 // We may abort the eviction before cleaning up everything. |
| 829 MessageLoop::current()->RunAllPending(); | 829 MessageLoop::current()->RunAllPending(); |
| 830 FlushQueueForTest(); | 830 FlushQueueForTest(); |
| 831 ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN(); |
| 831 EXPECT_GE(30, cache_->GetEntryCount()); | 832 EXPECT_GE(30, cache_->GetEntryCount()); |
| 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 |