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

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

Issue 1738233002: Disallow was_within_same_page = true for a cross-process navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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_unittest.cc
diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc
index 6121d1f19ce4fa9a97590146214daca9214e2339..cc13ca5e69e8e6e13cb5461f090dc91334958753 100644
--- a/content/browser/frame_host/navigation_controller_impl_unittest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc
@@ -3595,48 +3595,49 @@ TEST_F(NavigationControllerTest, IsInPageNavigation) {
const GURL blank_url(url::kAboutBlankURL);
main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, blank_url);
EXPECT_TRUE(controller.IsURLInPageNavigation(url, true,
- main_test_rfh()));
+ main_test_rfh(), false));
// Navigate to URL with no refs.
main_test_rfh()->NavigateAndCommitRendererInitiated(0, false, url);
// Reloading the page is not an in-page navigation.
- EXPECT_FALSE(controller.IsURLInPageNavigation(url, false, main_test_rfh()));
+ EXPECT_FALSE(controller.IsURLInPageNavigation(url, false, main_test_rfh(),
+ false));
const GURL other_url("http://www.google.com/add.html");
EXPECT_FALSE(controller.IsURLInPageNavigation(other_url, false,
- main_test_rfh()));
+ main_test_rfh(), false));
const GURL url_with_ref("http://www.google.com/home.html#my_ref");
EXPECT_TRUE(controller.IsURLInPageNavigation(url_with_ref, true,
- main_test_rfh()));
+ main_test_rfh(), false));
// Navigate to URL with refs.
main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url_with_ref);
// Reloading the page is not an in-page navigation.
EXPECT_FALSE(controller.IsURLInPageNavigation(url_with_ref, false,
- main_test_rfh()));
+ main_test_rfh(), false));
EXPECT_FALSE(controller.IsURLInPageNavigation(url, false,
- main_test_rfh()));
+ main_test_rfh(), false));
EXPECT_FALSE(controller.IsURLInPageNavigation(other_url, false,
- main_test_rfh()));
+ main_test_rfh(), false));
const GURL other_url_with_ref("http://www.google.com/home.html#my_other_ref");
EXPECT_TRUE(controller.IsURLInPageNavigation(other_url_with_ref, true,
- main_test_rfh()));
+ main_test_rfh(), false));
// 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,
- main_test_rfh()));
+ main_test_rfh(), false));
// 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,
- main_test_rfh()));
+ main_test_rfh(), false));
// If the renderer says this is a same-origin in-page navigation, believe it.
// This is the pushState/replaceState case.
EXPECT_TRUE(controller.IsURLInPageNavigation(other_url, true,
- main_test_rfh()));
+ main_test_rfh(), false));
// Don't believe the renderer if it claims a cross-origin navigation is
// in-page.
@@ -3644,7 +3645,7 @@ TEST_F(NavigationControllerTest, IsInPageNavigation) {
MockRenderProcessHost* rph = main_test_rfh()->GetProcess();
EXPECT_EQ(0, rph->bad_msg_count());
EXPECT_FALSE(controller.IsURLInPageNavigation(different_origin_url, true,
- main_test_rfh()));
+ main_test_rfh(), false));
EXPECT_EQ(1, rph->bad_msg_count());
}
@@ -3670,7 +3671,7 @@ TEST_F(NavigationControllerTest, IsInPageNavigationWithUniversalFileAccess) {
main_test_rfh()->frame_tree_node()->current_origin()));
EXPECT_EQ(0, rph->bad_msg_count());
EXPECT_TRUE(controller.IsURLInPageNavigation(different_origin_url, true,
- main_test_rfh()));
+ main_test_rfh(), false));
EXPECT_EQ(0, rph->bad_msg_count());
// Doing a replaceState to a cross-origin URL is thus allowed.
@@ -3696,7 +3697,7 @@ TEST_F(NavigationControllerTest, IsInPageNavigationWithUniversalFileAccess) {
EXPECT_TRUE(file_origin.IsSameOriginWith(
main_test_rfh()->frame_tree_node()->current_origin()));
EXPECT_TRUE(
- controller.IsURLInPageNavigation(file_url, true, main_test_rfh()));
+ controller.IsURLInPageNavigation(file_url, true, main_test_rfh(), false));
EXPECT_EQ(0, rph->bad_msg_count());
// Don't honor allow_universal_access_from_file_urls if actual URL is
@@ -3704,7 +3705,7 @@ TEST_F(NavigationControllerTest, IsInPageNavigationWithUniversalFileAccess) {
const GURL url("http://www.google.com/home.html");
main_test_rfh()->NavigateAndCommitRendererInitiated(2, true, url);
EXPECT_FALSE(controller.IsURLInPageNavigation(different_origin_url, true,
- main_test_rfh()));
+ main_test_rfh(), false));
EXPECT_EQ(1, rph->bad_msg_count());
}

Powered by Google App Engine
This is Rietveld 408576698