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

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

Issue 6296011: Fix for regression: Any window of type APP should create APP_POPUP windows. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add BrowserNavigatorTest.Disposition_NewPopupFromAppPopup Created 9 years, 11 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
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f775223d4157372d4ca593fd57f9f237f712f44b..3fdf22f023df6185f8741c2659885d45e5763aa0 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -261,6 +261,30 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup) {
}
// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
+// from a normal popup results in a new Browser with TYPE_POPUP.
+IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupFromPopup) {
+ // Open a popup.
+ browser::NavigateParams p1(MakeNavigateParams());
+ p1.disposition = NEW_POPUP;
+ browser::Navigate(&p1);
+ // Open another popup.
+ browser::NavigateParams p2(MakeNavigateParams(p1.browser));
+ p2.disposition = NEW_POPUP;
+ browser::Navigate(&p2);
+
+ // Navigate() should have opened a new normal popup window.
+ EXPECT_NE(p1.browser, p2.browser);
+ EXPECT_EQ(Browser::TYPE_POPUP, p2.browser->type());
+
+ // We should have three windows, the browser() provided by the framework,
+ // the first popup window, and the second popup window.
+ EXPECT_EQ(3u, BrowserList::size());
+ EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, p1.browser->tab_count());
+ EXPECT_EQ(1, p2.browser->tab_count());
+}
+
+// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
// from an app frame results in a new Browser with TYPE_APP_POPUP.
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_NewPopupFromAppWindow) {
@@ -284,6 +308,35 @@ 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.
+IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
+ Disposition_NewPopupFromAppPopup) {
+ Browser* app_browser = CreateEmptyBrowserForType(Browser::TYPE_APP,
+ browser()->profile());
+ // Open an app popup.
+ browser::NavigateParams p1(MakeNavigateParams(app_browser));
+ p1.disposition = NEW_POPUP;
+ browser::Navigate(&p1);
+ // Now open another app popup.
+ browser::NavigateParams p2(MakeNavigateParams(p1.browser));
+ p2.disposition = NEW_POPUP;
+ browser::Navigate(&p2);
+
+ // Navigate() should have opened a new popup app window.
+ EXPECT_NE(browser(), p1.browser);
+ EXPECT_NE(p1.browser, p2.browser);
+ EXPECT_EQ(Browser::TYPE_APP_POPUP, p2.browser->type());
+
+ // We should now have four windows, the app window, the first app popup,
+ // the second app popup, and the original browser() provided by the framework.
+ EXPECT_EQ(4u, BrowserList::size());
+ EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, app_browser->tab_count());
+ EXPECT_EQ(1, p1.browser->tab_count());
+ EXPECT_EQ(1, p2.browser->tab_count());
+}
+
+// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
// from an extension app tab results in a new Browser with TYPE_APP_POPUP.
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_NewPopupFromExtensionApp) {
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698