Index: chrome/browser/browser_browsertest.cc |
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc |
index ae52bac0f66f9c51910cfe0dfe62c9f2004a6acf..7ff0cb7313a0cc4d8635ff4e58ce90e8a655adf7 100644 |
--- a/chrome/browser/browser_browsertest.cc |
+++ b/chrome/browser/browser_browsertest.cc |
@@ -415,7 +415,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ConvertTabToAppShortcut) { |
// Normal tabs should accept load drops. |
EXPECT_TRUE(initial_tab->GetMutableRendererPrefs()->can_accept_load_drops); |
- // The tab in an aopp window should not. |
+ // The tab in an app window should not. |
EXPECT_FALSE(app_tab->GetMutableRendererPrefs()->can_accept_load_drops); |
} |
@@ -491,6 +491,44 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, TabClosingWhenRemovingExtension) { |
ASSERT_EQ(1, browser()->tab_count()); |
} |
+#if !defined(OS_MACOSX) |
+// Open with --app-id=<id>, and see that an app window opens. |
+IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) { |
+ 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(); |
+ |
+ CommandLine command_line(CommandLine::NO_PROGRAM); |
+ command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
+ |
+ BrowserInit::LaunchWithProfile launch(FilePath(), command_line); |
+ ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile())); |
+ |
+ // Check that the new browser has an app name. |
+ // 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()); |
+ |
+ // The browser's app_name should include the app's ID. |
+ ASSERT_NE( |
+ new_browser->app_name_.find(extension_app->id()), |
+ std::string::npos) << new_browser->app_name_; |
+ |
+} |
+#endif |
+ |
#if defined(OS_WIN) |
// http://crbug.com/46198. On XP/Vista, the failure rate is 5 ~ 6%. |
#define MAYBE_PageLanguageDetection FLAKY_PageLanguageDetection |
@@ -650,6 +688,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) { |
ASSERT_TRUE(new_browser != browser()); |
EXPECT_EQ(Browser::TYPE_APP, new_browser->type()); |
+ |
+ // The browser's app name should include the extension's id. |
+ std::string app_name = new_browser->app_name_; |
+ EXPECT_NE(app_name.find(extension_app->id()), std::string::npos) |
+ << "Name " << app_name << " should contain id "<< extension_app->id(); |
} |
#endif // !defined(OS_MACOSX) |