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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 virtual int DoomEntry(const std::string& key, | 107 virtual int DoomEntry(const std::string& key, |
108 const net::CompletionCallback& callback) OVERRIDE; | 108 const net::CompletionCallback& callback) OVERRIDE; |
109 virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE; | 109 virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE; |
110 virtual int DoomEntriesBetween( | 110 virtual int DoomEntriesBetween( |
111 base::Time initial_time, | 111 base::Time initial_time, |
112 base::Time end_time, | 112 base::Time end_time, |
113 const net::CompletionCallback& callback) OVERRIDE; | 113 const net::CompletionCallback& callback) OVERRIDE; |
114 virtual int DoomEntriesSince( | 114 virtual int DoomEntriesSince( |
115 base::Time initial_time, | 115 base::Time initial_time, |
116 const net::CompletionCallback& callback) OVERRIDE; | 116 const net::CompletionCallback& callback) OVERRIDE; |
117 virtual int OpenNextEntry(void** iter, disk_cache::Entry** next_entry, | 117 virtual scoped_ptr<Iterator> CreateIterator() OVERRIDE; |
118 const net::CompletionCallback& callback) OVERRIDE; | |
119 virtual void EndEnumeration(void** iter) OVERRIDE; | |
120 virtual void GetStats( | 118 virtual void GetStats( |
121 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; | 119 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; |
122 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; | 120 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; |
123 | 121 |
124 // Returns number of times a cache entry was successfully opened. | 122 // Returns number of times a cache entry was successfully opened. |
125 int open_count() const { return open_count_; } | 123 int open_count() const { return open_count_; } |
126 | 124 |
127 // Returns number of times a cache entry was successfully created. | 125 // Returns number of times a cache entry was successfully created. |
128 int create_count() const { return create_count_; } | 126 int create_count() const { return create_count_; } |
129 | 127 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 private: | 242 private: |
245 int Result() { return fail_ ? net::ERR_FAILED : net::OK; } | 243 int Result() { return fail_ ? net::ERR_FAILED : net::OK; } |
246 | 244 |
247 scoped_ptr<disk_cache::Backend>* backend_; | 245 scoped_ptr<disk_cache::Backend>* backend_; |
248 net::CompletionCallback callback_; | 246 net::CompletionCallback callback_; |
249 bool block_; | 247 bool block_; |
250 bool fail_; | 248 bool fail_; |
251 }; | 249 }; |
252 | 250 |
253 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ | 251 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ |
OLD | NEW |