Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "apps/app_lifetime_monitor_factory.h" | 8 #include "apps/app_lifetime_monitor_factory.h" |
| 9 #include "apps/switches.h" | 9 #include "apps/switches.h" |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "chrome/browser/apps/app_browsertest_util.h" | 21 #include "chrome/browser/apps/app_browsertest_util.h" |
| 22 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" | 22 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" |
| 23 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h" | 23 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h" |
| 24 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" | 24 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" |
| 25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
| 26 #include "chrome/browser/extensions/launch_util.h" | 26 #include "chrome/browser/extensions/launch_util.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
| 29 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
| 30 #include "chrome/browser/web_applications/web_app_mac.h" | 30 #include "chrome/browser/web_applications/web_app_mac.h" |
| 31 #include "chrome/common/chrome_features.h" | |
| 31 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
| 32 #include "chrome/common/chrome_switches.h" | |
| 33 #include "chrome/common/mac/app_mode_common.h" | 33 #include "chrome/common/mac/app_mode_common.h" |
| 34 #include "content/public/common/content_switches.h" | |
| 34 #include "content/public/test/test_utils.h" | 35 #include "content/public/test/test_utils.h" |
| 35 #include "extensions/browser/app_window/native_app_window.h" | 36 #include "extensions/browser/app_window/native_app_window.h" |
| 36 #include "extensions/browser/extension_prefs.h" | 37 #include "extensions/browser/extension_prefs.h" |
| 37 #include "extensions/test/extension_test_message_listener.h" | 38 #include "extensions/test/extension_test_message_listener.h" |
| 38 #import "ui/base/test/windowed_nsnotification_observer.h" | 39 #import "ui/base/test/windowed_nsnotification_observer.h" |
| 39 #import "ui/events/test/cocoa_test_event_utils.h" | 40 #import "ui/events/test/cocoa_test_event_utils.h" |
| 40 | 41 |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| 43 // General end-to-end test for app shims. | 44 // General end-to-end test for app shims. |
| 44 class AppShimInteractiveTest : public extensions::PlatformAppBrowserTest { | 45 class AppShimInteractiveTest : public extensions::PlatformAppBrowserTest { |
| 45 protected: | 46 protected: |
| 46 // Type of app to install, when invoking InstallAppWithShim(). | 47 // Type of app to install, when invoking InstallAppWithShim(). |
| 47 enum AppType { APP_TYPE_PACKAGED, APP_TYPE_HOSTED }; | 48 enum AppType { APP_TYPE_PACKAGED, APP_TYPE_HOSTED }; |
| 48 | 49 |
| 49 AppShimInteractiveTest() | 50 AppShimInteractiveTest() |
| 50 : auto_reset_(&g_app_shims_allow_update_and_launch_in_tests, true) {} | 51 : auto_reset_(&g_app_shims_allow_update_and_launch_in_tests, true) {} |
| 51 | 52 |
| 52 // Install a test app of |type| and reliably wait for its app shim to be | 53 // Install a test app of |type| and reliably wait for its app shim to be |
| 53 // created on disk. Sets |shim_path_|. | 54 // created on disk. Sets |shim_path_|. |
| 54 const extensions::Extension* InstallAppWithShim(AppType type, | 55 const extensions::Extension* InstallAppWithShim(AppType type, |
| 55 const char* name); | 56 const char* name); |
| 56 | 57 |
| 57 void SetUpCommandLine(base::CommandLine* command_line) override { | 58 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 58 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 59 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 59 command_line->AppendSwitch(switches::kEnableNewBookmarkApps); | 60 command_line->AppendSwitchASCII(switches::kEnableFeatures, |
|
dominickn
2017/03/22 04:18:12
Can you carry a base::ScopedFeatureList as a membe
tapted
2017/03/23 02:59:58
Done.
| |
| 61 features::kBookmarkApps.name); | |
| 60 } | 62 } |
| 61 | 63 |
| 62 protected: | 64 protected: |
| 63 base::FilePath shim_path_; | 65 base::FilePath shim_path_; |
| 64 | 66 |
| 65 private: | 67 private: |
| 66 // Temporarily enable app shims. | 68 // Temporarily enable app shims. |
| 67 base::AutoReset<bool> auto_reset_; | 69 base::AutoReset<bool> auto_reset_; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(AppShimInteractiveTest); | 71 DISALLOW_COPY_AND_ASSIGN(AppShimInteractiveTest); |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 618 // the shim is rebuilt. | 620 // the shim is rebuilt. |
| 619 WindowedAppShimLaunchObserver(app->id()).Wait(); | 621 WindowedAppShimLaunchObserver(app->id()).Wait(); |
| 620 | 622 |
| 621 EXPECT_TRUE(GetFirstAppWindow()); | 623 EXPECT_TRUE(GetFirstAppWindow()); |
| 622 EXPECT_TRUE(HasAppShimHost(profile(), app->id())); | 624 EXPECT_TRUE(HasAppShimHost(profile(), app->id())); |
| 623 } | 625 } |
| 624 | 626 |
| 625 #endif // defined(ARCH_CPU_64_BITS) | 627 #endif // defined(ARCH_CPU_64_BITS) |
| 626 | 628 |
| 627 } // namespace apps | 629 } // namespace apps |
| OLD | NEW |