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

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: 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
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..23d574cf7b039fdc0b32a7c7a98e2e7db36dda5c
--- /dev/null
+++ b/ios/web/public/test/response_providers/error_page_response_provider.h
@@ -0,0 +1,36 @@
+// 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 "base/macros.h"
Eugene But (OOO till 7-30) 2016/08/19 21:29:02 Is this include necessary?
baxley 2016/08/19 22:25:44 Done.
+#include "ios/web/public/test/response_providers/html_response_provider.h"
+
Eugene But (OOO till 7-30) 2016/08/19 21:29:02 Include gurl.h?
baxley 2016/08/19 22:25:44 Done.
+// A HtmlResponseProvider that supports the following additional URLs:
+// - RedirectToDNSFailureUrl - the response is a redirect to |DNSFailureUrl|.
+// - DNSFailureUrl - 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 DNSFailureUrl();
Eugene But (OOO till 7-30) 2016/08/19 21:29:02 GetDnsFailureUrl ?
baxley 2016/08/19 22:25:44 Done.
+ // Returns a URL that redirects to a bad URL.
+ static GURL RedirectToDNSFailureUrl();
Eugene But (OOO till 7-30) 2016/08/19 21:29:02 GetRedirectToDnsFailureUrl ?
baxley 2016/08/19 22:25:44 Done.
+
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698