Index: chrome/browser/ui/browser_navigator_browsertest.cc |
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc |
index 434001cf5542b36946aa3551951294a0f10f539b..d66953a5ed81abd6e3ed0d21e5f086863a8e03bc 100644 |
--- a/chrome/browser/ui/browser_navigator_browsertest.cc |
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc |
@@ -116,8 +116,7 @@ Browser* BrowserNavigatorTest::CreateEmptyBrowserForType(Browser::Type type, |
return browser; |
} |
-Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Browser::Type type, |
- Profile* profile) { |
+Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Profile* profile) { |
Browser* browser = new Browser( |
Browser::CreateParams::CreateForApp( |
Browser::TYPE_POPUP, "Test", gfx::Rect(), profile, |
@@ -453,6 +452,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup) { |
EXPECT_TRUE(p.browser->window()->IsActive()); |
#endif |
EXPECT_TRUE(p.browser->is_type_popup()); |
+ EXPECT_EQ(Browser::TYPE_POPUP, p.browser->type()); |
EXPECT_FALSE(p.browser->is_app()); |
// We should have two windows, the browser() provided by the framework and the |
@@ -512,11 +512,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupFromPopup) { |
} |
// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
-// from an app frame results in a new Browser with TYPE_APP_POPUP. |
+// from an app frame results in a new Browser with TYPE_POPUP. |
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
Disposition_NewPopupFromAppWindow) { |
- Browser* app_browser = CreateEmptyBrowserForApp(Browser::TYPE_TABBED, |
- browser()->profile()); |
+ Browser* app_browser = CreateEmptyBrowserForApp(browser()->profile()); |
chrome::NavigateParams p(MakeNavigateParams(app_browser)); |
p.disposition = NEW_POPUP; |
p.window_bounds = gfx::Rect(0, 0, 200, 200); |
@@ -537,11 +536,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
} |
// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
-// from an app popup results in a new Browser also of TYPE_APP_POPUP. |
+// from an app popup results in a new Browser also of TYPE_POPUP. |
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
Disposition_NewPopupFromAppPopup) { |
- Browser* app_browser = CreateEmptyBrowserForApp(Browser::TYPE_TABBED, |
- browser()->profile()); |
+ Browser* app_browser = CreateEmptyBrowserForApp(browser()->profile()); |
// Open an app popup. |
chrome::NavigateParams p1(MakeNavigateParams(app_browser)); |
p1.disposition = NEW_POPUP; |
@@ -594,6 +592,23 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupUnfocused) { |
#endif |
} |
+// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
+// and is_trusted = true results in a new Browser with TYPE_TRUSTED_POPUP. |
+IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupTrusted) { |
+ chrome::NavigateParams p(MakeNavigateParams()); |
+ p.disposition = NEW_POPUP; |
+ p.is_trusted = true; |
+ p.window_bounds = gfx::Rect(0, 0, 200, 200); |
+ // Wait for new popup to to load and gain focus. |
+ ui_test_utils::NavigateToURL(&p); |
+ |
+ // Navigate() should have opened a new popup window of TYPE_TRUSTED_POPUP. |
+ EXPECT_NE(browser(), p.browser); |
+ EXPECT_TRUE(p.browser->is_type_popup()); |
+ EXPECT_EQ(Browser::TYPE_TRUSTED_POPUP, p.browser->type()); |
+} |
+ |
+ |
// This test verifies that navigating with WindowOpenDisposition = NEW_WINDOW |
// always opens a new window. |
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewWindow) { |