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

Unified Diff: content/browser/web_contents/navigation_controller_impl_unittest.cc

Issue 21544005: Take the navigation type into account when checking if the navigation is in page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing an approach a bit. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/navigation_controller_impl_unittest.cc
diff --git a/content/browser/web_contents/navigation_controller_impl_unittest.cc b/content/browser/web_contents/navigation_controller_impl_unittest.cc
index a1904d04e2de3d9da87c046157cdf89cb64bbf2a..0bd6521dcafd634b6454afaa4750ef902e8ee4dd 100644
--- a/content/browser/web_contents/navigation_controller_impl_unittest.cc
+++ b/content/browser/web_contents/navigation_controller_impl_unittest.cc
@@ -1959,6 +1959,31 @@ TEST_F(NavigationControllerTest, InPage) {
EXPECT_EQ(forward_params.url,
controller.GetActiveEntry()->GetURL());
+ // Go back and forward again. This time renderer claims it's in page
+ // navigation.
+ ViewHostMsg_FrameNavigate_Params second_back_params(back_params);
+ second_back_params.was_within_same_page = true;
+ controller.GoBack();
+ EXPECT_TRUE(controller.RendererDidNavigate(second_back_params, &details));
+ EXPECT_EQ(1U, navigation_entry_committed_counter_);
+ navigation_entry_committed_counter_ = 0;
+ EXPECT_TRUE(details.is_in_page);
+ EXPECT_EQ(2, controller.GetEntryCount());
+ EXPECT_EQ(0, controller.GetCurrentEntryIndex());
+ EXPECT_EQ(second_back_params.url, controller.GetActiveEntry()->GetURL());
+
+ ViewHostMsg_FrameNavigate_Params second_forward_params(forward_params);
+ second_forward_params.was_within_same_page = true;
+ controller.GoForward();
+ EXPECT_TRUE(controller.RendererDidNavigate(second_forward_params, &details));
+ EXPECT_EQ(1U, navigation_entry_committed_counter_);
+ navigation_entry_committed_counter_ = 0;
+ EXPECT_TRUE(details.is_in_page);
+ EXPECT_EQ(2, controller.GetEntryCount());
+ EXPECT_EQ(1, controller.GetCurrentEntryIndex());
+ EXPECT_EQ(second_forward_params.url,
+ controller.GetActiveEntry()->GetURL());
+
// Now go back and forward again. This is to work around a bug where we would
// compare the incoming URL with the last committed entry rather than the
// one identified by an existing page ID. This would result in the second URL

Powered by Google App Engine
This is Rietveld 408576698