Index: net/http/mock_http_cache.cc |
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc |
index 5dbd486df0ff551c2dd6237e004edfab8d941df0..75c0476244cf72e3dfe726431b969c0f62e339eb 100644 |
--- a/net/http/mock_http_cache.cc |
+++ b/net/http/mock_http_cache.cc |
@@ -384,6 +384,25 @@ int MockDiskCache::OpenEntry(const std::string& key, disk_cache::Entry** entry, |
return net::ERR_IO_PENDING; |
} |
+int MockDiskCache::OpenDoomedEntry(const std::string& key, |
+ disk_cache::Entry** entry, |
+ const net::CompletionCallback& callback) { |
+ DCHECK(!callback.is_null()); |
+ |
+ EntryMap::iterator it = entries_.find(key); |
+ if (it == entries_.end()) |
+ return net::ERR_CACHE_OPEN_FAILURE; |
+ if (!it->second->is_doomed()) |
+ return net::ERR_CACHE_OPEN_FAILURE; |
+ |
+ it->second->AddRef(); |
+ *entry = it->second; |
+ |
+ CallbackLater(callback, net::OK); |
+ |
+ return net::ERR_IO_PENDING; |
+} |
+ |
int MockDiskCache::CreateEntry(const std::string& key, |
disk_cache::Entry** entry, |
const net::CompletionCallback& callback) { |
@@ -556,6 +575,13 @@ bool MockHttpCache::OpenBackendEntry(const std::string& key, |
return (cb.GetResult(rv) == net::OK); |
} |
+bool MockHttpCache::OpenBackendDoomedEntry(const std::string& key, |
+ disk_cache::Entry** entry) { |
+ net::TestCompletionCallback cb; |
+ int rv = disk_cache()->OpenDoomedEntry(key, entry, cb.callback()); |
+ return (cb.GetResult(rv) == net::OK); |
+} |
+ |
bool MockHttpCache::CreateBackendEntry(const std::string& key, |
disk_cache::Entry** entry, |
net::NetLog* net_log) { |