| Index: webkit/appcache/appcache_update_job_unittest.cc
|
| diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc
|
| index 123a563f59fc4b4e7a32e7afb4c3c7e5825c492b..aad7899b185480deec01f02ef4449444c4f51e91 100644
|
| --- a/webkit/appcache/appcache_update_job_unittest.cc
|
| +++ b/webkit/appcache/appcache_update_job_unittest.cc
|
| @@ -11,6 +11,8 @@
|
| #include "base/synchronization/waitable_event.h"
|
| #include "net/base/net_errors.h"
|
| #include "net/http/http_response_headers.h"
|
| +#include "net/url_request/url_request.h"
|
| +#include "net/url_request/url_request_context.h"
|
| #include "net/url_request/url_request_error_job.h"
|
| #include "net/url_request/url_request_job_factory.h"
|
| #include "net/url_request/url_request_test_job.h"
|
| @@ -51,14 +53,16 @@ class MockHttpServer {
|
| return GURL("https://cross_origin_host/" + path);
|
| }
|
|
|
| - static net::URLRequestJob* JobFactory(net::URLRequest* request) {
|
| + static net::URLRequestJob* JobFactory(
|
| + net::URLRequest* request, net::NetworkDelegate* network_delegate) {
|
| if (request->url().host() != "mockhost" &&
|
| request->url().host() != "cross_origin_host")
|
| - return new net::URLRequestErrorJob(request, -100);
|
| + return new net::URLRequestErrorJob(request, network_delegate, -100);
|
|
|
| std::string headers, body;
|
| GetMockResponse(request->url().path(), &headers, &body);
|
| - return new net::URLRequestTestJob(request, headers, body, true);
|
| + return new net::URLRequestTestJob(
|
| + request, network_delegate, headers, body, true);
|
| }
|
|
|
| private:
|
| @@ -194,8 +198,9 @@ class MockHttpServer {
|
| class MockHttpServerJobFactory
|
| : public net::URLRequestJobFactory::ProtocolHandler {
|
| public:
|
| - virtual net::URLRequestJob* MaybeCreateJob(net::URLRequest* request) const {
|
| - return MockHttpServer::JobFactory(request);
|
| + virtual net::URLRequestJob* MaybeCreateJob(
|
| + net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
|
| + return MockHttpServer::JobFactory(request, network_delegate);
|
| }
|
| };
|
|
|
| @@ -336,9 +341,11 @@ class MockFrontend : public AppCacheFrontend {
|
| // Helper factories to simulate redirected URL responses for tests.
|
| class RedirectFactory : public net::URLRequestJobFactory::ProtocolHandler {
|
| public:
|
| - virtual net::URLRequestJob* MaybeCreateJob(net::URLRequest* request) const {
|
| + virtual net::URLRequestJob* MaybeCreateJob(
|
| + net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
|
| return new net::URLRequestTestJob(
|
| request,
|
| + network_delegate,
|
| net::URLRequestTestJob::test_redirect_headers(),
|
| net::URLRequestTestJob::test_data_1(),
|
| true);
|
| @@ -372,15 +379,18 @@ class RetryRequestTestJob : public net::URLRequestTestJob {
|
| expected_requests_ = 0;
|
| }
|
|
|
| - static net::URLRequestJob* RetryFactory(net::URLRequest* request) {
|
| + static net::URLRequestJob* RetryFactory(
|
| + net::URLRequest* request, net::NetworkDelegate* network_delegate) {
|
| ++num_requests_;
|
| if (num_retries_ > 0 && request->original_url() == kRetryUrl) {
|
| --num_retries_;
|
| return new RetryRequestTestJob(
|
| - request, RetryRequestTestJob::retry_headers(), 503);
|
| + request, network_delegate, RetryRequestTestJob::retry_headers(), 503);
|
| } else {
|
| return new RetryRequestTestJob(
|
| - request, RetryRequestTestJob::manifest_headers(), 200);
|
| + request,
|
| + network_delegate,
|
| + RetryRequestTestJob::manifest_headers(), 200);
|
| }
|
| }
|
|
|
| @@ -427,9 +437,11 @@ class RetryRequestTestJob : public net::URLRequestTestJob {
|
| }
|
|
|
| RetryRequestTestJob(net::URLRequest* request,
|
| + net::NetworkDelegate* network_delegate,
|
| const std::string& headers,
|
| int response_code)
|
| - : net::URLRequestTestJob(request, headers, data(), true),
|
| + : net::URLRequestTestJob(
|
| + request, network_delegate, headers, data(), true),
|
| response_code_(response_code) {
|
| }
|
|
|
| @@ -444,8 +456,9 @@ class RetryRequestTestJob : public net::URLRequestTestJob {
|
| class RetryRequestTestJobFactory
|
| : public net::URLRequestJobFactory::ProtocolHandler {
|
| public:
|
| - virtual net::URLRequestJob* MaybeCreateJob(net::URLRequest* request) const {
|
| - return RetryRequestTestJob::RetryFactory(request);
|
| + virtual net::URLRequestJob* MaybeCreateJob(
|
| + net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
|
| + return RetryRequestTestJob::RetryFactory(request, network_delegate);
|
| }
|
| };
|
|
|
| @@ -481,7 +494,8 @@ class HttpHeadersRequestTestJob : public net::URLRequestTestJob {
|
| already_checked_ = false;
|
| }
|
|
|
| - static net::URLRequestJob* IfModifiedSinceFactory(net::URLRequest* request) {
|
| + static net::URLRequestJob* IfModifiedSinceFactory(
|
| + net::URLRequest* request, net::NetworkDelegate* network_delegate) {
|
| if (!already_checked_) {
|
| already_checked_ = true; // only check once for a test
|
| const net::HttpRequestHeaders& extra_headers =
|
| @@ -497,7 +511,7 @@ class HttpHeadersRequestTestJob : public net::URLRequestTestJob {
|
| net::HttpRequestHeaders::kIfNoneMatch, &header_value) &&
|
| header_value == expect_if_none_match_;
|
| }
|
| - return MockHttpServer::JobFactory(request);
|
| + return MockHttpServer::JobFactory(request, network_delegate);
|
| }
|
|
|
| protected:
|
| @@ -521,8 +535,10 @@ bool HttpHeadersRequestTestJob::already_checked_ = false;
|
| class IfModifiedSinceJobFactory
|
| : public net::URLRequestJobFactory::ProtocolHandler {
|
| public:
|
| - virtual net::URLRequestJob* MaybeCreateJob(net::URLRequest* request) const {
|
| - return HttpHeadersRequestTestJob::IfModifiedSinceFactory(request);
|
| + virtual net::URLRequestJob* MaybeCreateJob(
|
| + net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
|
| + return HttpHeadersRequestTestJob::IfModifiedSinceFactory(
|
| + request, network_delegate);
|
| }
|
| };
|
|
|
|
|