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

Unified Diff: chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc

Issue 2190463008: Add an error page for HTTP 404 error pages without bodies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes... Created 4 years, 5 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: chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
index 6654a0e00d6d8e5df8c2df47e88a12b296546ca7..dae10dd443039acf3f3f56342b5b901d4063ecc9 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -50,6 +50,8 @@
#include "extensions/test/result_catcher.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "net/test/embedded_test_server/http_request.h"
+#include "net/test/embedded_test_server/http_response.h"
#include "third_party/WebKit/public/web/WebContextMenuData.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
@@ -330,11 +332,28 @@ class TestResourceDispatcherHostDelegate
DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcherHostDelegate);
};
+// Handles requests for URLs with paths of "/test*" sent to the test server, so
+// tests request a URL that receives a non-error response.
+std::unique_ptr<net::test_server::HttpResponse> HandleTestRequest(
+ const net::test_server::HttpRequest& request) {
+ if (!base::StartsWith(request.relative_url, "/test",
+ base::CompareCase::SENSITIVE)) {
+ return nullptr;
+ }
+ std::unique_ptr<net::test_server::BasicHttpResponse> response(
+ new net::test_server::BasicHttpResponse());
+ response->set_content("This space intentionally left blank.");
+ return std::move(response);
+}
+
} // namespace
class WebNavigationApiTest : public ExtensionApiTest {
public:
- WebNavigationApiTest() {}
+ WebNavigationApiTest() {
+ embedded_test_server()->RegisterRequestHandler(
+ base::Bind(&HandleTestRequest));
+ }
~WebNavigationApiTest() override {}
void SetUpInProcessBrowserTestFixture() override {

Powered by Google App Engine
This is Rietveld 408576698