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 #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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 type_ = type; | 121 type_ = type; |
122 } | 122 } |
123 | 123 |
124 // Utility methods to access the cache and wait for each operation to finish. | 124 // Utility methods to access the cache and wait for each operation to finish. |
125 int OpenEntry(const std::string& key, disk_cache::Entry** entry); | 125 int OpenEntry(const std::string& key, disk_cache::Entry** entry); |
126 int CreateEntry(const std::string& key, disk_cache::Entry** entry); | 126 int CreateEntry(const std::string& key, disk_cache::Entry** entry); |
127 int DoomEntry(const std::string& key); | 127 int DoomEntry(const std::string& key); |
128 int DoomAllEntries(); | 128 int DoomAllEntries(); |
129 int DoomEntriesBetween(const base::Time initial_time, | 129 int DoomEntriesBetween(const base::Time initial_time, |
130 const base::Time end_time); | 130 const base::Time end_time); |
| 131 int CalculateSizeOfAllEntries(); |
131 int DoomEntriesSince(const base::Time initial_time); | 132 int DoomEntriesSince(const base::Time initial_time); |
132 scoped_ptr<TestIterator> CreateIterator(); | 133 scoped_ptr<TestIterator> CreateIterator(); |
133 void FlushQueueForTest(); | 134 void FlushQueueForTest(); |
134 void RunTaskForTest(const base::Closure& closure); | 135 void RunTaskForTest(const base::Closure& closure); |
135 int ReadData(disk_cache::Entry* entry, int index, int offset, | 136 int ReadData(disk_cache::Entry* entry, int index, int offset, |
136 net::IOBuffer* buf, int len); | 137 net::IOBuffer* buf, int len); |
137 int WriteData(disk_cache::Entry* entry, int index, int offset, | 138 int WriteData(disk_cache::Entry* entry, int index, int offset, |
138 net::IOBuffer* buf, int len, bool truncate); | 139 net::IOBuffer* buf, int len, bool truncate); |
139 int ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, | 140 int ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, |
140 int len); | 141 int len); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 180 |
180 private: | 181 private: |
181 void InitMemoryCache(); | 182 void InitMemoryCache(); |
182 void InitDiskCache(); | 183 void InitDiskCache(); |
183 | 184 |
184 base::Thread cache_thread_; | 185 base::Thread cache_thread_; |
185 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); | 186 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); |
186 }; | 187 }; |
187 | 188 |
188 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ | 189 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ |
OLD | NEW |