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

Unified Diff: ios/web/public/test/response_providers/error_page_response_provider.h

Issue 2259393002: Upstream ErrorPageResponseProvider to be used in integration tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 4 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 | « ios/web/BUILD.gn ('k') | ios/web/public/test/response_providers/error_page_response_provider.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/test/response_providers/error_page_response_provider.h
diff --git a/ios/web/public/test/response_providers/error_page_response_provider.h b/ios/web/public/test/response_providers/error_page_response_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..030c4adaf37c4c093be43aa41ede9dfcc1f66ce3
--- /dev/null
+++ b/ios/web/public/test/response_providers/error_page_response_provider.h
@@ -0,0 +1,37 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_ERROR_PAGE_RESPONSE_PROVIDER_H_
+#define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_ERROR_PAGE_RESPONSE_PROVIDER_H_
+
+#include <map>
+#include <string>
+
+#include "ios/web/public/test/response_providers/html_response_provider.h"
+#include "url/gurl.h"
+
+// A HtmlResponseProvider that supports the following additional URLs:
+// - GetRedirectToDnsFailureUrl - the response is a redirect to
+// |GetDnsFailureUrl|.
+// - GetDnsFailureUrl - triggers a DNS error.
+class ErrorPageResponseProvider : public HtmlResponseProvider {
+ public:
+ ErrorPageResponseProvider() : HtmlResponseProvider() {}
+ explicit ErrorPageResponseProvider(
+ const std::map<GURL, std::string>& responses)
+ : HtmlResponseProvider(responses) {}
+ // Returns a URL that causes a DNS failure.
+ static GURL GetDnsFailureUrl();
+ // Returns a URL that redirects to a bad URL.
+ static GURL GetRedirectToDnsFailureUrl();
+
+ // HtmlResponseProvider implementation.
+ bool CanHandleRequest(const Request& request) override;
+ void GetResponseHeadersAndBody(
+ const Request& request,
+ scoped_refptr<net::HttpResponseHeaders>* headers,
+ std::string* response_body) override;
+};
+
+#endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_ERROR_PAGE_RESPONSE_PROVIDER_H_
« no previous file with comments | « ios/web/BUILD.gn ('k') | ios/web/public/test/response_providers/error_page_response_provider.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698