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 // TODO(pasko): enable Entry Count for the Simple Cache. | 77 if (first_cleanup_) |
78 if (first_cleanup_ && !simple_cache_mode_) | |
79 ASSERT_EQ(0, cache_->GetEntryCount()); | 78 ASSERT_EQ(0, cache_->GetEntryCount()); |
80 } | 79 } |
81 | 80 |
82 // We are expected to leak memory when simulating crashes. | 81 // We are expected to leak memory when simulating crashes. |
83 void DiskCacheTestWithCache::SimulateCrash() { | 82 void DiskCacheTestWithCache::SimulateCrash() { |
84 ASSERT_TRUE(!memory_only_); | 83 ASSERT_TRUE(!memory_only_); |
85 net::TestCompletionCallback cb; | 84 net::TestCompletionCallback cb; |
86 int rv = cache_impl_->FlushQueueForTest(cb.callback()); | 85 int rv = cache_impl_->FlushQueueForTest(cb.callback()); |
87 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 86 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
88 cache_impl_->ClearRefCountForTest(); | 87 cache_impl_->ClearRefCountForTest(); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); | 287 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); |
289 if (new_eviction_) | 288 if (new_eviction_) |
290 cache_impl_->SetNewEviction(); | 289 cache_impl_->SetNewEviction(); |
291 cache_impl_->SetType(type_); | 290 cache_impl_->SetType(type_); |
292 cache_impl_->SetFlags(flags); | 291 cache_impl_->SetFlags(flags); |
293 net::TestCompletionCallback cb; | 292 net::TestCompletionCallback cb; |
294 int rv = cache_impl_->Init(cb.callback()); | 293 int rv = cache_impl_->Init(cb.callback()); |
295 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 294 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
296 cache_ = cache_impl_; | 295 cache_ = cache_impl_; |
297 } | 296 } |
OLD | NEW |