| Index: content/test/net/url_request_failed_job.cc
|
| ===================================================================
|
| --- content/test/net/url_request_failed_job.cc (revision 225096)
|
| +++ content/test/net/url_request_failed_job.cc (working copy)
|
| @@ -32,11 +32,12 @@
|
| return net::ERR_UNEXPECTED;
|
| }
|
|
|
| -GURL GetMockUrl(const std::string& scheme, int net_error) {
|
| +GURL GetMockUrl(const std::string& scheme,
|
| + const std::string& hostname,
|
| + int net_error) {
|
| CHECK_LT(net_error, 0);
|
| CHECK_NE(net_error, net::ERR_IO_PENDING);
|
| - return GURL(scheme + "://" + kMockHostname + "/" +
|
| - base::IntToString(net_error));
|
| + return GURL(scheme + "://" + hostname + "/" + base::IntToString(net_error));
|
| }
|
|
|
| } // namespace
|
| @@ -58,25 +59,40 @@
|
|
|
| // static
|
| void URLRequestFailedJob::AddUrlHandler() {
|
| - // Add kMockHostname to net::URLRequestFilter for HTTP and HTTPS.
|
| + return AddUrlHandler(kMockHostname);
|
| +}
|
| +
|
| +// static
|
| +void URLRequestFailedJob::AddUrlHandler(const std::string& hostname) {
|
| + // Add |hostname| to net::URLRequestFilter for HTTP and HTTPS.
|
| net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
|
| - filter->AddHostnameHandler("http", kMockHostname,
|
| - URLRequestFailedJob::Factory);
|
| - filter->AddHostnameHandler("https", kMockHostname,
|
| - URLRequestFailedJob::Factory);
|
| + filter->AddHostnameHandler("http", hostname, URLRequestFailedJob::Factory);
|
| + filter->AddHostnameHandler("https", hostname, URLRequestFailedJob::Factory);
|
| }
|
|
|
| // static
|
| GURL URLRequestFailedJob::GetMockHttpUrl(int net_error) {
|
| - return GetMockUrl("http", net_error);
|
| + return GetMockHttpUrl(net_error, kMockHostname);
|
| }
|
|
|
| // static
|
| GURL URLRequestFailedJob::GetMockHttpsUrl(int net_error) {
|
| - return GetMockUrl("https", net_error);
|
| + return GetMockHttpsUrl(net_error, kMockHostname);
|
| }
|
|
|
| // static
|
| +GURL URLRequestFailedJob::GetMockHttpUrl(
|
| + int net_error, const std::string& hostname) {
|
| + return GetMockUrl("http", hostname, net_error);
|
| +}
|
| +
|
| +// static
|
| +GURL URLRequestFailedJob::GetMockHttpsUrl(
|
| + int net_error, const std::string& hostname) {
|
| + return GetMockUrl("https", hostname, net_error);
|
| +}
|
| +
|
| +// static
|
| net::URLRequestJob* URLRequestFailedJob::Factory(
|
| net::URLRequest* request,
|
| net::NetworkDelegate* network_delegate,
|
|
|