1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/mac/scoped_nsobject.h"
6 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
7 #include "chrome/browser/ui/cocoa/fullscreen_window.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #import "testing/gtest_mac.h"
10 #include "testing/platform_test.h"
12 @interface PerformCloseUIItem : NSObject<NSValidatedUserInterfaceItem>
15 @implementation PerformCloseUIItem
17 return @selector(performClose:);
25 class FullscreenWindowTest : public CocoaTest {
28 TEST_F(FullscreenWindowTest, Basics) {
29 base::scoped_nsobject<FullscreenWindow> window;
30 window.reset([[FullscreenWindow alloc] init]);
32 EXPECT_EQ([NSScreen mainScreen], [window screen]);
33 EXPECT_TRUE([window canBecomeKeyWindow]);
34 EXPECT_TRUE([window canBecomeMainWindow]);
35 EXPECT_EQ(NSBorderlessWindowMask, [window styleMask]);
36 EXPECT_NSEQ([[NSScreen mainScreen] frame], [window frame]);
37 EXPECT_FALSE([window isReleasedWhenClosed]);
40 TEST_F(FullscreenWindowTest, CanPerformClose) {
41 base::scoped_nsobject<FullscreenWindow> window;
42 window.reset([[FullscreenWindow alloc] init]);
44 base::scoped_nsobject<PerformCloseUIItem> item;
45 item.reset([[PerformCloseUIItem alloc] init]);
47 EXPECT_TRUE([window validateUserInterfaceItem:item.get()]);