Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc |
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
index af3a4999865428e40593d9cde1d99fc5b55f3435..084ae088b29789d2fd57694157bf7b0ab10c0f17 100644 |
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
@@ -2331,7 +2331,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
} |
// Ensure that we don't crash when navigating subframes after in-page |
-// navigations. See https://crbug.com/522193. |
+// navigations. See https://crbug.com/522193. |
nasko
2017/01/13 19:36:56
nit: No need for just empty space change.
arthursonzogni
2017/01/17 15:24:47
Done.
|
IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
FrameNavigationEntry_SubframeAfterInPage) { |
// 1. Start on a page with a subframe. |
@@ -6166,17 +6166,35 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(cross_origin_url, web_contents->GetLastCommittedURL()); |
EXPECT_EQ(2, web_contents->GetController().GetLastCommittedEntryIndex()); |
- // Wait for the back navigation to commit as well. |
- history_commit_observer.Wait(); |
- EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); |
- EXPECT_EQ(0, web_contents->GetController().GetLastCommittedEntryIndex()); |
- |
- // Verify the expected origin through JavaScript. It also has the additional |
- // verification of the process also being still alive. |
- std::string origin; |
- EXPECT_TRUE(ExecuteScriptAndExtractString( |
- web_contents, "domAutomationController.send(document.origin)", &origin)); |
- EXPECT_EQ(start_url.GetOrigin().spec(), origin + "/"); |
+ if (IsBrowserSideNavigationEnabled()) { |
+ // With browser-side-navigation, the history navigation is dropped. |
+ // Navigate to another URL to give the back navigation the opportunity to |
+ // commit if it was not dropped. |
+ GURL start_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
+ EXPECT_TRUE(NavigateToURL(shell(), start_url)); |
+ EXPECT_EQ(3, web_contents->GetController().GetLastCommittedEntryIndex()); |
+ EXPECT_EQ(4, web_contents->GetController().GetEntryCount()); |
+ |
+ // Check that the renderer is still alive. |
+ std::string is_alive; |
+ EXPECT_TRUE(ExecuteScriptAndExtractString( |
+ web_contents, "domAutomationController.send('alive')", &is_alive)); |
nasko
2017/01/13 19:36:56
Why not use the origin? It gives you extra informa
arthursonzogni
2017/01/17 15:24:47
Done.
|
+ EXPECT_EQ("alive", is_alive); |
+ } else { |
+ // Wait for the back navigation to commit as well. |
+ history_commit_observer.Wait(); |
+ EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); |
+ EXPECT_EQ(0, web_contents->GetController().GetLastCommittedEntryIndex()); |
+ EXPECT_EQ(3, web_contents->GetController().GetEntryCount()); |
+ |
+ // Verify the expected origin through JavaScript. It also has the additional |
+ // verification of the process also being still alive. |
+ std::string origin; |
+ EXPECT_TRUE(ExecuteScriptAndExtractString( |
+ web_contents, "domAutomationController.send(document.origin)", |
+ &origin)); |
+ EXPECT_EQ(start_url.GetOrigin().spec(), origin + "/"); |
+ } |
} |
// Test that verifies that Referer and Origin http headers are correctly sent |