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 "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 content::WindowedNotificationObserver observer( | 843 content::WindowedNotificationObserver observer( |
844 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 844 chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
845 content::NotificationService::AllSources()); | 845 content::NotificationService::AllSources()); |
846 observer.Wait(); | 846 observer.Wait(); |
847 } | 847 } |
848 | 848 |
849 TEST_F(BrowserWindowFullScreenControllerTest, TestFullscreen) { | 849 TEST_F(BrowserWindowFullScreenControllerTest, TestFullscreen) { |
850 [controller_ showWindow:nil]; | 850 [controller_ showWindow:nil]; |
851 EXPECT_FALSE([controller_ isFullscreen]); | 851 EXPECT_FALSE([controller_ isFullscreen]); |
852 | 852 |
853 [controller_ enterFullscreenForURL:GURL() | 853 [controller_ enterFullscreen]; |
854 bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]; | |
855 WaitForFullScreenTransition(); | 854 WaitForFullScreenTransition(); |
856 EXPECT_TRUE([controller_ isFullscreen]); | 855 EXPECT_TRUE([controller_ isFullscreen]); |
857 | 856 |
858 [controller_ exitFullscreen]; | 857 [controller_ exitFullscreen]; |
859 WaitForFullScreenTransition(); | 858 WaitForFullScreenTransition(); |
860 EXPECT_FALSE([controller_ isFullscreen]); | 859 EXPECT_FALSE([controller_ isFullscreen]); |
861 } | 860 } |
862 | 861 |
863 // If this test fails, it is usually a sign that the bots have some sort of | 862 // If this test fails, it is usually a sign that the bots have some sort of |
864 // problem (such as a modal dialog up). This tests is a very useful canary, so | 863 // problem (such as a modal dialog up). This tests is a very useful canary, so |
865 // please do not mark it as flaky without first verifying that there are no bot | 864 // please do not mark it as flaky without first verifying that there are no bot |
866 // problems. | 865 // problems. |
867 TEST_F(BrowserWindowFullScreenControllerTest, TestActivate) { | 866 TEST_F(BrowserWindowFullScreenControllerTest, TestActivate) { |
868 [controller_ showWindow:nil]; | 867 [controller_ showWindow:nil]; |
869 | 868 |
870 EXPECT_FALSE([controller_ isFullscreen]); | 869 EXPECT_FALSE([controller_ isFullscreen]); |
871 | 870 |
872 [controller_ activate]; | 871 [controller_ activate]; |
873 EXPECT_TRUE(IsFrontWindow([controller_ window])); | 872 EXPECT_TRUE(IsFrontWindow([controller_ window])); |
874 | 873 |
875 [controller_ enterFullscreenForURL:GURL() | 874 [controller_ enterFullscreen]; |
876 bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]; | |
877 WaitForFullScreenTransition(); | 875 WaitForFullScreenTransition(); |
878 [controller_ activate]; | 876 [controller_ activate]; |
879 | 877 |
880 // No fullscreen window on 10.7+. | 878 // No fullscreen window on 10.7+. |
881 if (base::mac::IsOSSnowLeopard()) | 879 if (base::mac::IsOSSnowLeopard()) |
882 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow])); | 880 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow])); |
883 | 881 |
884 // We have to cleanup after ourselves by unfullscreening. | 882 // We have to cleanup after ourselves by unfullscreening. |
885 [controller_ exitFullscreen]; | 883 [controller_ exitFullscreen]; |
886 WaitForFullScreenTransition(); | 884 WaitForFullScreenTransition(); |
(...skipping 12 matching lines...) Expand all Loading... |
899 testFullscreenWindow_.reset( | 897 testFullscreenWindow_.reset( |
900 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) | 898 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) |
901 styleMask:NSBorderlessWindowMask | 899 styleMask:NSBorderlessWindowMask |
902 backing:NSBackingStoreBuffered | 900 backing:NSBackingStoreBuffered |
903 defer:NO]); | 901 defer:NO]); |
904 return testFullscreenWindow_.get(); | 902 return testFullscreenWindow_.get(); |
905 } | 903 } |
906 @end | 904 @end |
907 | 905 |
908 /* TODO(???): test other methods of BrowserWindowController */ | 906 /* TODO(???): test other methods of BrowserWindowController */ |
OLD | NEW |