| 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/launch_util.h" | 10 #include "chrome/browser/extensions/launch_util.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 // Set a pref indicating that the user wants to launch in a window. | 301 // Set a pref indicating that the user wants to launch in a window. |
| 302 extensions::SetLaunchType(service, app_id, extensions::LAUNCH_TYPE_WINDOW); | 302 extensions::SetLaunchType(service, app_id, extensions::LAUNCH_TYPE_WINDOW); |
| 303 | 303 |
| 304 std::string app_id_new; | 304 std::string app_id_new; |
| 305 LoadAndWaitForLaunch("management/launch_app_tab", &app_id_new); | 305 LoadAndWaitForLaunch("management/launch_app_tab", &app_id_new); |
| 306 ASSERT_FALSE(HasFatalFailure()); | 306 ASSERT_FALSE(HasFatalFailure()); |
| 307 | 307 |
| 308 // If the ID changed, then the pref will not apply to the app. | 308 // If the ID changed, then the pref will not apply to the app. |
| 309 ASSERT_EQ(app_id, app_id_new); | 309 ASSERT_EQ(app_id, app_id_new); |
| 310 | 310 |
| 311 #if defined(OS_MACOSX) | |
| 312 // App windows are not yet implemented on mac os. We should fall back | |
| 313 // to a normal tab. | |
| 314 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), | |
| 315 browser()->host_desktop_type())); | |
| 316 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | |
| 317 #else | |
| 318 // Find the app's browser. Opening in a new window will create | 311 // Find the app's browser. Opening in a new window will create |
| 319 // a new browser. | 312 // a new browser. |
| 320 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile(), | 313 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile(), |
| 321 browser()->host_desktop_type())); | 314 browser()->host_desktop_type())); |
| 322 Browser* app_browser = FindOtherBrowser(browser()); | 315 Browser* app_browser = FindOtherBrowser(browser()); |
| 323 ASSERT_TRUE(app_browser->is_app()); | 316 ASSERT_TRUE(app_browser->is_app()); |
| 324 #endif | |
| 325 } | 317 } |
| 326 | 318 |
| 327 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchType) { | 319 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchType) { |
| 328 LoadExtensions(); | 320 LoadExtensions(); |
| 329 base::FilePath basedir = test_data_dir_.AppendASCII("management"); | 321 base::FilePath basedir = test_data_dir_.AppendASCII("management"); |
| 330 LoadNamedExtension(basedir, "packaged_app"); | 322 LoadNamedExtension(basedir, "packaged_app"); |
| 331 | 323 |
| 332 ASSERT_TRUE(RunExtensionSubtest("management/test", "launchType.html")); | 324 ASSERT_TRUE(RunExtensionSubtest("management/test", "launchType.html")); |
| 333 } | 325 } |
| 334 | 326 |
| 335 class ExtensionManagementApiStreamlinedAppsTest | 327 class ExtensionManagementApiStreamlinedAppsTest |
| 336 : public ExtensionManagementApiTest { | 328 : public ExtensionManagementApiTest { |
| 337 public: | 329 public: |
| 338 void SetUpCommandLine(CommandLine* command_line) override { | 330 void SetUpCommandLine(CommandLine* command_line) override { |
| 339 ExtensionManagementApiTest::SetUpCommandLine(command_line); | 331 ExtensionManagementApiTest::SetUpCommandLine(command_line); |
| 340 command_line->AppendSwitch(switches::kEnableStreamlinedHostedApps); | 332 command_line->AppendSwitch(switches::kEnableStreamlinedHostedApps); |
| 341 } | 333 } |
| 342 }; | 334 }; |
| 343 | 335 |
| 344 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiStreamlinedAppsTest, LaunchType) { | 336 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiStreamlinedAppsTest, LaunchType) { |
| 345 LoadExtensions(); | 337 LoadExtensions(); |
| 346 base::FilePath basedir = test_data_dir_.AppendASCII("management"); | 338 base::FilePath basedir = test_data_dir_.AppendASCII("management"); |
| 347 LoadNamedExtension(basedir, "packaged_app"); | 339 LoadNamedExtension(basedir, "packaged_app"); |
| 348 | 340 |
| 349 ASSERT_TRUE(RunExtensionSubtest("management/test", | 341 ASSERT_TRUE(RunExtensionSubtest("management/test", |
| 350 "launchType.html?streamlined-hosted-apps")); | 342 "launchType.html?streamlined-hosted-apps")); |
| 351 } | 343 } |
| OLD | NEW |