OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 | 786 |
787 [controller_ activate]; | 787 [controller_ activate]; |
788 chrome::testing::NSRunLoopRunAllPending(); | 788 chrome::testing::NSRunLoopRunAllPending(); |
789 EXPECT_TRUE(IsFrontWindow([controller_ window])); | 789 EXPECT_TRUE(IsFrontWindow([controller_ window])); |
790 | 790 |
791 [controller_ enterBrowserFullscreenWithToolbar:YES]; | 791 [controller_ enterBrowserFullscreenWithToolbar:YES]; |
792 WaitForFullScreenTransition(); | 792 WaitForFullScreenTransition(); |
793 [controller_ activate]; | 793 [controller_ activate]; |
794 chrome::testing::NSRunLoopRunAllPending(); | 794 chrome::testing::NSRunLoopRunAllPending(); |
795 | 795 |
796 // No fullscreen window on 10.7+. | |
797 if (base::mac::IsOSSnowLeopard()) | |
798 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow])); | |
799 | |
800 // We have to cleanup after ourselves by unfullscreening. | 796 // We have to cleanup after ourselves by unfullscreening. |
801 [controller_ exitAnyFullscreen]; | 797 [controller_ exitAnyFullscreen]; |
802 WaitForFullScreenTransition(); | 798 WaitForFullScreenTransition(); |
803 } | 799 } |
804 | 800 |
805 @implementation BrowserWindowControllerFakeFullscreen | 801 @implementation BrowserWindowControllerFakeFullscreen |
806 // Override |-createFullscreenWindow| to return a dummy window. This isn't | 802 // Override |-createFullscreenWindow| to return a dummy window. This isn't |
807 // needed to pass the test, but because the dummy window is only 100x100, it | 803 // needed to pass the test, but because the dummy window is only 100x100, it |
808 // prevents the real fullscreen window from flashing up and taking over the | 804 // prevents the real fullscreen window from flashing up and taking over the |
809 // whole screen. We have to return an actual window because |-layoutSubviews| | 805 // whole screen. We have to return an actual window because |-layoutSubviews| |
810 // looks at the window's frame. | 806 // looks at the window's frame. |
811 - (NSWindow*)createFullscreenWindow { | 807 - (NSWindow*)createFullscreenWindow { |
812 if (testFullscreenWindow_.get()) | 808 if (testFullscreenWindow_.get()) |
813 return testFullscreenWindow_.get(); | 809 return testFullscreenWindow_.get(); |
814 | 810 |
815 testFullscreenWindow_.reset( | 811 testFullscreenWindow_.reset( |
816 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) | 812 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) |
817 styleMask:NSBorderlessWindowMask | 813 styleMask:NSBorderlessWindowMask |
818 backing:NSBackingStoreBuffered | 814 backing:NSBackingStoreBuffered |
819 defer:NO]); | 815 defer:NO]); |
820 [[testFullscreenWindow_ contentView] setWantsLayer:YES]; | 816 [[testFullscreenWindow_ contentView] setWantsLayer:YES]; |
821 return testFullscreenWindow_.get(); | 817 return testFullscreenWindow_.get(); |
822 } | 818 } |
823 @end | 819 @end |
824 | 820 |
825 /* TODO(???): test other methods of BrowserWindowController */ | 821 /* TODO(???): test other methods of BrowserWindowController */ |
OLD | NEW |