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

Unified Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Rebase. Created 3 years, 10 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: 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 d361fefda9c53fe8b511c9ab578d450f32ff8f24..ce03886f425f4ecad03660e461a4a040d968ad7b 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -6152,17 +6152,47 @@ 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());
+ if (IsBrowserSideNavigationEnabled()) {
+ // With browser-side-navigation, the history navigation is dropped.
+ EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
+ EXPECT_EQ(2, 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(cross_origin_url.GetOrigin().spec(), origin + "/");
- // 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 + "/");
+ // Navigate back again.
+ web_contents->GetController().GoBack();
+ EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
+ EXPECT_EQ(1, 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.
+ EXPECT_TRUE(ExecuteScriptAndExtractString(
+ web_contents, "domAutomationController.send(document.origin)",
+ &origin));
+ EXPECT_EQ(same_page_url.GetOrigin().spec(), origin + "/");
+ } 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
« no previous file with comments | « content/browser/frame_host/frame_tree_node.cc ('k') | content/browser/frame_host/navigation_controller_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698