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