| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 2235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2246 TEST_F(DiskCacheTest, Backend_UsageStats) { | 2246 TEST_F(DiskCacheTest, Backend_UsageStats) { |
| 2247 MessageLoopHelper helper; | 2247 MessageLoopHelper helper; |
| 2248 | 2248 |
| 2249 ASSERT_TRUE(CleanupCacheDir()); | 2249 ASSERT_TRUE(CleanupCacheDir()); |
| 2250 scoped_ptr<disk_cache::BackendImpl> cache; | 2250 scoped_ptr<disk_cache::BackendImpl> cache; |
| 2251 cache.reset(new disk_cache::BackendImpl( | 2251 cache.reset(new disk_cache::BackendImpl( |
| 2252 cache_path_, base::MessageLoopProxy::current(), | 2252 cache_path_, base::MessageLoopProxy::current(), |
| 2253 NULL)); | 2253 NULL)); |
| 2254 ASSERT_TRUE(NULL != cache.get()); | 2254 ASSERT_TRUE(NULL != cache.get()); |
| 2255 cache->SetUnitTestMode(); | 2255 cache->SetUnitTestMode(); |
| 2256 ASSERT_EQ(net::OK, cache->SyncInit()); | 2256 ASSERT_EQ(net::OK, cache->SyncInit(NULL)); |
| 2257 | 2257 |
| 2258 // Wait for a callback that never comes... about 2 secs :). The message loop | 2258 // Wait for a callback that never comes... about 2 secs :). The message loop |
| 2259 // has to run to allow invocation of the usage timer. | 2259 // has to run to allow invocation of the usage timer. |
| 2260 helper.WaitUntilCacheIoFinished(1); | 2260 helper.WaitUntilCacheIoFinished(1); |
| 2261 } | 2261 } |
| 2262 | 2262 |
| 2263 void DiskCacheBackendTest::BackendDoomAll() { | 2263 void DiskCacheBackendTest::BackendDoomAll() { |
| 2264 InitCache(); | 2264 InitCache(); |
| 2265 | 2265 |
| 2266 disk_cache::Entry *entry1, *entry2; | 2266 disk_cache::Entry *entry1, *entry2; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 // Ping the oldest entry. | 2568 // Ping the oldest entry. |
| 2569 cache_->OnExternalCacheHit("key0"); | 2569 cache_->OnExternalCacheHit("key0"); |
| 2570 | 2570 |
| 2571 TrimForTest(false); | 2571 TrimForTest(false); |
| 2572 | 2572 |
| 2573 // Make sure the older key remains. | 2573 // Make sure the older key remains. |
| 2574 EXPECT_EQ(1, cache_->GetEntryCount()); | 2574 EXPECT_EQ(1, cache_->GetEntryCount()); |
| 2575 ASSERT_EQ(net::OK, OpenEntry("key0", &entry)); | 2575 ASSERT_EQ(net::OK, OpenEntry("key0", &entry)); |
| 2576 entry->Close(); | 2576 entry->Close(); |
| 2577 } | 2577 } |
| OLD | NEW |