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/native_app_window_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "apps/app_window_registry.h" | 9 #include "apps/app_window_registry.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| 11 #include "base/mac/sdk_forward_declarations.h" |
11 #include "chrome/browser/apps/app_browsertest_util.h" | 12 #include "chrome/browser/apps/app_browsertest_util.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/extensions/application_launch.h" | 14 #include "chrome/browser/ui/extensions/application_launch.h" |
14 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
15 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
16 | 17 |
17 using extensions::PlatformAppBrowserTest; | 18 using extensions::PlatformAppBrowserTest; |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 native_window->ShowWithApp(); | 113 native_window->ShowWithApp(); |
113 EXPECT_TRUE([ns_window isVisible]); | 114 EXPECT_TRUE([ns_window isVisible]); |
114 EXPECT_FALSE([other_ns_window isVisible]); | 115 EXPECT_FALSE([other_ns_window isVisible]); |
115 } | 116 } |
116 | 117 |
117 // Only test fullscreen for 10.7 and above. | 118 // Only test fullscreen for 10.7 and above. |
118 // Replicate specific 10.7 SDK declarations for building with prior SDKs. | 119 // Replicate specific 10.7 SDK declarations for building with prior SDKs. |
119 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 120 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
120 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | 121 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
121 | 122 |
122 @interface NSWindow (LionSDKDeclarations) | |
123 - (void)toggleFullScreen:(id)sender; | |
124 @end | |
125 | |
126 enum { | |
127 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7, | |
128 NSFullScreenWindowMask = 1 << 14 | |
129 }; | |
130 | |
131 NSString* const NSWindowDidEnterFullScreenNotification = | 123 NSString* const NSWindowDidEnterFullScreenNotification = |
132 @"NSWindowDidEnterFullScreenNotification"; | 124 @"NSWindowDidEnterFullScreenNotification"; |
133 NSString* const NSWindowDidExitFullScreenNotification = | 125 NSString* const NSWindowDidExitFullScreenNotification = |
134 @"NSWindowDidExitFullScreenNotification"; | 126 @"NSWindowDidExitFullScreenNotification"; |
135 | 127 |
136 #endif // MAC_OS_X_VERSION_10_7 | 128 #endif // MAC_OS_X_VERSION_10_7 |
137 | 129 |
138 @interface ScopedNotificationWatcher : NSObject { | 130 @interface ScopedNotificationWatcher : NSObject { |
139 @private | 131 @private |
140 BOOL received_; | 132 BOOL received_; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 watcher.reset([[ScopedNotificationWatcher alloc] | 215 watcher.reset([[ScopedNotificationWatcher alloc] |
224 initWithNotification:NSWindowDidExitFullScreenNotification | 216 initWithNotification:NSWindowDidExitFullScreenNotification |
225 andObject:ns_window]); | 217 andObject:ns_window]); |
226 [ns_window toggleFullScreen:nil]; | 218 [ns_window toggleFullScreen:nil]; |
227 [watcher waitForNotification]; | 219 [watcher waitForNotification]; |
228 EXPECT_EQ(apps::AppWindow::FULLSCREEN_TYPE_NONE, | 220 EXPECT_EQ(apps::AppWindow::FULLSCREEN_TYPE_NONE, |
229 app_window->fullscreen_types_for_test()); | 221 app_window->fullscreen_types_for_test()); |
230 EXPECT_FALSE(window->IsFullscreen()); | 222 EXPECT_FALSE(window->IsFullscreen()); |
231 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); | 223 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); |
232 } | 224 } |
OLD | NEW |