| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "net/base/cache_type.h" | 13 #include "net/base/cache_type.h" |
| 14 #include "net/disk_cache/disk_cache.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "testing/platform_test.h" | 16 #include "testing/platform_test.h" |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 | 19 |
| 19 class IOBuffer; | 20 class IOBuffer; |
| 20 | 21 |
| 21 } // namespace net | 22 } // namespace net |
| 22 | 23 |
| 23 namespace disk_cache { | 24 namespace disk_cache { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 111 } |
| 111 | 112 |
| 112 // Utility methods to access the cache and wait for each operation to finish. | 113 // Utility methods to access the cache and wait for each operation to finish. |
| 113 int OpenEntry(const std::string& key, disk_cache::Entry** entry); | 114 int OpenEntry(const std::string& key, disk_cache::Entry** entry); |
| 114 int CreateEntry(const std::string& key, disk_cache::Entry** entry); | 115 int CreateEntry(const std::string& key, disk_cache::Entry** entry); |
| 115 int DoomEntry(const std::string& key); | 116 int DoomEntry(const std::string& key); |
| 116 int DoomAllEntries(); | 117 int DoomAllEntries(); |
| 117 int DoomEntriesBetween(const base::Time initial_time, | 118 int DoomEntriesBetween(const base::Time initial_time, |
| 118 const base::Time end_time); | 119 const base::Time end_time); |
| 119 int DoomEntriesSince(const base::Time initial_time); | 120 int DoomEntriesSince(const base::Time initial_time); |
| 120 int OpenNextEntry(void** iter, disk_cache::Entry** next_entry); | 121 int OpenNextEntry(disk_cache::Backend::Iterator* iter, |
| 122 disk_cache::Entry** next_entry); |
| 121 void FlushQueueForTest(); | 123 void FlushQueueForTest(); |
| 122 void RunTaskForTest(const base::Closure& closure); | 124 void RunTaskForTest(const base::Closure& closure); |
| 123 int ReadData(disk_cache::Entry* entry, int index, int offset, | 125 int ReadData(disk_cache::Entry* entry, int index, int offset, |
| 124 net::IOBuffer* buf, int len); | 126 net::IOBuffer* buf, int len); |
| 125 int WriteData(disk_cache::Entry* entry, int index, int offset, | 127 int WriteData(disk_cache::Entry* entry, int index, int offset, |
| 126 net::IOBuffer* buf, int len, bool truncate); | 128 net::IOBuffer* buf, int len, bool truncate); |
| 127 int ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, | 129 int ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, |
| 128 int len); | 130 int len); |
| 129 int WriteSparseData(disk_cache::Entry* entry, int64 offset, | 131 int WriteSparseData(disk_cache::Entry* entry, int64 offset, |
| 130 net::IOBuffer* buf, int len); | 132 net::IOBuffer* buf, int len); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 169 |
| 168 private: | 170 private: |
| 169 void InitMemoryCache(); | 171 void InitMemoryCache(); |
| 170 void InitDiskCache(); | 172 void InitDiskCache(); |
| 171 | 173 |
| 172 base::Thread cache_thread_; | 174 base::Thread cache_thread_; |
| 173 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); | 175 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); |
| 174 }; | 176 }; |
| 175 | 177 |
| 176 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ | 178 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ |
| OLD | NEW |