| OLD | NEW |
| 1 // Copyright (c) 2011 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 // This is a mock of the http cache and related testing classes. To be fair, it | 5 // This is a mock of the http cache and related testing classes. To be fair, it |
| 6 // is not really a mock http cache given that it uses the real implementation of | 6 // is not really a mock http cache given that it uses the real implementation of |
| 7 // the http cache, but it has fake implementations of all required components, | 7 // the http cache, but it has fake implementations of all required components, |
| 8 // so it is useful for unit tests at the http layer. | 8 // so it is useful for unit tests at the http layer. |
| 9 | 9 |
| 10 #ifndef NET_HTTP_MOCK_HTTP_CACHE_H_ | 10 #ifndef NET_HTTP_MOCK_HTTP_CACHE_H_ |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 net::OldCompletionCallback* callback) OVERRIDE; | 108 net::OldCompletionCallback* callback) OVERRIDE; |
| 109 virtual int OpenEntry(const std::string& key, disk_cache::Entry** entry, | 109 virtual int OpenEntry(const std::string& key, disk_cache::Entry** entry, |
| 110 const net::CompletionCallback& callback) OVERRIDE; | 110 const net::CompletionCallback& callback) OVERRIDE; |
| 111 virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, | 111 virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, |
| 112 net::OldCompletionCallback* callback) OVERRIDE; | 112 net::OldCompletionCallback* callback) OVERRIDE; |
| 113 virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, | 113 virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, |
| 114 const net::CompletionCallback& callback) OVERRIDE; | 114 const net::CompletionCallback& callback) OVERRIDE; |
| 115 virtual int DoomEntry(const std::string& key, | 115 virtual int DoomEntry(const std::string& key, |
| 116 net::OldCompletionCallback* callback) OVERRIDE; | 116 net::OldCompletionCallback* callback) OVERRIDE; |
| 117 virtual int DoomAllEntries(net::OldCompletionCallback* callback) OVERRIDE; | 117 virtual int DoomAllEntries(net::OldCompletionCallback* callback) OVERRIDE; |
| 118 virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE; |
| 118 virtual int DoomEntriesBetween(const base::Time initial_time, | 119 virtual int DoomEntriesBetween(const base::Time initial_time, |
| 119 const base::Time end_time, | 120 const base::Time end_time, |
| 120 net::OldCompletionCallback* callback) OVERRIDE; | 121 net::OldCompletionCallback* callback) OVERRIDE; |
| 122 virtual int DoomEntriesBetween( |
| 123 const base::Time initial_time, |
| 124 const base::Time end_time, |
| 125 const net::CompletionCallback& callback) OVERRIDE; |
| 121 virtual int DoomEntriesSince(const base::Time initial_time, | 126 virtual int DoomEntriesSince(const base::Time initial_time, |
| 122 net::OldCompletionCallback* callback) OVERRIDE; | 127 net::OldCompletionCallback* callback) OVERRIDE; |
| 123 virtual int OpenNextEntry(void** iter, disk_cache::Entry** next_entry, | 128 virtual int OpenNextEntry(void** iter, disk_cache::Entry** next_entry, |
| 124 net::OldCompletionCallback* callback) OVERRIDE; | 129 net::OldCompletionCallback* callback) OVERRIDE; |
| 125 virtual void EndEnumeration(void** iter) OVERRIDE; | 130 virtual void EndEnumeration(void** iter) OVERRIDE; |
| 126 virtual void GetStats( | 131 virtual void GetStats( |
| 127 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; | 132 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; |
| 128 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; | 133 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; |
| 129 | 134 |
| 130 // Returns number of times a cache entry was successfully opened. | 135 // Returns number of times a cache entry was successfully opened. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 private: | 245 private: |
| 241 int Result() { return fail_ ? net::ERR_FAILED : net::OK; } | 246 int Result() { return fail_ ? net::ERR_FAILED : net::OK; } |
| 242 | 247 |
| 243 disk_cache::Backend** backend_; | 248 disk_cache::Backend** backend_; |
| 244 net::OldCompletionCallback* callback_; | 249 net::OldCompletionCallback* callback_; |
| 245 bool block_; | 250 bool block_; |
| 246 bool fail_; | 251 bool fail_; |
| 247 }; | 252 }; |
| 248 | 253 |
| 249 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ | 254 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ |
| OLD | NEW |