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

Unified Diff: content/browser/browser_side_navigation_browsertest.cc

Issue 958083002: PlzNavigate: Show error pages when the navigation failed before commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@support-data-urls
Patch Set: Updated test Created 5 years, 8 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 | « no previous file | content/browser/frame_host/navigation_request.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_side_navigation_browsertest.cc
diff --git a/content/browser/browser_side_navigation_browsertest.cc b/content/browser/browser_side_navigation_browsertest.cc
index 4bba0ee76dd9ff4a14b2d8efa812661ab8df9df6..61c002b90a0ef8463aff0ad6a28883b79f2e518c 100644
--- a/content/browser/browser_side_navigation_browsertest.cc
+++ b/content/browser/browser_side_navigation_browsertest.cc
@@ -15,6 +15,7 @@
#include "content/shell/browser/shell.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "net/test/url_request/url_request_failed_job.h"
#include "url/gurl.h"
namespace content {
@@ -159,4 +160,29 @@ IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest,
->GetFrameTree()->root()->current_frame_host());
}
+// Ensure that browser side navigation handles navigation failures.
+IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, FailedNavigation) {
+ // Perform a navigation with no live renderer.
+ {
+ TestNavigationObserver observer(shell()->web_contents());
+ GURL url(embedded_test_server()->GetURL("/title1.html"));
+ NavigateToURL(shell(), url);
+ EXPECT_EQ(url, observer.last_navigation_url());
+ EXPECT_TRUE(observer.last_navigation_succeeded());
+ }
+
+ // Now navigate to an unreachable url.
+ {
+ TestNavigationObserver observer(shell()->web_contents());
+ GURL error_url(
+ net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_CONNECTION_RESET));
+ net::URLRequestFailedJob::AddUrlHandler();
+ NavigateToURL(shell(), error_url);
+ EXPECT_EQ(error_url, observer.last_navigation_url());
+ NavigationEntry* entry =
+ shell()->web_contents()->GetController().GetLastCommittedEntry();
+ EXPECT_EQ(PAGE_TYPE_ERROR, entry->GetPageType());
+ }
+}
+
} // namespace content
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698