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

Unified Diff: content/browser/appcache/appcache_url_request_job_unittest.cc

Issue 407093011: Allow URLRequests from one context to have different NetworkDelegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new tests Created 6 years, 4 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
Index: content/browser/appcache/appcache_url_request_job_unittest.cc
diff --git a/content/browser/appcache/appcache_url_request_job_unittest.cc b/content/browser/appcache/appcache_url_request_job_unittest.cc
index 7c70eed74c8742e4a63883b82c9f4b7a81bf1269..31518fb5502dcca7e43b696caa9472e9d4c1a39d 100644
--- a/content/browser/appcache/appcache_url_request_job_unittest.cc
+++ b/content/browser/appcache/appcache_url_request_job_unittest.cc
@@ -9,6 +9,8 @@
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/pickle.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
@@ -24,6 +26,7 @@
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_job_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
using net::IOBuffer;
using net::WrappedIOBuffer;
@@ -83,8 +86,8 @@ class MockURLRequestJobFactory : public net::URLRequestJobFactory {
return false;
}
- private:
- mutable net::URLRequestJob* job_;
+ private:
+ mutable net::URLRequestJob* job_;
};
class AppCacheURLRequestJobTest : public testing::Test {
@@ -416,14 +419,13 @@ class AppCacheURLRequestJobTest : public testing::Test {
// Basic -------------------------------------------------------------------
void Basic() {
AppCacheStorage* storage = service_->storage();
- net::URLRequest request(GURL("http://blah/"), net::DEFAULT_PRIORITY, NULL,
- empty_context_.get());
+ scoped_ptr<net::URLRequest> request(empty_context_->CreateRequest(
+ GURL("http://blah/"), net::DEFAULT_PRIORITY, NULL, NULL));
scoped_refptr<AppCacheURLRequestJob> job;
// Create an instance and see that it looks as expected.
- job = new AppCacheURLRequestJob(
- &request, NULL, storage, NULL, false);
+ job = new AppCacheURLRequestJob(request.get(), NULL, storage, NULL, false);
EXPECT_TRUE(job->is_waiting());
EXPECT_FALSE(job->is_delivering_appcache_response());
EXPECT_FALSE(job->is_delivering_network_response());
@@ -440,24 +442,24 @@ class AppCacheURLRequestJobTest : public testing::Test {
// DeliveryOrders -----------------------------------------------------
void DeliveryOrders() {
AppCacheStorage* storage = service_->storage();
- net::URLRequest request(GURL("http://blah/"), net::DEFAULT_PRIORITY, NULL,
- empty_context_.get());
+ scoped_ptr<net::URLRequest> request(empty_context_->CreateRequest(
+ GURL("http://blah/"), net::DEFAULT_PRIORITY, NULL, NULL));
scoped_refptr<AppCacheURLRequestJob> job;
// Create an instance, give it a delivery order and see that
// it looks as expected.
- job = new AppCacheURLRequestJob(&request, NULL, storage, NULL, false);
+ job = new AppCacheURLRequestJob(request.get(), NULL, storage, NULL, false);
job->DeliverErrorResponse();
EXPECT_TRUE(job->is_delivering_error_response());
EXPECT_FALSE(job->has_been_started());
- job = new AppCacheURLRequestJob(&request, NULL, storage, NULL, false);
+ job = new AppCacheURLRequestJob(request.get(), NULL, storage, NULL, false);
job->DeliverNetworkResponse();
EXPECT_TRUE(job->is_delivering_network_response());
EXPECT_FALSE(job->has_been_started());
- job = new AppCacheURLRequestJob(&request, NULL, storage, NULL, false);
+ job = new AppCacheURLRequestJob(request.get(), NULL, storage, NULL, false);
const GURL kManifestUrl("http://blah/");
const int64 kCacheId(1);
const int64 kGroupId(1);

Powered by Google App Engine
This is Rietveld 408576698