| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Utility methods to access the cache and wait for each operation to finish. | 126 // Utility methods to access the cache and wait for each operation to finish. |
| 127 int OpenEntry(const std::string& key, disk_cache::Entry** entry); | 127 int OpenEntry(const std::string& key, disk_cache::Entry** entry); |
| 128 int CreateEntry(const std::string& key, disk_cache::Entry** entry); | 128 int CreateEntry(const std::string& key, disk_cache::Entry** entry); |
| 129 int DoomEntry(const std::string& key); | 129 int DoomEntry(const std::string& key); |
| 130 int DoomAllEntries(); | 130 int DoomAllEntries(); |
| 131 int DoomEntriesBetween(const base::Time initial_time, | 131 int DoomEntriesBetween(const base::Time initial_time, |
| 132 const base::Time end_time); | 132 const base::Time end_time); |
| 133 int CalculateSizeOfAllEntries(); | 133 int CalculateSizeOfAllEntries(); |
| 134 int CalculateSizeOfEntriesBetween(const base::Time initial_time, |
| 135 const base::Time end_time); |
| 134 int DoomEntriesSince(const base::Time initial_time); | 136 int DoomEntriesSince(const base::Time initial_time); |
| 135 std::unique_ptr<TestIterator> CreateIterator(); | 137 std::unique_ptr<TestIterator> CreateIterator(); |
| 136 void FlushQueueForTest(); | 138 void FlushQueueForTest(); |
| 137 void RunTaskForTest(const base::Closure& closure); | 139 void RunTaskForTest(const base::Closure& closure); |
| 138 int ReadData(disk_cache::Entry* entry, int index, int offset, | 140 int ReadData(disk_cache::Entry* entry, int index, int offset, |
| 139 net::IOBuffer* buf, int len); | 141 net::IOBuffer* buf, int len); |
| 140 int WriteData(disk_cache::Entry* entry, int index, int offset, | 142 int WriteData(disk_cache::Entry* entry, int index, int offset, |
| 141 net::IOBuffer* buf, int len, bool truncate); | 143 net::IOBuffer* buf, int len, bool truncate); |
| 142 int ReadSparseData(disk_cache::Entry* entry, | 144 int ReadSparseData(disk_cache::Entry* entry, |
| 143 int64_t offset, | 145 int64_t offset, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 188 |
| 187 private: | 189 private: |
| 188 void InitMemoryCache(); | 190 void InitMemoryCache(); |
| 189 void InitDiskCache(); | 191 void InitDiskCache(); |
| 190 | 192 |
| 191 base::Thread cache_thread_; | 193 base::Thread cache_thread_; |
| 192 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); | 194 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); |
| 193 }; | 195 }; |
| 194 | 196 |
| 195 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ | 197 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ |
| OLD | NEW |