Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.h" | 5 #import "chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| 11 #import "base/mac/scoped_nsobject.h" | 11 #import "base/mac/scoped_nsobject.h" |
| 12 #import "base/mac/scoped_objc_class_swizzler.h" | 12 #import "base/mac/scoped_objc_class_swizzler.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/apps/app_browsertest_util.h" | 16 #include "chrome/browser/apps/app_browsertest_util.h" |
| 17 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" | 17 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "chrome/browser/extensions/launch_util.h" | 19 #include "chrome/browser/extensions/launch_util.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/browser_list.h" | 21 #include "chrome/browser/ui/browser_list.h" |
| 22 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_features.h" |
| 24 #include "content/public/common/content_switches.h" | |
| 24 #include "extensions/browser/app_window/app_window_registry.h" | 25 #include "extensions/browser/app_window/app_window_registry.h" |
| 25 #include "extensions/browser/app_window/native_app_window.h" | 26 #include "extensions/browser/app_window/native_app_window.h" |
| 26 #include "extensions/browser/uninstall_reason.h" | 27 #include "extensions/browser/uninstall_reason.h" |
| 27 #include "extensions/common/extension.h" | 28 #include "extensions/common/extension.h" |
| 28 #include "extensions/test/extension_test_message_listener.h" | 29 #include "extensions/test/extension_test_message_listener.h" |
| 29 #import "ui/base/test/scoped_fake_nswindow_focus.h" | 30 #import "ui/base/test/scoped_fake_nswindow_focus.h" |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 class AppShimMenuControllerBrowserTest | 34 class AppShimMenuControllerBrowserTest |
| 34 : public extensions::PlatformAppBrowserTest { | 35 : public extensions::PlatformAppBrowserTest { |
| 35 protected: | 36 protected: |
| 36 // The apps that can be installed and launched by SetUpApps(). | 37 // The apps that can be installed and launched by SetUpApps(). |
| 37 enum AvailableApps { PACKAGED_1 = 0x1, PACKAGED_2 = 0x2, HOSTED = 0x4 }; | 38 enum AvailableApps { PACKAGED_1 = 0x1, PACKAGED_2 = 0x2, HOSTED = 0x4 }; |
| 38 | 39 |
| 39 AppShimMenuControllerBrowserTest() | 40 AppShimMenuControllerBrowserTest() |
| 40 : app_1_(nullptr), | 41 : app_1_(nullptr), |
| 41 app_2_(nullptr), | 42 app_2_(nullptr), |
| 42 hosted_app_(nullptr), | 43 hosted_app_(nullptr), |
| 43 initial_menu_item_count_(0) {} | 44 initial_menu_item_count_(0) {} |
| 44 | 45 |
| 45 void SetUpCommandLine(base::CommandLine* command_line) override { | 46 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 46 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 47 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 47 command_line->AppendSwitch(switches::kEnableNewBookmarkApps); | 48 command_line->AppendSwitchASCII(switches::kEnableFeatures, |
|
dominickn
2017/03/22 04:18:12
Ditto base::ScopedFeatureList
tapted
2017/03/23 02:59:58
Done.
| |
| 49 features::kBookmarkApps.name); | |
| 48 } | 50 } |
| 49 | 51 |
| 50 // Start testing apps and wait for them to launch. |flags| is a bitmask of | 52 // Start testing apps and wait for them to launch. |flags| is a bitmask of |
| 51 // AvailableApps. | 53 // AvailableApps. |
| 52 void SetUpApps(int flags) { | 54 void SetUpApps(int flags) { |
| 53 | 55 |
| 54 if (flags & PACKAGED_1) { | 56 if (flags & PACKAGED_1) { |
| 55 ExtensionTestMessageListener listener_1("Launched", false); | 57 ExtensionTestMessageListener listener_1("Launched", false); |
| 56 app_1_ = InstallAndLaunchPlatformApp("minimal_id"); | 58 app_1_ = InstallAndLaunchPlatformApp("minimal_id"); |
| 57 ASSERT_TRUE(listener_1.WaitUntilSatisfied()); | 59 ASSERT_TRUE(listener_1.WaitUntilSatisfied()); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 | 263 |
| 262 // OSX will send NSWindowWillResignMainNotification when a main window is | 264 // OSX will send NSWindowWillResignMainNotification when a main window is |
| 263 // closed. | 265 // closed. |
| 264 [[NSNotificationCenter defaultCenter] | 266 [[NSNotificationCenter defaultCenter] |
| 265 postNotificationName:NSWindowDidResignMainNotification | 267 postNotificationName:NSWindowDidResignMainNotification |
| 266 object:app_1_window]; | 268 object:app_1_window]; |
| 267 CheckNoAppMenus(); | 269 CheckNoAppMenus(); |
| 268 } | 270 } |
| 269 | 271 |
| 270 } // namespace | 272 } // namespace |
| OLD | NEW |