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

Unified Diff: content/test/net/url_request_failed_job.cc

Issue 24503004: Show IDN in error screens (DNS failure etc.) (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 2 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 | « content/test/net/url_request_failed_job.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/net/url_request_failed_job.cc
===================================================================
--- content/test/net/url_request_failed_job.cc (revision 226965)
+++ 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,41 @@
// static
void URLRequestFailedJob::AddUrlHandler() {
- // Add kMockHostname to net::URLRequestFilter for HTTP and HTTPS.
+ return AddUrlHandlerForHostname(kMockHostname);
+}
+
+// static
+void URLRequestFailedJob::AddUrlHandlerForHostname(
+ 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 GetMockHttpUrlForHostname(net_error, kMockHostname);
}
// static
GURL URLRequestFailedJob::GetMockHttpsUrl(int net_error) {
- return GetMockUrl("https", net_error);
+ return GetMockHttpsUrlForHostname(net_error, kMockHostname);
}
// static
+GURL URLRequestFailedJob::GetMockHttpUrlForHostname(
+ int net_error, const std::string& hostname) {
+ return GetMockUrl("http", hostname, net_error);
+}
+
+// static
+GURL URLRequestFailedJob::GetMockHttpsUrlForHostname(
+ 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,
« no previous file with comments | « content/test/net/url_request_failed_job.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698