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

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: Readability. Bringing back removed TC. 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..f172366313aaf297f2d98ccd73b135c82e8a6381 100644
--- a/content/browser/web_contents/navigation_controller_impl_unittest.cc
+++ b/content/browser/web_contents/navigation_controller_impl_unittest.cc
@@ -1921,6 +1921,7 @@ TEST_F(NavigationControllerTest, InPage) {
params.gesture = NavigationGestureUser;
params.is_post = false;
params.page_state = PageState::CreateFromURL(url2);
+ params.was_within_same_page = true;
// This should generate a new entry.
EXPECT_TRUE(controller.RendererDidNavigate(params, &details));
@@ -1938,9 +1939,7 @@ TEST_F(NavigationControllerTest, InPage) {
EXPECT_TRUE(controller.RendererDidNavigate(back_params, &details));
EXPECT_EQ(1U, navigation_entry_committed_counter_);
navigation_entry_committed_counter_ = 0;
- // is_in_page is false in that case but should be true.
- // See comment in AreURLsInPageNavigation() in navigation_controller.cc
- // EXPECT_TRUE(details.is_in_page);
+ EXPECT_TRUE(details.is_in_page);
EXPECT_EQ(2, controller.GetEntryCount());
EXPECT_EQ(0, controller.GetCurrentEntryIndex());
EXPECT_EQ(back_params.url, controller.GetActiveEntry()->GetURL());
@@ -2755,8 +2754,17 @@ TEST_F(NavigationControllerTest, IsInPageNavigation) {
EXPECT_FALSE(controller.IsURLInPageNavigation(url));
EXPECT_FALSE(controller.IsURLInPageNavigation(other_url));
const GURL other_url_with_ref("http://www.google.com/home.html#my_other_ref");
- EXPECT_TRUE(controller.IsURLInPageNavigation(
- other_url_with_ref));
+ EXPECT_TRUE(controller.IsURLInPageNavigation(other_url_with_ref));
+
+ // Going to the same url again will be considered in-page
+ // if the renderer says it is even if the navigation type isn't IN_PAGE.
+ EXPECT_TRUE(controller.IsURLInPageNavigation(url_with_ref, true,
+ NAVIGATION_TYPE_UNKNOWN));
+
+ // Going back to the non ref url will be considered in-page if the navigation
+ // type is IN_PAGE.
+ EXPECT_TRUE(controller.IsURLInPageNavigation(url, true,
+ NAVIGATION_TYPE_IN_PAGE));
}
// Some pages can have subframes with the same base URL (minus the reference) as

Powered by Google App Engine
This is Rietveld 408576698