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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <queue> 5 #include <queue>
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( 1586 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(
1587 GetGuestWebContents(), params); 1587 GetGuestWebContents(), params);
1588 1588
1589 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); 1589 ASSERT_TRUE(load_listener.WaitUntilSatisfied());
1590 1590
1591 // Verify that the <webview> ends up at about:blank. 1591 // Verify that the <webview> ends up at about:blank.
1592 EXPECT_EQ(GURL(url::kAboutBlankURL), 1592 EXPECT_EQ(GURL(url::kAboutBlankURL),
1593 GetGuestWebContents()->GetLastCommittedURL()); 1593 GetGuestWebContents()->GetLastCommittedURL());
1594 } 1594 }
1595 1595
1596 // A navigation to a web-safe URL should succeed, even if it is not renderer-
1597 // initiated, such as a navigation from the PDF viewer.
1598 IN_PROC_BROWSER_TEST_F(WebViewTest, OpenURLFromTab_CurrentTab_Succeed) {
1599 LoadAppWithGuest("web_view/simple");
1600
1601 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will
1602 // navigate the current <webview>.
1603 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false);
1604
1605 GURL test_url("http://www.google.com");
1606 content::OpenURLParams params(test_url,
1607 content::Referrer(),
1608 CURRENT_TAB,
1609 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
1610 false /* is_renderer_initiated */);
1611 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(
1612 GetGuestWebContents(), params);
1613
1614 ASSERT_TRUE(load_listener.WaitUntilSatisfied());
1615
1616 EXPECT_EQ(test_url, GetGuestWebContents()->GetLastCommittedURL());
1617 }
1618
1596 IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) { 1619 IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) {
1597 LoadAppWithGuest("web_view/simple"); 1620 LoadAppWithGuest("web_view/simple");
1598 1621
1599 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB 1622 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB
1600 // will trigger the <webview>'s New Window API. 1623 // will trigger the <webview>'s New Window API.
1601 ExtensionTestMessageListener new_window_listener( 1624 ExtensionTestMessageListener new_window_listener(
1602 "WebViewTest.NEWWINDOW", false); 1625 "WebViewTest.NEWWINDOW", false);
1603 1626
1604 // Navigating to a file URL is forbidden inside a <webview>. 1627 // Navigating to a file URL is forbidden inside a <webview>.
1605 content::OpenURLParams params(GURL("file://foo"), 1628 content::OpenURLParams params(GURL("file://foo"),
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 // Generate and send synthetic touch event. 2590 // Generate and send synthetic touch event.
2568 FocusWaiter waiter(aura_webview); 2591 FocusWaiter waiter(aura_webview);
2569 content::SimulateTouchPressAt(GetEmbedderWebContents(), 2592 content::SimulateTouchPressAt(GetEmbedderWebContents(),
2570 guest_rect.CenterPoint()); 2593 guest_rect.CenterPoint());
2571 2594
2572 // Wait for the TouchStart to propagate and restore focus. Test times out 2595 // Wait for the TouchStart to propagate and restore focus. Test times out
2573 // on failure. 2596 // on failure.
2574 waiter.Wait(); 2597 waiter.Wait();
2575 } 2598 }
2576 #endif 2599 #endif
OLDNEW
« 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