| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 #ifndef NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ | 5 #ifndef NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ |
| 6 #define NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ | 6 #define NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 void RunTaskForTest(Task* task); | 105 void RunTaskForTest(Task* task); |
| 106 int ReadData(disk_cache::Entry* entry, int index, int offset, | 106 int ReadData(disk_cache::Entry* entry, int index, int offset, |
| 107 net::IOBuffer* buf, int len); | 107 net::IOBuffer* buf, int len); |
| 108 int WriteData(disk_cache::Entry* entry, int index, int offset, | 108 int WriteData(disk_cache::Entry* entry, int index, int offset, |
| 109 net::IOBuffer* buf, int len, bool truncate); | 109 net::IOBuffer* buf, int len, bool truncate); |
| 110 int ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, | 110 int ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, |
| 111 int len); | 111 int len); |
| 112 int WriteSparseData(disk_cache::Entry* entry, int64 offset, | 112 int WriteSparseData(disk_cache::Entry* entry, int64 offset, |
| 113 net::IOBuffer* buf, int len); | 113 net::IOBuffer* buf, int len); |
| 114 | 114 |
| 115 // Asks the cache to trim a an entry. If |empty| is true, the whole entry is |
| 116 // deleted. |
| 117 void TrimForTest(bool empty); |
| 118 |
| 119 // Asks the cache to trim a an entry from the deleted list. If |empty| is |
| 120 // true, the whole entry is deleted. |
| 121 void TrimDeletedListForTest(bool empty); |
| 122 |
| 115 // cache_ will always have a valid object, regardless of how the cache was | 123 // cache_ will always have a valid object, regardless of how the cache was |
| 116 // initialized. The implementation pointers can be NULL. | 124 // initialized. The implementation pointers can be NULL. |
| 117 disk_cache::Backend* cache_; | 125 disk_cache::Backend* cache_; |
| 118 disk_cache::BackendImpl* cache_impl_; | 126 disk_cache::BackendImpl* cache_impl_; |
| 119 disk_cache::MemBackendImpl* mem_cache_; | 127 disk_cache::MemBackendImpl* mem_cache_; |
| 120 | 128 |
| 121 uint32 mask_; | 129 uint32 mask_; |
| 122 int size_; | 130 int size_; |
| 123 net::CacheType type_; | 131 net::CacheType type_; |
| 124 bool memory_only_; | 132 bool memory_only_; |
| 125 bool implementation_; | 133 bool implementation_; |
| 126 bool force_creation_; | 134 bool force_creation_; |
| 127 bool new_eviction_; | 135 bool new_eviction_; |
| 128 bool first_cleanup_; | 136 bool first_cleanup_; |
| 129 bool integrity_; | 137 bool integrity_; |
| 130 bool use_current_thread_; | 138 bool use_current_thread_; |
| 131 // This is intentionally left uninitialized, to be used by any test. | 139 // This is intentionally left uninitialized, to be used by any test. |
| 132 bool success_; | 140 bool success_; |
| 133 | 141 |
| 134 private: | 142 private: |
| 135 void InitMemoryCache(); | 143 void InitMemoryCache(); |
| 136 void InitDiskCache(); | 144 void InitDiskCache(); |
| 137 void InitDiskCacheImpl(const FilePath& path); | 145 void InitDiskCacheImpl(const FilePath& path); |
| 138 | 146 |
| 139 base::Thread cache_thread_; | 147 base::Thread cache_thread_; |
| 140 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); | 148 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); |
| 141 }; | 149 }; |
| 142 | 150 |
| 143 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ | 151 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ |
| OLD | NEW |