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 // This file tests whichever implementation of NativeAppWindow is used. | 5 // This file tests whichever implementation of NativeAppWindow is used. |
6 // I.e. it could be NativeAppWindowCocoa or ChromeNativeAppWindowViewsMac. | 6 // I.e. it could be NativeAppWindowCocoa or ChromeNativeAppWindowViewsMac. |
7 #include "extensions/browser/app_window/native_app_window.h" | 7 #include "extensions/browser/app_window/native_app_window.h" |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 watcher.reset([[ScopedNotificationWatcher alloc] | 206 watcher.reset([[ScopedNotificationWatcher alloc] |
207 initWithNotification:NSWindowDidExitFullScreenNotification | 207 initWithNotification:NSWindowDidExitFullScreenNotification |
208 andObject:ns_window]); | 208 andObject:ns_window]); |
209 [ns_window toggleFullScreen:nil]; | 209 [ns_window toggleFullScreen:nil]; |
210 [watcher waitForNotification]; | 210 [watcher waitForNotification]; |
211 EXPECT_EQ(extensions::AppWindow::FULLSCREEN_TYPE_NONE, | 211 EXPECT_EQ(extensions::AppWindow::FULLSCREEN_TYPE_NONE, |
212 app_window->fullscreen_types_for_test()); | 212 app_window->fullscreen_types_for_test()); |
213 EXPECT_FALSE(window->IsFullscreen()); | 213 EXPECT_FALSE(window->IsFullscreen()); |
214 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); | 214 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); |
215 } | 215 } |
| 216 |
| 217 // Test that, in frameless windows, the web contents has the same size as the |
| 218 // window. |
| 219 IN_PROC_BROWSER_TEST_F(NativeAppWindowCocoaBrowserTest, Frameless) { |
| 220 extensions::AppWindow* app_window = |
| 221 CreateTestAppWindow("{\"frame\": \"none\"}"); |
| 222 NSWindow* ns_window = app_window->GetNativeWindow(); |
| 223 NSView* web_contents = app_window->web_contents()->GetNativeView(); |
| 224 EXPECT_TRUE(NSEqualSizes(NSMakeSize(512, 384), [web_contents frame].size)); |
| 225 // Move and resize the window. |
| 226 NSRect new_frame = NSMakeRect(50, 50, 200, 200); |
| 227 [ns_window setFrame:new_frame display:YES]; |
| 228 EXPECT_TRUE(NSEqualSizes(new_frame.size, [web_contents frame].size)); |
| 229 |
| 230 // Windows created with NSBorderlessWindowMask by default don't have shadow, |
| 231 // but packaged apps should always have one. |
| 232 EXPECT_TRUE([ns_window hasShadow]); |
| 233 |
| 234 // Since the window has no constraints, it should have all of the following |
| 235 // style mask bits. |
| 236 NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | |
| 237 NSMiniaturizableWindowMask | NSResizableWindowMask | |
| 238 NSTexturedBackgroundWindowMask; |
| 239 EXPECT_EQ(style_mask, [ns_window styleMask]); |
| 240 |
| 241 CloseAppWindow(app_window); |
| 242 } |
OLD | NEW |