Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 // 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.
| |
| 1607 content::OpenURLParams params(test_url, | |
| 1608 content::Referrer(), | |
| 1609 CURRENT_TAB, | |
| 1610 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | |
| 1611 false /* is_renderer_initiated */); | |
| 1612 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( | |
| 1613 GetGuestWebContents(), params); | |
| 1614 | |
| 1615 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); | |
| 1616 | |
| 1617 // 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.
| |
| 1618 EXPECT_EQ(test_url, GetGuestWebContents()->GetLastCommittedURL()); | |
| 1619 } | |
| 1620 | |
| 1596 IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) { | 1621 IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) { |
| 1597 LoadAppWithGuest("web_view/simple"); | 1622 LoadAppWithGuest("web_view/simple"); |
| 1598 | 1623 |
| 1599 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB | 1624 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB |
| 1600 // will trigger the <webview>'s New Window API. | 1625 // will trigger the <webview>'s New Window API. |
| 1601 ExtensionTestMessageListener new_window_listener( | 1626 ExtensionTestMessageListener new_window_listener( |
| 1602 "WebViewTest.NEWWINDOW", false); | 1627 "WebViewTest.NEWWINDOW", false); |
| 1603 | 1628 |
| 1604 // Navigating to a file URL is forbidden inside a <webview>. | 1629 // Navigating to a file URL is forbidden inside a <webview>. |
| 1605 content::OpenURLParams params(GURL("file://foo"), | 1630 content::OpenURLParams params(GURL("file://foo"), |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2567 // Generate and send synthetic touch event. | 2592 // Generate and send synthetic touch event. |
| 2568 FocusWaiter waiter(aura_webview); | 2593 FocusWaiter waiter(aura_webview); |
| 2569 content::SimulateTouchPressAt(GetEmbedderWebContents(), | 2594 content::SimulateTouchPressAt(GetEmbedderWebContents(), |
| 2570 guest_rect.CenterPoint()); | 2595 guest_rect.CenterPoint()); |
| 2571 | 2596 |
| 2572 // Wait for the TouchStart to propagate and restore focus. Test times out | 2597 // Wait for the TouchStart to propagate and restore focus. Test times out |
| 2573 // on failure. | 2598 // on failure. |
| 2574 waiter.Wait(); | 2599 waiter.Wait(); |
| 2575 } | 2600 } |
| 2576 #endif | 2601 #endif |
| OLD | NEW |