summaryrefslogtreecommitdiffstats
path: root/webkit/appcache
diff options
context:
space:
mode:
authortedv@chromium.org <tedv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-19 02:53:29 +0000
committertedv@chromium.org <tedv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-19 02:53:29 +0000
commitdd8b8d1cc7478cf07070b1a3e20e67e6bf9bc27c (patch)
treeff98e7100e6a5d9c700247ffec04ae7f0ede6218 /webkit/appcache
parentca8d150cf93e15f8a1bf621ddc16cf9982e73767 (diff)
downloadchromium_src-dd8b8d1cc7478cf07070b1a3e20e67e6bf9bc27c.zip
chromium_src-dd8b8d1cc7478cf07070b1a3e20e67e6bf9bc27c.tar.gz
chromium_src-dd8b8d1cc7478cf07070b1a3e20e67e6bf9bc27c.tar.bz2
Update TestURLRequest constructor interface in unit tests.
The webkit and android_webview unit tests that create TestURLRequest objects are updated in this patch to explicitly specify which network delegate they use, rather than extracting it from the context. This is usually but not always NULL. This change is motivated by a desire to remove external accesses to a request context's delegate. (If a block of code needs to use a NetworkDelegate, it should not query the URLRequestContext for it, but instead should already have access to whatever delegate the context uses.) BUG=146587 Review URL: https://chromiumcodereview.appspot.com/12321106 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188920 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r--webkit/appcache/appcache_request_handler_unittest.cc188
-rw-r--r--webkit/appcache/appcache_url_request_job_unittest.cc19
2 files changed, 100 insertions, 107 deletions
diff --git a/webkit/appcache/appcache_request_handler_unittest.cc b/webkit/appcache/appcache_request_handler_unittest.cc
index 8d162d2..3dcca48 100644
--- a/webkit/appcache/appcache_request_handler_unittest.cc
+++ b/webkit/appcache/appcache_request_handler_unittest.cc
@@ -117,13 +117,17 @@ class AppCacheRequestHandlerTest : public testing::Test {
class MockURLRequest : public net::URLRequest {
public:
- explicit MockURLRequest(const GURL& url, net::URLRequestContext* context) :
- net::URLRequest(url, NULL, context) {
+ MockURLRequest(
+ const GURL& url,
+ net::URLRequestContext* context,
+ net::NetworkDelegate* network_delegate) :
+ net::URLRequest(url, NULL, context, network_delegate),
+ network_delegate_(network_delegate) {
}
void SimulateResponseCode(int http_response_code) {
mock_factory_job_ = new MockURLRequestJob(
- this, context()->network_delegate(), http_response_code);
+ this, network_delegate_, http_response_code);
Start();
DCHECK(!mock_factory_job_);
// All our simulation needs to satisfy are the following two DCHECKs
@@ -133,13 +137,16 @@ class AppCacheRequestHandlerTest : public testing::Test {
void SimulateResponseInfo(const net::HttpResponseInfo& info) {
mock_factory_job_ = new MockURLRequestJob(
- this, context()->network_delegate(), info);
+ this, network_delegate_, info);
set_delegate(&delegate_); // needed to get the info back out
Start();
DCHECK(!mock_factory_job_);
}
MockURLRequestDelegate delegate_;
+
+ private:
+ net::NetworkDelegate* network_delegate_;
};
static net::URLRequestJob* MockHttpJobFactory(
@@ -172,7 +179,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
// Test harness --------------------------------------------------
AppCacheRequestHandlerTest()
- : host_(NULL), orig_http_factory_(NULL) {
+ : host_(NULL), empty_network_delegate_(NULL), orig_http_factory_(NULL) {
}
template <class Method>
@@ -200,6 +207,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
const int kHostId = 1;
backend_impl_->RegisterHost(kHostId);
host_ = backend_impl_->GetHost(kHostId);
+ empty_network_delegate_ = NULL;
}
void TearDownTest() {
@@ -216,6 +224,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
mock_service_.reset();
mock_policy_.reset();
host_ = NULL;
+ empty_network_delegate_ = NULL;
}
void TestFinished() {
@@ -254,13 +263,13 @@ class AppCacheRequestHandlerTest : public testing::Test {
base::Bind(&AppCacheRequestHandlerTest::Verify_MainResource_Miss,
base::Unretained(this)));
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::MAIN_FRAME));
EXPECT_TRUE(handler_.get());
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_waiting());
@@ -282,11 +291,11 @@ class AppCacheRequestHandlerTest : public testing::Test {
AppCacheURLRequestJob* fallback_job;
fallback_job = handler_->MaybeLoadFallbackForRedirect(
request_.get(),
- request_->context()->network_delegate(),
+ empty_network_delegate_,
GURL("http://blah/redirect"));
EXPECT_FALSE(fallback_job);
fallback_job = handler_->MaybeLoadFallbackForResponse(
- request_.get(), request_->context()->network_delegate());
+ request_.get(), empty_network_delegate_);
EXPECT_FALSE(fallback_job);
EXPECT_TRUE(host_->preferred_manifest_url().is_empty());
@@ -301,7 +310,8 @@ class AppCacheRequestHandlerTest : public testing::Test {
base::Bind(&AppCacheRequestHandlerTest::Verify_MainResource_Hit,
base::Unretained(this)));
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::MAIN_FRAME));
EXPECT_TRUE(handler_.get());
@@ -311,8 +321,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
GURL(), AppCacheEntry(),
1, 2, GURL("http://blah/manifest/"));
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_waiting());
@@ -333,7 +342,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
AppCacheURLRequestJob* fallback_job;
fallback_job = handler_->MaybeLoadFallbackForResponse(
- request_.get(), request_->context()->network_delegate());
+ request_.get(), empty_network_delegate_);
EXPECT_FALSE(fallback_job);
EXPECT_EQ(GURL("http://blah/manifest/"),
@@ -349,7 +358,8 @@ class AppCacheRequestHandlerTest : public testing::Test {
base::Bind(&AppCacheRequestHandlerTest::Verify_MainResource_Fallback,
base::Unretained(this)));
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::MAIN_FRAME));
EXPECT_TRUE(handler_.get());
@@ -360,8 +370,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
AppCacheEntry(AppCacheEntry::EXPLICIT, 1),
1, 2, GURL("http://blah/manifest/"));
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_waiting());
@@ -376,15 +385,14 @@ class AppCacheRequestHandlerTest : public testing::Test {
// When the request is restarted, the existing job is dropped so a
// real network job gets created. We expect NULL here which will cause
// the net library to create a real job.
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_FALSE(job_);
// Simulate an http error of the real network job.
request_->SimulateResponseCode(500);
job_ = handler_->MaybeLoadFallbackForResponse(
- request_.get(), request_->context()->network_delegate());
+ request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_);
EXPECT_TRUE(job_->is_delivering_appcache_response());
@@ -409,8 +417,9 @@ class AppCacheRequestHandlerTest : public testing::Test {
&AppCacheRequestHandlerTest::Verify_MainResource_FallbackOverride,
base::Unretained(this)));
- request_.reset(new MockURLRequest(GURL("http://blah/fallback-override"),
- &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/fallback-override"),
+ &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::MAIN_FRAME));
EXPECT_TRUE(handler_.get());
@@ -421,8 +430,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
AppCacheEntry(AppCacheEntry::EXPLICIT, 1),
1, 2, GURL("http://blah/manifest/"));
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_waiting());
@@ -437,8 +445,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
// When the request is restarted, the existing job is dropped so a
// real network job gets created. We expect NULL here which will cause
// the net library to create a real job.
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_FALSE(job_);
// Simulate an http error of the real network job, but with custom
@@ -453,7 +460,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_->SimulateResponseInfo(info);
job_ = handler_->MaybeLoadFallbackForResponse(
- request_.get(), request_->context()->network_delegate());
+ request_.get(), empty_network_delegate_);
EXPECT_FALSE(job_);
TestFinished();
@@ -462,7 +469,8 @@ class AppCacheRequestHandlerTest : public testing::Test {
// SubResource_Miss_WithNoCacheSelected ----------------------------------
void SubResource_Miss_WithNoCacheSelected() {
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::SUB_RESOURCE));
@@ -480,24 +488,22 @@ class AppCacheRequestHandlerTest : public testing::Test {
// in a network or fallback namespace, should result in a failed request.
host_->AssociateCompleteCache(MakeNewCache());
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_delivering_error_response());
AppCacheURLRequestJob* fallback_job;
fallback_job = handler_->MaybeLoadFallbackForRedirect(
- request_.get(),
- empty_context_.network_delegate(),
- GURL("http://blah/redirect"));
+ request_.get(), empty_network_delegate_, GURL("http://blah/redirect"));
EXPECT_FALSE(fallback_job);
fallback_job = handler_->MaybeLoadFallbackForResponse(
- request_.get(), empty_context_.network_delegate());
+ request_.get(), empty_network_delegate_);
EXPECT_FALSE(fallback_job);
TestFinished();
@@ -511,12 +517,12 @@ class AppCacheRequestHandlerTest : public testing::Test {
host_->pending_selected_cache_id_ = cache->cache_id();
host_->set_preferred_manifest_url(cache->owning_group()->manifest_url());
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_waiting());
@@ -526,12 +532,10 @@ class AppCacheRequestHandlerTest : public testing::Test {
AppCacheURLRequestJob* fallback_job;
fallback_job = handler_->MaybeLoadFallbackForRedirect(
- request_.get(),
- empty_context_.network_delegate(),
- GURL("http://blah/redirect"));
+ request_.get(), empty_network_delegate_, GURL("http://blah/redirect"));
EXPECT_FALSE(fallback_job);
fallback_job = handler_->MaybeLoadFallbackForResponse(
- request_.get(), empty_context_.network_delegate());
+ request_.get(), empty_network_delegate_);
EXPECT_FALSE(fallback_job);
TestFinished();
@@ -545,23 +549,21 @@ class AppCacheRequestHandlerTest : public testing::Test {
mock_storage()->SimulateFindSubResource(
AppCacheEntry(AppCacheEntry::EXPLICIT, 1), AppCacheEntry(), false);
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_delivering_appcache_response());
AppCacheURLRequestJob* fallback_job;
fallback_job = handler_->MaybeLoadFallbackForRedirect(
- request_.get(),
- empty_context_.network_delegate(),
- GURL("http://blah/redirect"));
+ request_.get(), empty_network_delegate_, GURL("http://blah/redirect"));
EXPECT_FALSE(fallback_job);
fallback_job = handler_->MaybeLoadFallbackForResponse(
- request_.get(), empty_context_.network_delegate());
+ request_.get(), empty_network_delegate_);
EXPECT_FALSE(fallback_job);
TestFinished();
@@ -577,24 +579,24 @@ class AppCacheRequestHandlerTest : public testing::Test {
mock_storage()->SimulateFindSubResource(
AppCacheEntry(), AppCacheEntry(AppCacheEntry::EXPLICIT, 1), false);
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_FALSE(job_.get());
job_ = handler_->MaybeLoadFallbackForRedirect(
request_.get(),
- empty_context_.network_delegate(),
+ empty_network_delegate_,
GURL("http://not_blah/redirect"));
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_delivering_appcache_response());
AppCacheURLRequestJob* fallback_job;
fallback_job = handler_->MaybeLoadFallbackForResponse(
- request_.get(), empty_context_.network_delegate());
+ request_.get(), empty_network_delegate_);
EXPECT_FALSE(fallback_job);
TestFinished();
@@ -610,24 +612,22 @@ class AppCacheRequestHandlerTest : public testing::Test {
mock_storage()->SimulateFindSubResource(
AppCacheEntry(), AppCacheEntry(AppCacheEntry::EXPLICIT, 1), false);
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_FALSE(job_.get());
AppCacheURLRequestJob* fallback_job;
fallback_job = handler_->MaybeLoadFallbackForRedirect(
- request_.get(),
- empty_context_.network_delegate(),
- GURL("http://blah/redirect"));
+ request_.get(), empty_network_delegate_, GURL("http://blah/redirect"));
EXPECT_FALSE(fallback_job);
request_->SimulateResponseCode(200);
fallback_job = handler_->MaybeLoadFallbackForResponse(
- request_.get(), empty_context_.network_delegate());
+ request_.get(), empty_network_delegate_);
EXPECT_FALSE(fallback_job);
TestFinished();
@@ -644,22 +644,20 @@ class AppCacheRequestHandlerTest : public testing::Test {
mock_storage()->SimulateFindSubResource(
AppCacheEntry(), AppCacheEntry(), true);
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_FALSE(job_.get());
AppCacheURLRequestJob* fallback_job;
fallback_job = handler_->MaybeLoadFallbackForRedirect(
- request_.get(),
- empty_context_.network_delegate(),
- GURL("http://blah/redirect"));
+ request_.get(), empty_network_delegate_, GURL("http://blah/redirect"));
EXPECT_FALSE(fallback_job);
fallback_job = handler_->MaybeLoadFallbackForResponse(
- request_.get(), empty_context_.network_delegate());
+ request_.get(), empty_network_delegate_);
EXPECT_FALSE(fallback_job);
TestFinished();
@@ -673,7 +671,8 @@ class AppCacheRequestHandlerTest : public testing::Test {
mock_storage()->SimulateFindSubResource(
AppCacheEntry(AppCacheEntry::EXPLICIT, 1), AppCacheEntry(), false);
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
@@ -682,13 +681,11 @@ class AppCacheRequestHandlerTest : public testing::Test {
host_ = NULL;
EXPECT_FALSE(handler_->MaybeLoadResource(
- request_.get(), empty_context_.network_delegate()));
+ request_.get(), empty_network_delegate_));
EXPECT_FALSE(handler_->MaybeLoadFallbackForRedirect(
- request_.get(),
- empty_context_.network_delegate(),
- GURL("http://blah/redirect")));
+ request_.get(), empty_network_delegate_, GURL("http://blah/redirect")));
EXPECT_FALSE(handler_->MaybeLoadFallbackForResponse(
- request_.get(), empty_context_.network_delegate()));
+ request_.get(), empty_network_delegate_));
TestFinished();
}
@@ -699,13 +696,13 @@ class AppCacheRequestHandlerTest : public testing::Test {
// Precondition, the host is waiting on cache selection.
host_->pending_selected_cache_id_ = 1;
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
- job_ = handler_->MaybeLoadResource(
- request_.get(), empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_waiting());
@@ -714,13 +711,11 @@ class AppCacheRequestHandlerTest : public testing::Test {
EXPECT_TRUE(job_->has_been_killed());
EXPECT_FALSE(handler_->MaybeLoadResource(
- request_.get(), empty_context_.network_delegate()));
+ request_.get(), empty_network_delegate_));
EXPECT_FALSE(handler_->MaybeLoadFallbackForRedirect(
- request_.get(),
- empty_context_.network_delegate(),
- GURL("http://blah/redirect")));
+ request_.get(), empty_network_delegate_, GURL("http://blah/redirect")));
EXPECT_FALSE(handler_->MaybeLoadFallbackForResponse(
- request_.get(), empty_context_.network_delegate()));
+ request_.get(), empty_network_delegate_));
TestFinished();
}
@@ -731,19 +726,18 @@ class AppCacheRequestHandlerTest : public testing::Test {
// Precondition, the host is waiting on cache selection.
host_->pending_selected_cache_id_ = 1;
- request_.reset(new MockURLRequest(GURL("ftp://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("ftp://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::SUB_RESOURCE));
EXPECT_TRUE(handler_.get()); // we could redirect to http (conceivably)
EXPECT_FALSE(handler_->MaybeLoadResource(
- request_.get(), empty_context_.network_delegate()));
+ request_.get(), empty_network_delegate_));
EXPECT_FALSE(handler_->MaybeLoadFallbackForRedirect(
- request_.get(),
- empty_context_.network_delegate(),
- GURL("ftp://blah/redirect")));
+ request_.get(), empty_network_delegate_, GURL("ftp://blah/redirect")));
EXPECT_FALSE(handler_->MaybeLoadFallbackForResponse(
- request_.get(), empty_context_.network_delegate()));
+ request_.get(), empty_network_delegate_));
TestFinished();
}
@@ -751,13 +745,13 @@ class AppCacheRequestHandlerTest : public testing::Test {
// CanceledRequest -----------------------------
void CanceledRequest() {
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::MAIN_FRAME));
EXPECT_TRUE(handler_.get());
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_waiting());
EXPECT_FALSE(job_->has_been_started());
@@ -770,7 +764,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
EXPECT_TRUE(job_->has_been_killed());
EXPECT_FALSE(handler_->MaybeLoadFallbackForResponse(
- request_.get(), empty_context_.network_delegate()));
+ request_.get(), empty_network_delegate_));
TestFinished();
}
@@ -787,7 +781,8 @@ class AppCacheRequestHandlerTest : public testing::Test {
EXPECT_FALSE(AppCacheRequestHandler::IsMainResourceType(
ResourceType::WORKER));
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
const int kParentHostId = host_->host_id();
const int kWorkerHostId = 2;
@@ -824,7 +819,8 @@ class AppCacheRequestHandlerTest : public testing::Test {
base::Bind(&AppCacheRequestHandlerTest::Verify_MainResource_Blocked,
base::Unretained(this)));
- request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
+ request_.reset(new MockURLRequest(
+ GURL("http://blah/"), &empty_context_, empty_network_delegate_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
ResourceType::MAIN_FRAME));
EXPECT_TRUE(handler_.get());
@@ -835,8 +831,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
GURL(), AppCacheEntry(),
1, 2, GURL("http://blah/manifest/"));
- job_ = handler_->MaybeLoadResource(request_.get(),
- empty_context_.network_delegate());
+ job_ = handler_->MaybeLoadResource(request_.get(), empty_network_delegate_);
EXPECT_TRUE(job_.get());
EXPECT_TRUE(job_->is_waiting());
@@ -885,6 +880,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
scoped_ptr<MockAppCachePolicy> mock_policy_;
AppCacheHost* host_;
net::URLRequestContext empty_context_;
+ net::NetworkDelegate* empty_network_delegate_;
scoped_ptr<MockURLRequest> request_;
scoped_ptr<AppCacheRequestHandler> handler_;
scoped_refptr<AppCacheURLRequestJob> job_;
diff --git a/webkit/appcache/appcache_url_request_job_unittest.cc b/webkit/appcache/appcache_url_request_job_unittest.cc
index 5001cea..52fe7ee 100644
--- a/webkit/appcache/appcache_url_request_job_unittest.cc
+++ b/webkit/appcache/appcache_url_request_job_unittest.cc
@@ -380,7 +380,7 @@ class AppCacheURLRequestJobTest : public testing::Test {
// Create an instance and see that it looks as expected.
job = new AppCacheURLRequestJob(
- &request, empty_context_.network_delegate(), storage);
+ &request, NULL, storage);
EXPECT_TRUE(job->is_waiting());
EXPECT_FALSE(job->is_delivering_appcache_response());
EXPECT_FALSE(job->is_delivering_network_response());
@@ -403,20 +403,17 @@ class AppCacheURLRequestJobTest : public testing::Test {
// Create an instance, give it a delivery order and see that
// it looks as expected.
- job = new AppCacheURLRequestJob(
- &request, empty_context_.network_delegate(), storage);
+ job = new AppCacheURLRequestJob(&request, NULL, storage);
job->DeliverErrorResponse();
EXPECT_TRUE(job->is_delivering_error_response());
EXPECT_FALSE(job->has_been_started());
- job = new AppCacheURLRequestJob(
- &request, empty_context_.network_delegate(), storage);
+ job = new AppCacheURLRequestJob(&request, NULL, storage);
job->DeliverNetworkResponse();
EXPECT_TRUE(job->is_delivering_network_response());
EXPECT_FALSE(job->has_been_started());
- job = new AppCacheURLRequestJob(
- &request, empty_context_.network_delegate(), storage);
+ job = new AppCacheURLRequestJob(&request, NULL, storage);
const GURL kManifestUrl("http://blah/");
const int64 kCacheId(1);
const int64 kGroupId(1);
@@ -450,7 +447,7 @@ class AppCacheURLRequestJobTest : public testing::Test {
// Setup to create an AppCacheURLRequestJob with orders to deliver
// a network response.
mock_factory_job_ = new AppCacheURLRequestJob(
- request_.get(), empty_context_.network_delegate(), storage);
+ request_.get(), NULL, storage);
mock_factory_job_->DeliverNetworkResponse();
EXPECT_TRUE(mock_factory_job_->is_delivering_network_response());
EXPECT_FALSE(mock_factory_job_->has_been_started());
@@ -484,7 +481,7 @@ class AppCacheURLRequestJobTest : public testing::Test {
// Setup to create an AppCacheURLRequestJob with orders to deliver
// a network response.
mock_factory_job_ = new AppCacheURLRequestJob(
- request_.get(), empty_context_.network_delegate(), storage);
+ request_.get(), NULL, storage);
mock_factory_job_->DeliverErrorResponse();
EXPECT_TRUE(mock_factory_job_->is_delivering_error_response());
EXPECT_FALSE(mock_factory_job_->has_been_started());
@@ -533,7 +530,7 @@ class AppCacheURLRequestJobTest : public testing::Test {
// Setup to create an AppCacheURLRequestJob with orders to deliver
// a network response.
scoped_refptr<AppCacheURLRequestJob> job(new AppCacheURLRequestJob(
- request_.get(), empty_context_.network_delegate(), storage));
+ request_.get(), NULL, storage));
if (start_after_delivery_orders) {
job->DeliverAppCachedResponse(
@@ -649,7 +646,7 @@ class AppCacheURLRequestJobTest : public testing::Test {
// Create job with orders to deliver an appcached entry.
scoped_refptr<AppCacheURLRequestJob> job(new AppCacheURLRequestJob(
- request_.get(), empty_context_.network_delegate(), storage));
+ request_.get(), NULL, storage));
job->DeliverAppCachedResponse(
GURL(), 0, 111,
AppCacheEntry(AppCacheEntry::EXPLICIT, written_response_id_),