summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/browser_navigator_browsertest.cc
diff options
context:
space:
mode:
authorstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 23:57:57 +0000
committerstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 23:57:57 +0000
commit300d1e52088525a9ca6fc3b220ce85f7ac485bb2 (patch)
treeabf53d921bbe54495a37b5f1e7cd7fb7f137f952 /chrome/browser/ui/browser_navigator_browsertest.cc
parent7d06e052d0bc4c5f83f44831a3cd044cd77bc3bf (diff)
downloadchromium_src-300d1e52088525a9ca6fc3b220ce85f7ac485bb2.zip
chromium_src-300d1e52088525a9ca6fc3b220ce85f7ac485bb2.tar.gz
chromium_src-300d1e52088525a9ca6fc3b220ce85f7ac485bb2.tar.bz2
Fix for regression: Any window of type APP should create APP_POPUP windows.
When code was moved from browser.cc to browser_navigator.cc, the logic for spawning popup windows was either mis-copied or copied from a different code path; any browser of TYPE_APP (e.g. TYPE_APP_POPUP) should create popup windows of TYPE_APP_POPUP. BUG=chromium-os:11040 TEST=See issue + UI auto tests Review URL: http://codereview.chromium.org/6296011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71876 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_navigator_browsertest.cc')
-rw-r--r--chrome/browser/ui/browser_navigator_browsertest.cc53
1 files changed, 53 insertions, 0 deletions
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index f775223..3fdf22f 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) {