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

Unified Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 1234403005: Don't refer browser-initiated navigations to web-safe URLs to delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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: chrome/browser/apps/guest_view/web_view_browsertest.cc
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc
index 6786241ddf747d59b89a796d0b3efccb3e7c075c..d4d5aaed955bf6bcf5ab2e8f7017c563f8971787 100644
--- a/chrome/browser/apps/guest_view/web_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -1593,6 +1593,31 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, OpenURLFromTab_CurrentTab_Abort) {
GetGuestWebContents()->GetLastCommittedURL());
}
+// A navigation to a web-safe URL should succeed, even if it is not renderer-
+// initiated, such as a navigation from the PDF viewer.
+IN_PROC_BROWSER_TEST_F(WebViewTest, OpenURLFromTab_CurrentTab_Succeed) {
+ LoadAppWithGuest("web_view/simple");
+
+ // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will
+ // navigate the current <webview>.
+ ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false);
+
+ GURL test_url("http://www.google.com");
+ // Navigating to a file URL is forbidden inside a <webview>.
Charlie Reis 2015/07/17 00:05:15 This comment is stale. The navigation is supposed
wjmaclean 2015/07/17 01:29:46 Done.
+ content::OpenURLParams params(test_url,
+ content::Referrer(),
+ CURRENT_TAB,
+ ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
+ false /* is_renderer_initiated */);
+ GetGuestWebContents()->GetDelegate()->OpenURLFromTab(
+ GetGuestWebContents(), params);
+
+ ASSERT_TRUE(load_listener.WaitUntilSatisfied());
+
+ // Verify that the <webview> ends up at about:blank.
Charlie Reis 2015/07/17 00:05:15 This comment is stale.
wjmaclean 2015/07/17 01:29:46 Done.
+ EXPECT_EQ(test_url, GetGuestWebContents()->GetLastCommittedURL());
+}
+
IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) {
LoadAppWithGuest("web_view/simple");

Powered by Google App Engine
This is Rietveld 408576698