| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 bool delayed_; | 89 bool delayed_; |
| 90 static bool cancel_; | 90 static bool cancel_; |
| 91 static bool ignore_callbacks_; | 91 static bool ignore_callbacks_; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 class MockDiskCache : public disk_cache::Backend { | 94 class MockDiskCache : public disk_cache::Backend { |
| 95 public: | 95 public: |
| 96 MockDiskCache(); | 96 MockDiskCache(); |
| 97 virtual ~MockDiskCache(); | 97 virtual ~MockDiskCache(); |
| 98 | 98 |
| 99 virtual net::CacheType GetCacheType() const OVERRIDE; |
| 99 virtual int32 GetEntryCount() const OVERRIDE; | 100 virtual int32 GetEntryCount() const OVERRIDE; |
| 100 virtual int OpenEntry(const std::string& key, disk_cache::Entry** entry, | 101 virtual int OpenEntry(const std::string& key, disk_cache::Entry** entry, |
| 101 const net::CompletionCallback& callback) OVERRIDE; | 102 const net::CompletionCallback& callback) OVERRIDE; |
| 102 virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, | 103 virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, |
| 103 const net::CompletionCallback& callback) OVERRIDE; | 104 const net::CompletionCallback& callback) OVERRIDE; |
| 104 virtual int DoomEntry(const std::string& key, | 105 virtual int DoomEntry(const std::string& key, |
| 105 const net::CompletionCallback& callback) OVERRIDE; | 106 const net::CompletionCallback& callback) OVERRIDE; |
| 106 virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE; | 107 virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE; |
| 107 virtual int DoomEntriesBetween( | 108 virtual int DoomEntriesBetween( |
| 108 const base::Time initial_time, | 109 const base::Time initial_time, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 private: | 232 private: |
| 232 int Result() { return fail_ ? net::ERR_FAILED : net::OK; } | 233 int Result() { return fail_ ? net::ERR_FAILED : net::OK; } |
| 233 | 234 |
| 234 disk_cache::Backend** backend_; | 235 disk_cache::Backend** backend_; |
| 235 net::CompletionCallback callback_; | 236 net::CompletionCallback callback_; |
| 236 bool block_; | 237 bool block_; |
| 237 bool fail_; | 238 bool fail_; |
| 238 }; | 239 }; |
| 239 | 240 |
| 240 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ | 241 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ |
| OLD | NEW |