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

Unified Diff: webkit/appcache/appcache_update_job_unittest.cc

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 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
« no previous file with comments | « webkit/appcache/appcache_request_handler_unittest.cc ('k') | webkit/appcache/appcache_url_request_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..73f8692f0f400d8acc5f9a3aacfb0a06ebf48517 100644
--- a/webkit/appcache/appcache_update_job_unittest.cc
+++ b/webkit/appcache/appcache_update_job_unittest.cc
@@ -51,14 +51,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 +196,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 +339,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 +377,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 +435,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 +454,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 +492,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 +509,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 +533,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);
}
};
« no previous file with comments | « webkit/appcache/appcache_request_handler_unittest.cc ('k') | webkit/appcache/appcache_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698