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 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( | 1616 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( |
1617 GetGuestWebContents(), params); | 1617 GetGuestWebContents(), params); |
1618 | 1618 |
1619 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); | 1619 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); |
1620 | 1620 |
1621 // Verify that the <webview> ends up at about:blank. | 1621 // Verify that the <webview> ends up at about:blank. |
1622 EXPECT_EQ(GURL(url::kAboutBlankURL), | 1622 EXPECT_EQ(GURL(url::kAboutBlankURL), |
1623 GetGuestWebContents()->GetLastCommittedURL()); | 1623 GetGuestWebContents()->GetLastCommittedURL()); |
1624 } | 1624 } |
1625 | 1625 |
| 1626 // A navigation to a web-safe URL should succeed, even if it is not renderer- |
| 1627 // initiated, such as a navigation from the PDF viewer. |
| 1628 IN_PROC_BROWSER_TEST_F(WebViewTest, OpenURLFromTab_CurrentTab_Succeed) { |
| 1629 LoadAppWithGuest("web_view/simple"); |
| 1630 |
| 1631 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will |
| 1632 // navigate the current <webview>. |
| 1633 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false); |
| 1634 |
| 1635 GURL test_url("http://www.google.com"); |
| 1636 content::OpenURLParams params(test_url, content::Referrer(), CURRENT_TAB, |
| 1637 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 1638 false /* is_renderer_initiated */); |
| 1639 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(GetGuestWebContents(), |
| 1640 params); |
| 1641 |
| 1642 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); |
| 1643 |
| 1644 EXPECT_EQ(test_url, GetGuestWebContents()->GetLastCommittedURL()); |
| 1645 } |
| 1646 |
1626 IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) { | 1647 IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) { |
1627 LoadAppWithGuest("web_view/simple"); | 1648 LoadAppWithGuest("web_view/simple"); |
1628 | 1649 |
1629 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB | 1650 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB |
1630 // will trigger the <webview>'s New Window API. | 1651 // will trigger the <webview>'s New Window API. |
1631 ExtensionTestMessageListener new_window_listener( | 1652 ExtensionTestMessageListener new_window_listener( |
1632 "WebViewTest.NEWWINDOW", false); | 1653 "WebViewTest.NEWWINDOW", false); |
1633 | 1654 |
1634 // Navigating to a file URL is forbidden inside a <webview>. | 1655 // Navigating to a file URL is forbidden inside a <webview>. |
1635 content::OpenURLParams params(GURL("file://foo"), | 1656 content::OpenURLParams params(GURL("file://foo"), |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2742 const task_management::Task* task = task_manager.tasks().back(); | 2763 const task_management::Task* task = task_manager.tasks().back(); |
2743 EXPECT_EQ(task_management::Task::GUEST, task->GetType()); | 2764 EXPECT_EQ(task_management::Task::GUEST, task->GetType()); |
2744 const base::string16 title = task->title(); | 2765 const base::string16 title = task->title(); |
2745 const base::string16 expected_prefix = GetExpectedPrefix(guest_contents); | 2766 const base::string16 expected_prefix = GetExpectedPrefix(guest_contents); |
2746 EXPECT_TRUE(base::StartsWith(title, | 2767 EXPECT_TRUE(base::StartsWith(title, |
2747 expected_prefix, | 2768 expected_prefix, |
2748 base::CompareCase::INSENSITIVE_ASCII)); | 2769 base::CompareCase::INSENSITIVE_ASCII)); |
2749 } | 2770 } |
2750 | 2771 |
2751 #endif // defined(ENABLE_TASK_MANAGER) | 2772 #endif // defined(ENABLE_TASK_MANAGER) |
OLD | NEW |