Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1273)

Unified Diff: net/http/mock_http_cache.cc

Issue 956433002: Introduce MockHttpCache::backend() and move a few callers to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/mock_http_cache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/mock_http_cache.cc
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc
index 8b8d37878b9b95f34ce66baf97a94412733f619d..a423a04ace77552fdb640d9e311c4df6b6fab452 100644
--- a/net/http/mock_http_cache.cc
+++ b/net/http/mock_http_cache.cc
@@ -508,12 +508,16 @@ MockHttpCache::MockHttpCache(net::HttpCache::BackendFactory* disk_cache_factory)
: http_cache_(new MockNetworkLayer(), NULL, disk_cache_factory) {
}
-MockDiskCache* MockHttpCache::disk_cache() {
+disk_cache::Backend* MockHttpCache::backend() {
net::TestCompletionCallback cb;
disk_cache::Backend* backend;
int rv = http_cache_.GetBackend(&backend, cb.callback());
rv = cb.GetResult(rv);
- return (rv == net::OK) ? static_cast<MockDiskCache*>(backend) : NULL;
+ return (rv == net::OK) ? backend : NULL;
+}
+
+MockDiskCache* MockHttpCache::disk_cache() {
+ return static_cast<MockDiskCache*>(backend());
}
int MockHttpCache::CreateTransaction(scoped_ptr<net::HttpTransaction>* trans) {
@@ -564,7 +568,7 @@ bool MockHttpCache::WriteResponseInfo(
bool MockHttpCache::OpenBackendEntry(const std::string& key,
disk_cache::Entry** entry) {
net::TestCompletionCallback cb;
- int rv = disk_cache()->OpenEntry(key, entry, cb.callback());
+ int rv = backend()->OpenEntry(key, entry, cb.callback());
return (cb.GetResult(rv) == net::OK);
}
@@ -572,7 +576,7 @@ bool MockHttpCache::CreateBackendEntry(const std::string& key,
disk_cache::Entry** entry,
net::NetLog* net_log) {
net::TestCompletionCallback cb;
- int rv = disk_cache()->CreateEntry(key, entry, cb.callback());
+ int rv = backend()->CreateEntry(key, entry, cb.callback());
return (cb.GetResult(rv) == net::OK);
}
« no previous file with comments | « net/http/mock_http_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698