| Index: net/http/http_cache_unittest.cc
|
| diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
|
| index 0c0ff6f966bfd888f7c0ca1bf28cc18e9f432011..93f7476f03939445ec7531f4ed8d8c8d8752db2e 100644
|
| --- a/net/http/http_cache_unittest.cc
|
| +++ b/net/http/http_cache_unittest.cc
|
| @@ -11,6 +11,7 @@
|
| #include "base/stringprintf.h"
|
| #include "net/base/cache_type.h"
|
| #include "net/base/cert_status_flags.h"
|
| +#include "net/base/completion_callback.h"
|
| #include "net/base/host_port_pair.h"
|
| #include "net/base/load_flags.h"
|
| #include "net/base/net_errors.h"
|
| @@ -32,18 +33,27 @@ using base::Time;
|
|
|
| namespace {
|
|
|
| -class DeleteCacheOldCompletionCallback : public TestOldCompletionCallback {
|
| +class DeleteCacheCompletionCallback : public TestCompletionCallbackBase {
|
| public:
|
| - explicit DeleteCacheOldCompletionCallback(MockHttpCache* cache)
|
| - : cache_(cache) {}
|
| + explicit DeleteCacheCompletionCallback(MockHttpCache* cache)
|
| + : cache_(cache),
|
| + ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
|
| + base::Bind(&DeleteCacheCompletionCallback::OnComplete,
|
| + base::Unretained(this)))) {
|
| + }
|
| +
|
| + const net::CompletionCallback& callback() const { return callback_; }
|
|
|
| - virtual void RunWithParams(const Tuple1<int>& params) {
|
| + private:
|
| + void OnComplete(int result) {
|
| delete cache_;
|
| - TestOldCompletionCallback::RunWithParams(params);
|
| + SetResult(result);
|
| }
|
|
|
| - private:
|
| MockHttpCache* cache_;
|
| + const net::CompletionCallback callback_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DeleteCacheCompletionCallback);
|
| };
|
|
|
| //-----------------------------------------------------------------------------
|
| @@ -395,9 +405,9 @@ TEST(HttpCache, GetBackend) {
|
| MockHttpCache cache(net::HttpCache::DefaultBackend::InMemory(0));
|
|
|
| disk_cache::Backend* backend;
|
| - TestOldCompletionCallback cb;
|
| + net::TestCompletionCallback cb;
|
| // This will lazily initialize the backend.
|
| - int rv = cache.http_cache()->GetBackend(&backend, &cb);
|
| + int rv = cache.http_cache()->GetBackend(&backend, cb.callback());
|
| EXPECT_EQ(net::OK, cb.GetResult(rv));
|
| }
|
|
|
| @@ -1465,9 +1475,9 @@ TEST(HttpCache, DeleteCacheWaitingForBackend2) {
|
| MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
|
| MockHttpCache* cache = new MockHttpCache(factory);
|
|
|
| - DeleteCacheOldCompletionCallback cb(cache);
|
| + DeleteCacheCompletionCallback cb(cache);
|
| disk_cache::Backend* backend;
|
| - int rv = cache->http_cache()->GetBackend(&backend, &cb);
|
| + int rv = cache->http_cache()->GetBackend(&backend, cb.callback());
|
| EXPECT_EQ(net::ERR_IO_PENDING, rv);
|
|
|
| // Now let's queue a regular transaction
|
| @@ -1480,8 +1490,8 @@ TEST(HttpCache, DeleteCacheWaitingForBackend2) {
|
| c->trans->Start(&request, &c->callback, net::BoundNetLog());
|
|
|
| // And another direct backend request.
|
| - TestOldCompletionCallback cb2;
|
| - rv = cache->http_cache()->GetBackend(&backend, &cb2);
|
| + net::TestCompletionCallback cb2;
|
| + rv = cache->http_cache()->GetBackend(&backend, cb2.callback());
|
| EXPECT_EQ(net::ERR_IO_PENDING, rv);
|
|
|
| // Just to make sure that everything is still pending.
|
|
|