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

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

Issue 855883002: Allow universal access from file if flag is set and url is file scheme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit tests Created 5 years, 11 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 dfdfde7380e4576f58adaf3431adcd07af0fdebb..dce814d96bd6da5d12952ab3afd7323dce096949 100644
--- a/content/browser/frame_host/navigation_controller_impl_unittest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc
@@ -3205,6 +3205,29 @@ TEST_F(NavigationControllerTest, IsInPageNavigation) {
EXPECT_FALSE(controller.IsURLInPageNavigation(different_origin_url, true,
main_test_rfh()));
EXPECT_EQ(1, rph->bad_msg_count());
+
+ // Test allow_universal_access_from_file_urls flag
Charlie Reis 2015/01/23 06:53:37 nit: End with period.
nhu 2015/01/23 13:41:13 Done.
+ WebPreferences prefs =
+ main_test_rfh()->GetRenderViewHost()->GetWebkitPreferences();
Charlie Reis 2015/01/23 06:53:37 test_rvh() (here and below)
nhu 2015/01/23 13:41:13 Done.
+ EXPECT_EQ(false, prefs.allow_universal_access_from_file_urls);
+ prefs.allow_universal_access_from_file_urls = true;
+ main_test_rfh()->GetRenderViewHost()->UpdateWebkitPreferences(prefs);
+ prefs =
+ main_test_rfh()->GetRenderViewHost()->GetWebkitPreferences();
+ EXPECT_EQ(true, prefs.allow_universal_access_from_file_urls);
+ // Don't hornor allow_universal_access_from_file_urls if existing URL is
Charlie Reis 2015/01/23 06:53:37 honor
nhu 2015/01/23 13:41:13 Done.
+ // not file scheme.
+ EXPECT_EQ(1, rph->bad_msg_count());
+ EXPECT_FALSE(controller.IsURLInPageNavigation(different_origin_url, true,
+ main_test_rfh()));
+ EXPECT_EQ(2, rph->bad_msg_count());
+ // Allow in page navigation if existing URL is file scheme.
Charlie Reis 2015/01/23 06:53:37 Move this case above the bad_msg_count case, so th
nhu 2015/01/23 13:41:13 It makes sense. I reordered them. Does it look bet
+ const GURL file_url("file:///foo/index.html");
+ main_test_rfh()->SendNavigate(0, file_url);
+ EXPECT_EQ(2, rph->bad_msg_count());
+ EXPECT_TRUE(controller.IsURLInPageNavigation(different_origin_url, true,
+ main_test_rfh()));
+ EXPECT_EQ(2, rph->bad_msg_count());
}
// Some pages can have subframes with the same base URL (minus the reference) as

Powered by Google App Engine
This is Rietveld 408576698