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

Side by Side 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: Moar... fixes... 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <list> 5 #include <list>
6 #include <set> 6 #include <set>
7 7
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 if (throttle) 323 if (throttle)
324 throttles->push_back(throttle); 324 throttles->push_back(throttle);
325 } 325 }
326 326
327 private: 327 private:
328 scoped_refptr<TestNavigationListener> test_navigation_listener_; 328 scoped_refptr<TestNavigationListener> test_navigation_listener_;
329 329
330 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcherHostDelegate); 330 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcherHostDelegate);
331 }; 331 };
332 332
333 // Handles requests for URLs with paths of "/test*" sent to the test server, so
334 // tests request a URL that receives a non-error response.
335 std::unqiue_ptr<net::test_server::HttpResponse> HandleTestRequest(
336 const net::test_server::HttpRequest& request) {
337 if (!base::StartsWithASCII(request.relative_url, "/test"))
338 return nullptr;
339 std::unique_ptr<net::test_server::BasicHttpResponse> response(
340 new net::test_server::BasicHttpResponse());
341 response->set_content("This space intentionally left blank.");
342 return std::move(response);
343 }
344
333 } // namespace 345 } // namespace
334 346
335 class WebNavigationApiTest : public ExtensionApiTest { 347 class WebNavigationApiTest : public ExtensionApiTest {
336 public: 348 public:
337 WebNavigationApiTest() {} 349 WebNavigationApiTest() {
350 embedded_test_server()->RegisterRequestHandler(
351 base::Bind(&HandleTestRequest));
352 }
338 ~WebNavigationApiTest() override {} 353 ~WebNavigationApiTest() override {}
339 354
340 void SetUpInProcessBrowserTestFixture() override { 355 void SetUpInProcessBrowserTestFixture() override {
341 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); 356 ExtensionApiTest::SetUpInProcessBrowserTestFixture();
342 357
343 FrameNavigationState::set_allow_extension_scheme(true); 358 FrameNavigationState::set_allow_extension_scheme(true);
344 359
345 base::CommandLine::ForCurrentProcess()->AppendSwitch( 360 base::CommandLine::ForCurrentProcess()->AppendSwitch(
346 switches::kAllowLegacyExtensionManifests); 361 switches::kAllowLegacyExtensionManifests);
347 362
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 "extensions/api_test/webnavigation/crash/b.html", 787 "extensions/api_test/webnavigation/crash/b.html",
773 embedded_test_server()->port())); 788 embedded_test_server()->port()));
774 ui_test_utils::NavigateToURL(browser(), url); 789 ui_test_utils::NavigateToURL(browser(), url);
775 790
776 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 791 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
777 } 792 }
778 793
779 #endif 794 #endif
780 795
781 } // namespace extensions 796 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698