| 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 #include <set> | 6 #include <set> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1925 } | 1925 } |
| 1926 | 1926 |
| 1927 IN_PROC_BROWSER_TEST_P(WebViewTest, OpenURLFromTab_CurrentTab_Abort) { | 1927 IN_PROC_BROWSER_TEST_P(WebViewTest, OpenURLFromTab_CurrentTab_Abort) { |
| 1928 LoadAppWithGuest("web_view/simple"); | 1928 LoadAppWithGuest("web_view/simple"); |
| 1929 | 1929 |
| 1930 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will | 1930 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will |
| 1931 // navigate the current <webview>. | 1931 // navigate the current <webview>. |
| 1932 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false); | 1932 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false); |
| 1933 | 1933 |
| 1934 // Navigating to a file URL is forbidden inside a <webview>. | 1934 // Navigating to a file URL is forbidden inside a <webview>. |
| 1935 content::OpenURLParams params(GURL("file://foo"), | 1935 content::OpenURLParams params(GURL("file://foo"), content::Referrer(), |
| 1936 content::Referrer(), | 1936 WindowOpenDisposition::CURRENT_TAB, |
| 1937 CURRENT_TAB, | |
| 1938 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 1937 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 1939 true /* is_renderer_initiated */); | 1938 true /* is_renderer_initiated */); |
| 1940 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( | 1939 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( |
| 1941 GetGuestWebContents(), params); | 1940 GetGuestWebContents(), params); |
| 1942 | 1941 |
| 1943 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); | 1942 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); |
| 1944 | 1943 |
| 1945 // Verify that the <webview> ends up at about:blank. | 1944 // Verify that the <webview> ends up at about:blank. |
| 1946 EXPECT_EQ(GURL(url::kAboutBlankURL), | 1945 EXPECT_EQ(GURL(url::kAboutBlankURL), |
| 1947 GetGuestWebContents()->GetLastCommittedURL()); | 1946 GetGuestWebContents()->GetLastCommittedURL()); |
| 1948 } | 1947 } |
| 1949 | 1948 |
| 1950 // A navigation to a web-safe URL should succeed, even if it is not renderer- | 1949 // A navigation to a web-safe URL should succeed, even if it is not renderer- |
| 1951 // initiated, such as a navigation from the PDF viewer. | 1950 // initiated, such as a navigation from the PDF viewer. |
| 1952 IN_PROC_BROWSER_TEST_P(WebViewTest, OpenURLFromTab_CurrentTab_Succeed) { | 1951 IN_PROC_BROWSER_TEST_P(WebViewTest, OpenURLFromTab_CurrentTab_Succeed) { |
| 1953 LoadAppWithGuest("web_view/simple"); | 1952 LoadAppWithGuest("web_view/simple"); |
| 1954 | 1953 |
| 1955 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will | 1954 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will |
| 1956 // navigate the current <webview>. | 1955 // navigate the current <webview>. |
| 1957 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false); | 1956 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false); |
| 1958 | 1957 |
| 1959 GURL test_url("http://www.google.com"); | 1958 GURL test_url("http://www.google.com"); |
| 1960 content::OpenURLParams params(test_url, content::Referrer(), CURRENT_TAB, | 1959 content::OpenURLParams params( |
| 1961 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 1960 test_url, content::Referrer(), WindowOpenDisposition::CURRENT_TAB, |
| 1962 false /* is_renderer_initiated */); | 1961 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */); |
| 1963 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(GetGuestWebContents(), | 1962 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(GetGuestWebContents(), |
| 1964 params); | 1963 params); |
| 1965 | 1964 |
| 1966 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); | 1965 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); |
| 1967 | 1966 |
| 1968 EXPECT_EQ(test_url, GetGuestWebContents()->GetLastCommittedURL()); | 1967 EXPECT_EQ(test_url, GetGuestWebContents()->GetLastCommittedURL()); |
| 1969 } | 1968 } |
| 1970 | 1969 |
| 1971 IN_PROC_BROWSER_TEST_P(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) { | 1970 IN_PROC_BROWSER_TEST_P(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) { |
| 1972 LoadAppWithGuest("web_view/simple"); | 1971 LoadAppWithGuest("web_view/simple"); |
| 1973 | 1972 |
| 1974 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB | 1973 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB |
| 1975 // will trigger the <webview>'s New Window API. | 1974 // will trigger the <webview>'s New Window API. |
| 1976 ExtensionTestMessageListener new_window_listener( | 1975 ExtensionTestMessageListener new_window_listener( |
| 1977 "WebViewTest.NEWWINDOW", false); | 1976 "WebViewTest.NEWWINDOW", false); |
| 1978 | 1977 |
| 1979 // Navigating to a file URL is forbidden inside a <webview>. | 1978 // Navigating to a file URL is forbidden inside a <webview>. |
| 1980 content::OpenURLParams params(GURL("file://foo"), | 1979 content::OpenURLParams params(GURL("file://foo"), content::Referrer(), |
| 1981 content::Referrer(), | 1980 WindowOpenDisposition::NEW_BACKGROUND_TAB, |
| 1982 NEW_BACKGROUND_TAB, | |
| 1983 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 1981 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 1984 true /* is_renderer_initiated */); | 1982 true /* is_renderer_initiated */); |
| 1985 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( | 1983 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( |
| 1986 GetGuestWebContents(), params); | 1984 GetGuestWebContents(), params); |
| 1987 | 1985 |
| 1988 ASSERT_TRUE(new_window_listener.WaitUntilSatisfied()); | 1986 ASSERT_TRUE(new_window_listener.WaitUntilSatisfied()); |
| 1989 | 1987 |
| 1990 // Verify that a new guest was created. | 1988 // Verify that a new guest was created. |
| 1991 content::WebContents* new_guest_web_contents = | 1989 content::WebContents* new_guest_web_contents = |
| 1992 GetGuestViewManager()->GetLastGuestCreated(); | 1990 GetGuestViewManager()->GetLastGuestCreated(); |
| (...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3825 gfx::Point embedder_origin = | 3823 gfx::Point embedder_origin = |
| 3826 GetEmbedderWebContents()->GetContainerBounds().origin(); | 3824 GetEmbedderWebContents()->GetContainerBounds().origin(); |
| 3827 guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y()); | 3825 guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y()); |
| 3828 | 3826 |
| 3829 // Generate and send synthetic touch event. | 3827 // Generate and send synthetic touch event. |
| 3830 content::SimulateTouchPressAt(GetEmbedderWebContents(), | 3828 content::SimulateTouchPressAt(GetEmbedderWebContents(), |
| 3831 guest_rect.CenterPoint()); | 3829 guest_rect.CenterPoint()); |
| 3832 EXPECT_TRUE(aura_webview->HasFocus()); | 3830 EXPECT_TRUE(aura_webview->HasFocus()); |
| 3833 } | 3831 } |
| 3834 #endif | 3832 #endif |
| OLD | NEW |