| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "apps/shell_window_registry.h" | 7 #include "apps/app_window_registry.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 12 #import "chrome/browser/app_controller_mac.h" | 12 #import "chrome/browser/app_controller_mac.h" |
| 13 #include "chrome/browser/apps/app_browsertest_util.h" | 13 #include "chrome/browser/apps/app_browsertest_util.h" |
| 14 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/extensions/extension_test_message_listener.h" | 15 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 15 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
| 18 #include "chrome/browser/browser_process.h" | |
| 19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 20 #import "chrome/browser/ui/cocoa/user_manager_mac.h" | 20 #import "chrome/browser/ui/cocoa/user_manager_mac.h" |
| 21 #include "chrome/browser/ui/host_desktop.h" | 21 #include "chrome/browser/ui/host_desktop.h" |
| 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 23 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
| 24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/test/base/in_process_browser_test.h" | 26 #include "chrome/test/base/in_process_browser_test.h" |
| 27 #include "chrome/test/base/ui_test_utils.h" | 27 #include "chrome/test/base/ui_test_utils.h" |
| 28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest, | 66 IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest, |
| 67 ActivationFocusesBrowserWindow) { | 67 ActivationFocusesBrowserWindow) { |
| 68 base::scoped_nsobject<AppController> app_controller( | 68 base::scoped_nsobject<AppController> app_controller( |
| 69 [[AppController alloc] init]); | 69 [[AppController alloc] init]); |
| 70 | 70 |
| 71 ExtensionTestMessageListener listener("Launched", false); | 71 ExtensionTestMessageListener listener("Launched", false); |
| 72 const extensions::Extension* app = | 72 const extensions::Extension* app = |
| 73 InstallAndLaunchPlatformApp("minimal"); | 73 InstallAndLaunchPlatformApp("minimal"); |
| 74 ASSERT_TRUE(listener.WaitUntilSatisfied()); | 74 ASSERT_TRUE(listener.WaitUntilSatisfied()); |
| 75 | 75 |
| 76 NSWindow* app_window = apps::ShellWindowRegistry::Get(profile())-> | 76 NSWindow* app_window = apps::AppWindowRegistry::Get(profile()) |
| 77 GetShellWindowsForApp(app->id()).front()->GetNativeWindow(); | 77 ->GetAppWindowsForApp(app->id()) |
| 78 .front() |
| 79 ->GetNativeWindow(); |
| 78 NSWindow* browser_window = browser()->window()->GetNativeWindow(); | 80 NSWindow* browser_window = browser()->window()->GetNativeWindow(); |
| 79 | 81 |
| 80 EXPECT_LE([[NSApp orderedWindows] indexOfObject:app_window], | 82 EXPECT_LE([[NSApp orderedWindows] indexOfObject:app_window], |
| 81 [[NSApp orderedWindows] indexOfObject:browser_window]); | 83 [[NSApp orderedWindows] indexOfObject:browser_window]); |
| 82 [app_controller applicationShouldHandleReopen:NSApp | 84 [app_controller applicationShouldHandleReopen:NSApp |
| 83 hasVisibleWindows:YES]; | 85 hasVisibleWindows:YES]; |
| 84 EXPECT_LE([[NSApp orderedWindows] indexOfObject:browser_window], | 86 EXPECT_LE([[NSApp orderedWindows] indexOfObject:browser_window], |
| 85 [[NSApp orderedWindows] indexOfObject:app_window]); | 87 [[NSApp orderedWindows] indexOfObject:app_window]); |
| 86 } | 88 } |
| 87 | 89 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 EXPECT_FALSE(result); | 221 EXPECT_FALSE(result); |
| 220 | 222 |
| 221 base::RunLoop().RunUntilIdle(); | 223 base::RunLoop().RunUntilIdle(); |
| 222 | 224 |
| 223 EXPECT_EQ(1u, active_browser_list_->size()); | 225 EXPECT_EQ(1u, active_browser_list_->size()); |
| 224 EXPECT_TRUE(UserManagerMac::IsShowing()); | 226 EXPECT_TRUE(UserManagerMac::IsShowing()); |
| 225 UserManagerMac::Hide(); | 227 UserManagerMac::Hide(); |
| 226 } | 228 } |
| 227 | 229 |
| 228 } // namespace | 230 } // namespace |
| OLD | NEW |