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 #ifndef IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_ERROR_PAGE_RESPONSE_PROVIDER_H_ | 5 #ifndef IOS_WEB_PUBLIC_TEST_HTTP_SERVER_ERROR_PAGE_RESPONSE_PROVIDER_H_ |
6 #define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_ERROR_PAGE_RESPONSE_PROVIDER_H_ | 6 #define IOS_WEB_PUBLIC_TEST_HTTP_SERVER_ERROR_PAGE_RESPONSE_PROVIDER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #import "ios/web/public/test/response_providers/html_response_provider.h" | 11 #import "ios/web/public/test/http_server/html_response_provider.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 // A HtmlResponseProvider that supports the following additional URLs: | 14 // A HtmlResponseProvider that supports the following additional URLs: |
15 // - GetRedirectToDnsFailureUrl - the response is a redirect to | 15 // - GetRedirectToDnsFailureUrl - the response is a redirect to |
16 // |GetDnsFailureUrl|. | 16 // |GetDnsFailureUrl|. |
17 // - GetDnsFailureUrl - triggers a DNS error. | 17 // - GetDnsFailureUrl - triggers a DNS error. |
18 class ErrorPageResponseProvider : public HtmlResponseProvider { | 18 class ErrorPageResponseProvider : public HtmlResponseProvider { |
19 public: | 19 public: |
20 ErrorPageResponseProvider() : HtmlResponseProvider() {} | 20 ErrorPageResponseProvider() : HtmlResponseProvider() {} |
21 explicit ErrorPageResponseProvider( | 21 explicit ErrorPageResponseProvider( |
22 const std::map<GURL, std::string>& responses) | 22 const std::map<GURL, std::string>& responses) |
23 : HtmlResponseProvider(responses) {} | 23 : HtmlResponseProvider(responses) {} |
24 // Returns a URL that causes a DNS failure. | 24 // Returns a URL that causes a DNS failure. |
25 static GURL GetDnsFailureUrl(); | 25 static GURL GetDnsFailureUrl(); |
26 // Returns a URL that redirects to a bad URL. | 26 // Returns a URL that redirects to a bad URL. |
27 static GURL GetRedirectToDnsFailureUrl(); | 27 static GURL GetRedirectToDnsFailureUrl(); |
28 | 28 |
29 // HtmlResponseProvider implementation. | 29 // HtmlResponseProvider implementation. |
30 bool CanHandleRequest(const Request& request) override; | 30 bool CanHandleRequest(const Request& request) override; |
31 void GetResponseHeadersAndBody( | 31 void GetResponseHeadersAndBody( |
32 const Request& request, | 32 const Request& request, |
33 scoped_refptr<net::HttpResponseHeaders>* headers, | 33 scoped_refptr<net::HttpResponseHeaders>* headers, |
34 std::string* response_body) override; | 34 std::string* response_body) override; |
35 }; | 35 }; |
36 | 36 |
37 #endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_ERROR_PAGE_RESPONSE_PROVIDER_H
_ | 37 #endif // IOS_WEB_PUBLIC_TEST_HTTP_SERVER_ERROR_PAGE_RESPONSE_PROVIDER_H_ |
OLD | NEW |