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 "net/disk_cache/disk_cache_test_base.h" | 5 #include "net/disk_cache/disk_cache_test_base.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 DiskCacheTestWithCache::~DiskCacheTestWithCache() {} | 68 DiskCacheTestWithCache::~DiskCacheTestWithCache() {} |
69 | 69 |
70 void DiskCacheTestWithCache::InitCache() { | 70 void DiskCacheTestWithCache::InitCache() { |
71 if (memory_only_) | 71 if (memory_only_) |
72 InitMemoryCache(); | 72 InitMemoryCache(); |
73 else | 73 else |
74 InitDiskCache(); | 74 InitDiskCache(); |
75 | 75 |
76 ASSERT_TRUE(NULL != cache_); | 76 ASSERT_TRUE(NULL != cache_); |
77 if (first_cleanup_) | 77 // TODO(pasko): enable Entry Count for the Simple Cache. |
| 78 if (first_cleanup_ && !simple_cache_mode_) |
78 ASSERT_EQ(0, cache_->GetEntryCount()); | 79 ASSERT_EQ(0, cache_->GetEntryCount()); |
79 } | 80 } |
80 | 81 |
81 // We are expected to leak memory when simulating crashes. | 82 // We are expected to leak memory when simulating crashes. |
82 void DiskCacheTestWithCache::SimulateCrash() { | 83 void DiskCacheTestWithCache::SimulateCrash() { |
83 ASSERT_TRUE(!memory_only_); | 84 ASSERT_TRUE(!memory_only_); |
84 net::TestCompletionCallback cb; | 85 net::TestCompletionCallback cb; |
85 int rv = cache_impl_->FlushQueueForTest(cb.callback()); | 86 int rv = cache_impl_->FlushQueueForTest(cb.callback()); |
86 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 87 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
87 cache_impl_->ClearRefCountForTest(); | 88 cache_impl_->ClearRefCountForTest(); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); | 288 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); |
288 if (new_eviction_) | 289 if (new_eviction_) |
289 cache_impl_->SetNewEviction(); | 290 cache_impl_->SetNewEviction(); |
290 cache_impl_->SetType(type_); | 291 cache_impl_->SetType(type_); |
291 cache_impl_->SetFlags(flags); | 292 cache_impl_->SetFlags(flags); |
292 net::TestCompletionCallback cb; | 293 net::TestCompletionCallback cb; |
293 int rv = cache_impl_->Init(cb.callback()); | 294 int rv = cache_impl_->Init(cb.callback()); |
294 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 295 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
295 cache_ = cache_impl_; | 296 cache_ = cache_impl_; |
296 } | 297 } |
OLD | NEW |