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

Unified Diff: net/http/http_cache_unittest.cc

Issue 8794003: base::Bind: Convert disk_cache_based_ssl_host_info. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fix. Created 9 years 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
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.
« net/http/http_cache.cc ('K') | « net/http/http_cache.cc ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698