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

Side by Side Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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
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 #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 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 } 1932 }
1933 1933
1934 IN_PROC_BROWSER_TEST_P(WebViewTest, OpenURLFromTab_CurrentTab_Abort) { 1934 IN_PROC_BROWSER_TEST_P(WebViewTest, OpenURLFromTab_CurrentTab_Abort) {
1935 LoadAppWithGuest("web_view/simple"); 1935 LoadAppWithGuest("web_view/simple");
1936 1936
1937 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will 1937 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will
1938 // navigate the current <webview>. 1938 // navigate the current <webview>.
1939 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false); 1939 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false);
1940 1940
1941 // Navigating to a file URL is forbidden inside a <webview>. 1941 // Navigating to a file URL is forbidden inside a <webview>.
1942 content::OpenURLParams params(GURL("file://foo"), 1942 content::OpenURLParams params(GURL("file://foo"), content::Referrer(),
1943 content::Referrer(), 1943 WindowOpenDisposition::CURRENT_TAB,
1944 CURRENT_TAB,
1945 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 1944 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
1946 true /* is_renderer_initiated */); 1945 true /* is_renderer_initiated */);
1947 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( 1946 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(
1948 GetGuestWebContents(), params); 1947 GetGuestWebContents(), params);
1949 1948
1950 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); 1949 ASSERT_TRUE(load_listener.WaitUntilSatisfied());
1951 1950
1952 // Verify that the <webview> ends up at about:blank. 1951 // Verify that the <webview> ends up at about:blank.
1953 EXPECT_EQ(GURL(url::kAboutBlankURL), 1952 EXPECT_EQ(GURL(url::kAboutBlankURL),
1954 GetGuestWebContents()->GetLastCommittedURL()); 1953 GetGuestWebContents()->GetLastCommittedURL());
1955 } 1954 }
1956 1955
1957 // A navigation to a web-safe URL should succeed, even if it is not renderer- 1956 // A navigation to a web-safe URL should succeed, even if it is not renderer-
1958 // initiated, such as a navigation from the PDF viewer. 1957 // initiated, such as a navigation from the PDF viewer.
1959 IN_PROC_BROWSER_TEST_P(WebViewTest, OpenURLFromTab_CurrentTab_Succeed) { 1958 IN_PROC_BROWSER_TEST_P(WebViewTest, OpenURLFromTab_CurrentTab_Succeed) {
1960 LoadAppWithGuest("web_view/simple"); 1959 LoadAppWithGuest("web_view/simple");
1961 1960
1962 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will 1961 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will
1963 // navigate the current <webview>. 1962 // navigate the current <webview>.
1964 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false); 1963 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false);
1965 1964
1966 GURL test_url("http://www.google.com"); 1965 GURL test_url("http://www.google.com");
1967 content::OpenURLParams params(test_url, content::Referrer(), CURRENT_TAB, 1966 content::OpenURLParams params(
1968 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 1967 test_url, content::Referrer(), WindowOpenDisposition::CURRENT_TAB,
1969 false /* is_renderer_initiated */); 1968 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */);
1970 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(GetGuestWebContents(), 1969 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(GetGuestWebContents(),
1971 params); 1970 params);
1972 1971
1973 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); 1972 ASSERT_TRUE(load_listener.WaitUntilSatisfied());
1974 1973
1975 EXPECT_EQ(test_url, GetGuestWebContents()->GetLastCommittedURL()); 1974 EXPECT_EQ(test_url, GetGuestWebContents()->GetLastCommittedURL());
1976 } 1975 }
1977 1976
1978 IN_PROC_BROWSER_TEST_P(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) { 1977 IN_PROC_BROWSER_TEST_P(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) {
1979 LoadAppWithGuest("web_view/simple"); 1978 LoadAppWithGuest("web_view/simple");
1980 1979
1981 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB 1980 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB
1982 // will trigger the <webview>'s New Window API. 1981 // will trigger the <webview>'s New Window API.
1983 ExtensionTestMessageListener new_window_listener( 1982 ExtensionTestMessageListener new_window_listener(
1984 "WebViewTest.NEWWINDOW", false); 1983 "WebViewTest.NEWWINDOW", false);
1985 1984
1986 // Navigating to a file URL is forbidden inside a <webview>. 1985 // Navigating to a file URL is forbidden inside a <webview>.
1987 content::OpenURLParams params(GURL("file://foo"), 1986 content::OpenURLParams params(GURL("file://foo"), content::Referrer(),
1988 content::Referrer(), 1987 WindowOpenDisposition::NEW_BACKGROUND_TAB,
1989 NEW_BACKGROUND_TAB,
1990 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 1988 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
1991 true /* is_renderer_initiated */); 1989 true /* is_renderer_initiated */);
1992 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( 1990 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(
1993 GetGuestWebContents(), params); 1991 GetGuestWebContents(), params);
1994 1992
1995 ASSERT_TRUE(new_window_listener.WaitUntilSatisfied()); 1993 ASSERT_TRUE(new_window_listener.WaitUntilSatisfied());
1996 1994
1997 // Verify that a new guest was created. 1995 // Verify that a new guest was created.
1998 content::WebContents* new_guest_web_contents = 1996 content::WebContents* new_guest_web_contents =
1999 GetGuestViewManager()->GetLastGuestCreated(); 1997 GetGuestViewManager()->GetLastGuestCreated();
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after
3832 gfx::Point embedder_origin = 3830 gfx::Point embedder_origin =
3833 GetEmbedderWebContents()->GetContainerBounds().origin(); 3831 GetEmbedderWebContents()->GetContainerBounds().origin();
3834 guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y()); 3832 guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y());
3835 3833
3836 // Generate and send synthetic touch event. 3834 // Generate and send synthetic touch event.
3837 content::SimulateTouchPressAt(GetEmbedderWebContents(), 3835 content::SimulateTouchPressAt(GetEmbedderWebContents(),
3838 guest_rect.CenterPoint()); 3836 guest_rect.CenterPoint());
3839 EXPECT_TRUE(aura_webview->HasFocus()); 3837 EXPECT_TRUE(aura_webview->HasFocus());
3840 } 3838 }
3841 #endif 3839 #endif
OLDNEW
« no previous file with comments | « chrome/browser/apps/app_window_browsertest.cc ('k') | chrome/browser/apps/install_chrome_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698