| OLD | NEW |
| 1 // Copyright (c) 2006-2010 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 #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" |
| 11 #include "net/base/cache_type.h" | 11 #include "net/base/cache_type.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void RunTaskForTest(Task* task); | 100 void RunTaskForTest(Task* task); |
| 101 int ReadData(disk_cache::Entry* entry, int index, int offset, | 101 int ReadData(disk_cache::Entry* entry, int index, int offset, |
| 102 net::IOBuffer* buf, int len); | 102 net::IOBuffer* buf, int len); |
| 103 int WriteData(disk_cache::Entry* entry, int index, int offset, | 103 int WriteData(disk_cache::Entry* entry, int index, int offset, |
| 104 net::IOBuffer* buf, int len, bool truncate); | 104 net::IOBuffer* buf, int len, bool truncate); |
| 105 int ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, | 105 int ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, |
| 106 int len); | 106 int len); |
| 107 int WriteSparseData(disk_cache::Entry* entry, int64 offset, | 107 int WriteSparseData(disk_cache::Entry* entry, int64 offset, |
| 108 net::IOBuffer* buf, int len); | 108 net::IOBuffer* buf, int len); |
| 109 | 109 |
| 110 // Asks the cache to trim a an entry. If |empty| is true, the whole entry is | 110 // Asks the cache to trim an entry. If |empty| is true, the whole cache is |
| 111 // deleted. | 111 // deleted. |
| 112 void TrimForTest(bool empty); | 112 void TrimForTest(bool empty); |
| 113 | 113 |
| 114 // Asks the cache to trim a an entry from the deleted list. If |empty| is | 114 // Asks the cache to trim an entry from the deleted list. If |empty| is |
| 115 // true, the whole entry is deleted. | 115 // true, the whole list is deleted. |
| 116 void TrimDeletedListForTest(bool empty); | 116 void TrimDeletedListForTest(bool empty); |
| 117 | 117 |
| 118 // DiskCacheTest: | 118 // DiskCacheTest: |
| 119 virtual void TearDown(); | 119 virtual void TearDown(); |
| 120 | 120 |
| 121 // cache_ will always have a valid object, regardless of how the cache was | 121 // cache_ will always have a valid object, regardless of how the cache was |
| 122 // initialized. The implementation pointers can be NULL. | 122 // initialized. The implementation pointers can be NULL. |
| 123 disk_cache::Backend* cache_; | 123 disk_cache::Backend* cache_; |
| 124 disk_cache::BackendImpl* cache_impl_; | 124 disk_cache::BackendImpl* cache_impl_; |
| 125 disk_cache::MemBackendImpl* mem_cache_; | 125 disk_cache::MemBackendImpl* mem_cache_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 140 private: | 140 private: |
| 141 void InitMemoryCache(); | 141 void InitMemoryCache(); |
| 142 void InitDiskCache(); | 142 void InitDiskCache(); |
| 143 void InitDiskCacheImpl(const FilePath& path); | 143 void InitDiskCacheImpl(const FilePath& path); |
| 144 | 144 |
| 145 base::Thread cache_thread_; | 145 base::Thread cache_thread_; |
| 146 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); | 146 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ | 149 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ |
| OLD | NEW |