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

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: Improve comments. 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
« no previous file with comments | « no previous file | extensions/browser/guest_view/web_view/web_view_guest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..379633d7a4eb0ef8736c4beb9143cbe934387403 100644
--- a/chrome/browser/apps/guest_view/web_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -1593,6 +1593,29 @@ 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");
+ 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());
+
+ EXPECT_EQ(test_url, GetGuestWebContents()->GetLastCommittedURL());
+}
+
IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) {
LoadAppWithGuest("web_view/simple");
« no previous file with comments | « no previous file | extensions/browser/guest_view/web_view/web_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698