Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / fullscreen_window_unittest.mm
blob053a951d081b220e5233122509a2f0b398c4a609
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 #include "testing/platform_test.h"
11 @interface PerformCloseUIItem : NSObject<NSValidatedUserInterfaceItem>
12 @end
14 @implementation PerformCloseUIItem
15 - (SEL)action {
16   return @selector(performClose:);
19 - (NSInteger)tag {
20   return 0;
22 @end
24 class FullscreenWindowTest : public CocoaTest {
27 TEST_F(FullscreenWindowTest, Basics) {
28   base::scoped_nsobject<FullscreenWindow> window;
29   window.reset([[FullscreenWindow alloc] init]);
31   EXPECT_EQ([NSScreen mainScreen], [window screen]);
32   EXPECT_TRUE([window canBecomeKeyWindow]);
33   EXPECT_TRUE([window canBecomeMainWindow]);
34   EXPECT_EQ(NSBorderlessWindowMask, [window styleMask]);
35   EXPECT_TRUE(NSEqualRects([[NSScreen mainScreen] frame], [window frame]));
36   EXPECT_FALSE([window isReleasedWhenClosed]);
39 TEST_F(FullscreenWindowTest, CanPerformClose) {
40   base::scoped_nsobject<FullscreenWindow> window;
41   window.reset([[FullscreenWindow alloc] init]);
43   base::scoped_nsobject<PerformCloseUIItem> item;
44   item.reset([[PerformCloseUIItem alloc] init]);
46   EXPECT_TRUE([window validateUserInterfaceItem:item.get()]);