OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/memory/scoped_nsobject.h" | 8 #import "base/memory/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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 | 700 |
701 [controller_ activate]; | 701 [controller_ activate]; |
702 EXPECT_TRUE(IsFrontWindow([controller_ window])); | 702 EXPECT_TRUE(IsFrontWindow([controller_ window])); |
703 | 703 |
704 [controller_ enterFullscreenForURL:GURL() | 704 [controller_ enterFullscreenForURL:GURL() |
705 bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]; | 705 bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]; |
706 WaitForFullScreenTransition(); | 706 WaitForFullScreenTransition(); |
707 [controller_ activate]; | 707 [controller_ activate]; |
708 | 708 |
709 // No fullscreen window on 10.7+. | 709 // No fullscreen window on 10.7+. |
710 if (base::mac::IsOSSnowLeopardOrEarlier()) | 710 if (base::mac::IsOSSnowLeopard()) |
711 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow])); | 711 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow])); |
712 | 712 |
713 // We have to cleanup after ourselves by unfullscreening. | 713 // We have to cleanup after ourselves by unfullscreening. |
714 [controller_ exitFullscreen]; | 714 [controller_ exitFullscreen]; |
715 WaitForFullScreenTransition(); | 715 WaitForFullScreenTransition(); |
716 } | 716 } |
717 | 717 |
718 @implementation BrowserWindowControllerFakeFullscreen | 718 @implementation BrowserWindowControllerFakeFullscreen |
719 // Override |-createFullscreenWindow| to return a dummy window. This isn't | 719 // Override |-createFullscreenWindow| to return a dummy window. This isn't |
720 // needed to pass the test, but because the dummy window is only 100x100, it | 720 // needed to pass the test, but because the dummy window is only 100x100, it |
721 // prevents the real fullscreen window from flashing up and taking over the | 721 // prevents the real fullscreen window from flashing up and taking over the |
722 // whole screen. We have to return an actual window because |-layoutSubviews| | 722 // whole screen. We have to return an actual window because |-layoutSubviews| |
723 // looks at the window's frame. | 723 // looks at the window's frame. |
724 - (NSWindow*)createFullscreenWindow { | 724 - (NSWindow*)createFullscreenWindow { |
725 if (testFullscreenWindow_.get()) | 725 if (testFullscreenWindow_.get()) |
726 return testFullscreenWindow_.get(); | 726 return testFullscreenWindow_.get(); |
727 | 727 |
728 testFullscreenWindow_.reset( | 728 testFullscreenWindow_.reset( |
729 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) | 729 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) |
730 styleMask:NSBorderlessWindowMask | 730 styleMask:NSBorderlessWindowMask |
731 backing:NSBackingStoreBuffered | 731 backing:NSBackingStoreBuffered |
732 defer:NO]); | 732 defer:NO]); |
733 return testFullscreenWindow_.get(); | 733 return testFullscreenWindow_.get(); |
734 } | 734 } |
735 @end | 735 @end |
736 | 736 |
737 /* TODO(???): test other methods of BrowserWindowController */ | 737 /* TODO(???): test other methods of BrowserWindowController */ |
OLD | NEW |