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

Side by Side Diff: chrome/browser/browser_browsertest.cc

Issue 5019005: Add "open as window" menu item to NTP app menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase for commit Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 // menu is showing. 566 // menu is showing.
567 IN_PROC_BROWSER_TEST_F(BrowserTest, CloseWithAppMenuOpen) { 567 IN_PROC_BROWSER_TEST_F(BrowserTest, CloseWithAppMenuOpen) {
568 if (browser_defaults::kBrowserAliveWithNoWindows) 568 if (browser_defaults::kBrowserAliveWithNoWindows)
569 return; 569 return;
570 570
571 // We need a message loop running for menus on windows. 571 // We need a message loop running for menus on windows.
572 MessageLoop::current()->PostTask(FROM_HERE, 572 MessageLoop::current()->PostTask(FROM_HERE,
573 new RunCloseWithAppMenuTask(browser())); 573 new RunCloseWithAppMenuTask(browser()));
574 } 574 }
575 575
576 #if !defined(OS_MACOSX)
577 IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) {
578 ASSERT_TRUE(test_server()->Start());
579
580 // Load an app
581 host_resolver()->AddRule("www.example.com", "127.0.0.1");
582 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/")));
583 const Extension* extension_app = GetExtension();
584
585 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would.
586 TabContents* app_window = Browser::OpenApplication(
587 browser()->profile(), extension_app, extension_misc::LAUNCH_WINDOW, NULL);
588 ASSERT_TRUE(app_window);
589
590 // Apps launched in a window from the NTP do not have extension_app set in
591 // tab contents.
592 EXPECT_FALSE(app_window->extension_app());
593 EXPECT_EQ(extension_app->GetFullLaunchURL(), app_window->GetURL());
594
595 // The launch should have created a new browser.
596 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
597
598 // Find the new browser.
599 Browser* new_browser = NULL;
600 for (BrowserList::const_iterator i = BrowserList::begin();
601 i != BrowserList::end() && !new_browser; ++i) {
602 if (*i != browser())
603 new_browser = *i;
604 }
605 ASSERT_TRUE(new_browser);
606 ASSERT_TRUE(new_browser != browser());
607
608 EXPECT_EQ(Browser::TYPE_APP, new_browser->type());
609 }
610 #endif // !defined(OS_MACOSX)
611
576 // TODO(ben): this test was never enabled. It has bit-rotted since being added. 612 // TODO(ben): this test was never enabled. It has bit-rotted since being added.
577 // It originally lived in browser_unittest.cc, but has been moved here to make 613 // It originally lived in browser_unittest.cc, but has been moved here to make
578 // room for real browser unit tests. 614 // room for real browser unit tests.
579 #if 0 615 #if 0
580 class BrowserTest2 : public InProcessBrowserTest { 616 class BrowserTest2 : public InProcessBrowserTest {
581 public: 617 public:
582 BrowserTest2() { 618 BrowserTest2() {
583 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); 619 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL);
584 // Avoid making external DNS lookups. In this test we don't need this 620 // Avoid making external DNS lookups. In this test we don't need this
585 // to succeed. 621 // to succeed.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 686
651 // The normal browser should now have four. 687 // The normal browser should now have four.
652 EXPECT_EQ(4, browser()->tab_count()); 688 EXPECT_EQ(4, browser()->tab_count());
653 689
654 // Close the additional browsers. 690 // Close the additional browsers.
655 popup_browser->CloseAllTabs(); 691 popup_browser->CloseAllTabs();
656 app_browser->CloseAllTabs(); 692 app_browser->CloseAllTabs();
657 app_popup_browser->CloseAllTabs(); 693 app_popup_browser->CloseAllTabs();
658 } 694 }
659 #endif 695 #endif
OLDNEW
« no previous file with comments | « chrome/browser/background_application_list_model.cc ('k') | chrome/browser/dom_ui/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698