| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/web/public/test/http_server/error_page_response_provider.h" | 5 #import "ios/web/public/test/http_server/error_page_response_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "ios/web/public/test/http_server/http_server.h" | 8 #import "ios/web/public/test/http_server/http_server.h" |
| 9 #include "net/http/http_status_code.h" | 9 #include "net/http/http_status_code.h" |
| 10 | 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
| 11 // static | 15 // static |
| 12 GURL ErrorPageResponseProvider::GetDnsFailureUrl() { | 16 GURL ErrorPageResponseProvider::GetDnsFailureUrl() { |
| 13 return GURL("http://mock/bad"); | 17 return GURL("http://mock/bad"); |
| 14 } | 18 } |
| 15 | 19 |
| 16 // static | 20 // static |
| 17 GURL ErrorPageResponseProvider::GetRedirectToDnsFailureUrl() { | 21 GURL ErrorPageResponseProvider::GetRedirectToDnsFailureUrl() { |
| 18 return web::test::HttpServer::MakeUrl("http://mock/redirect"); | 22 return web::test::HttpServer::MakeUrl("http://mock/redirect"); |
| 19 } | 23 } |
| 20 | 24 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 if (HtmlResponseProvider::CanHandleRequest(request)) { | 36 if (HtmlResponseProvider::CanHandleRequest(request)) { |
| 33 HtmlResponseProvider::GetResponseHeadersAndBody(request, headers, | 37 HtmlResponseProvider::GetResponseHeadersAndBody(request, headers, |
| 34 response_body); | 38 response_body); |
| 35 } else if (request.url == GetRedirectToDnsFailureUrl()) { | 39 } else if (request.url == GetRedirectToDnsFailureUrl()) { |
| 36 *headers = web::ResponseProvider::GetRedirectResponseHeaders( | 40 *headers = web::ResponseProvider::GetRedirectResponseHeaders( |
| 37 ErrorPageResponseProvider::GetDnsFailureUrl().spec(), net::HTTP_FOUND); | 41 ErrorPageResponseProvider::GetDnsFailureUrl().spec(), net::HTTP_FOUND); |
| 38 } else { | 42 } else { |
| 39 NOTREACHED(); | 43 NOTREACHED(); |
| 40 } | 44 } |
| 41 } | 45 } |
| OLD | NEW |