OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 5 #include <map> |
6 | 6 |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" |
10 #include "chrome/browser/extensions/launch_util.h" | 11 #include "chrome/browser/extensions/launch_util.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
14 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
15 #include "chrome/browser/ui/browser_iterator.h" | 16 #include "chrome/browser/ui/browser_iterator.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
19 #include "content/public/test/test_utils.h" | 20 #include "content/public/test/test_utils.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 extensions::SetLaunchType(browser()->profile(), app_id, | 304 extensions::SetLaunchType(browser()->profile(), app_id, |
304 extensions::LAUNCH_TYPE_WINDOW); | 305 extensions::LAUNCH_TYPE_WINDOW); |
305 | 306 |
306 std::string app_id_new; | 307 std::string app_id_new; |
307 LoadAndWaitForLaunch("management/launch_app_tab", &app_id_new); | 308 LoadAndWaitForLaunch("management/launch_app_tab", &app_id_new); |
308 ASSERT_FALSE(HasFatalFailure()); | 309 ASSERT_FALSE(HasFatalFailure()); |
309 | 310 |
310 // If the ID changed, then the pref will not apply to the app. | 311 // If the ID changed, then the pref will not apply to the app. |
311 ASSERT_EQ(app_id, app_id_new); | 312 ASSERT_EQ(app_id, app_id_new); |
312 | 313 |
| 314 unsigned expected_browser_count = 2; |
| 315 #if defined(OS_MACOSX) |
| 316 // Without the new Bookmark Apps, Mac has no way of making standalone browser |
| 317 // windows for apps, so it will add to the tabstrip instead. |
| 318 EXPECT_FALSE(extensions::util::IsNewBookmarkAppsEnabled()); |
| 319 expected_browser_count = 1; |
| 320 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
| 321 #endif |
313 // Find the app's browser. Opening in a new window will create | 322 // Find the app's browser. Opening in a new window will create |
314 // a new browser. | 323 // a new browser. |
315 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile(), | 324 ASSERT_EQ(expected_browser_count, |
316 browser()->host_desktop_type())); | 325 chrome::GetBrowserCount(browser()->profile(), |
317 Browser* app_browser = FindOtherBrowser(browser()); | 326 browser()->host_desktop_type())); |
318 ASSERT_TRUE(app_browser->is_app()); | 327 if (expected_browser_count == 2) { |
| 328 Browser* app_browser = FindOtherBrowser(browser()); |
| 329 ASSERT_TRUE(app_browser->is_app()); |
| 330 } |
319 } | 331 } |
320 | 332 |
321 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchType) { | 333 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchType) { |
322 LoadExtensions(); | 334 LoadExtensions(); |
323 base::FilePath basedir = test_data_dir_.AppendASCII("management"); | 335 base::FilePath basedir = test_data_dir_.AppendASCII("management"); |
324 LoadNamedExtension(basedir, "packaged_app"); | 336 LoadNamedExtension(basedir, "packaged_app"); |
325 | 337 |
326 ASSERT_TRUE(RunExtensionSubtest("management/test", "launchType.html")); | 338 ASSERT_TRUE(RunExtensionSubtest("management/test", "launchType.html")); |
327 } | 339 } |
OLD | NEW |