| 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 {
|
|
|