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

Unified Diff: chrome/browser/ui/browser_navigator_browsertest.cc

Issue 187443008: Elim Browser::AppType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add non trusted type test Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
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) {
« no previous file with comments | « chrome/browser/ui/browser_navigator_browsertest.h ('k') | chrome/browser/ui/browser_tab_restore_service_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698