summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_browsertest.cc
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-18 18:31:50 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-18 18:31:50 +0000
commit1b810530a418a711c68d6e7b4417b326f555b2d1 (patch)
treed91c43e9bb35bb14908c9bd46b70537294b6a7f3 /chrome/browser/browser_browsertest.cc
parent4e9eba0d0848269269e45e7f2dcf04b9f4686d0f (diff)
downloadchromium_src-1b810530a418a711c68d6e7b4417b326f555b2d1.zip
chromium_src-1b810530a418a711c68d6e7b4417b326f555b2d1.tar.gz
chromium_src-1b810530a418a711c68d6e7b4417b326f555b2d1.tar.bz2
Add "open as window" menu item to NTP app menu.
BUG=59697 TEST=BrowserTest.OpenAppWindowLikeNtp,SessionRestoreUITest.RestoreAfterClosing* Review URL: http://codereview.chromium.org/5019005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_browsertest.cc')
-rw-r--r--chrome/browser/browser_browsertest.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc
index 2cfc68e..b306ec1 100644
--- a/chrome/browser/browser_browsertest.cc
+++ b/chrome/browser/browser_browsertest.cc
@@ -573,6 +573,42 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CloseWithAppMenuOpen) {
new RunCloseWithAppMenuTask(browser()));
}
+#if !defined(OS_MACOSX)
+IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) {
+ ASSERT_TRUE(test_server()->Start());
+
+ // Load an app
+ host_resolver()->AddRule("www.example.com", "127.0.0.1");
+ ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/")));
+ const Extension* extension_app = GetExtension();
+
+ // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would.
+ TabContents* app_window = Browser::OpenApplication(
+ browser()->profile(), extension_app, extension_misc::LAUNCH_WINDOW, NULL);
+ ASSERT_TRUE(app_window);
+
+ // Apps launched in a window from the NTP do not have extension_app set in
+ // tab contents.
+ EXPECT_FALSE(app_window->extension_app());
+ EXPECT_EQ(extension_app->GetFullLaunchURL(), app_window->GetURL());
+
+ // The launch should have created a new browser.
+ ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
+
+ // Find the new browser.
+ Browser* new_browser = NULL;
+ for (BrowserList::const_iterator i = BrowserList::begin();
+ i != BrowserList::end() && !new_browser; ++i) {
+ if (*i != browser())
+ new_browser = *i;
+ }
+ ASSERT_TRUE(new_browser);
+ ASSERT_TRUE(new_browser != browser());
+
+ EXPECT_EQ(Browser::TYPE_APP, new_browser->type());
+}
+#endif // !defined(OS_MACOSX)
+
// TODO(ben): this test was never enabled. It has bit-rotted since being added.
// It originally lived in browser_unittest.cc, but has been moved here to make
// room for real browser unit tests.