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

Unified Diff: net/http/http_cache_unittest.cc

Issue 8832006: Reverts a commit that caused ASAN failures, and 2 dependent commits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « net/http/http_cache.cc ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache_unittest.cc
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 93f7476f03939445ec7531f4ed8d8c8d8752db2e..0c0ff6f966bfd888f7c0ca1bf28cc18e9f432011 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -11,7 +11,6 @@
#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"
@@ -33,27 +32,18 @@ using base::Time;
namespace {
-class DeleteCacheCompletionCallback : public TestCompletionCallbackBase {
+class DeleteCacheOldCompletionCallback : public TestOldCompletionCallback {
public:
- 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_; }
+ explicit DeleteCacheOldCompletionCallback(MockHttpCache* cache)
+ : cache_(cache) {}
- private:
- void OnComplete(int result) {
+ virtual void RunWithParams(const Tuple1<int>& params) {
delete cache_;
- SetResult(result);
+ TestOldCompletionCallback::RunWithParams(params);
}
+ private:
MockHttpCache* cache_;
- const net::CompletionCallback callback_;
-
- DISALLOW_COPY_AND_ASSIGN(DeleteCacheCompletionCallback);
};
//-----------------------------------------------------------------------------
@@ -405,9 +395,9 @@ TEST(HttpCache, GetBackend) {
MockHttpCache cache(net::HttpCache::DefaultBackend::InMemory(0));
disk_cache::Backend* backend;
- net::TestCompletionCallback cb;
+ TestOldCompletionCallback cb;
// This will lazily initialize the backend.
- int rv = cache.http_cache()->GetBackend(&backend, cb.callback());
+ int rv = cache.http_cache()->GetBackend(&backend, &cb);
EXPECT_EQ(net::OK, cb.GetResult(rv));
}
@@ -1475,9 +1465,9 @@ TEST(HttpCache, DeleteCacheWaitingForBackend2) {
MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
MockHttpCache* cache = new MockHttpCache(factory);
- DeleteCacheCompletionCallback cb(cache);
+ DeleteCacheOldCompletionCallback cb(cache);
disk_cache::Backend* backend;
- int rv = cache->http_cache()->GetBackend(&backend, cb.callback());
+ int rv = cache->http_cache()->GetBackend(&backend, &cb);
EXPECT_EQ(net::ERR_IO_PENDING, rv);
// Now let's queue a regular transaction
@@ -1490,8 +1480,8 @@ TEST(HttpCache, DeleteCacheWaitingForBackend2) {
c->trans->Start(&request, &c->callback, net::BoundNetLog());
// And another direct backend request.
- net::TestCompletionCallback cb2;
- rv = cache->http_cache()->GetBackend(&backend, cb2.callback());
+ TestOldCompletionCallback cb2;
+ rv = cache->http_cache()->GetBackend(&backend, &cb2);
EXPECT_EQ(net::ERR_IO_PENDING, rv);
// Just to make sure that everything is still pending.
« no previous file with comments | « 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