Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_unittest.mm

Issue 493143004: mac: Major fullscreen refactor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to rsesek comments. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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 "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 void WaitForFullScreenTransition() { 824 void WaitForFullScreenTransition() {
825 content::WindowedNotificationObserver observer( 825 content::WindowedNotificationObserver observer(
826 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 826 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
827 content::NotificationService::AllSources()); 827 content::NotificationService::AllSources());
828 observer.Wait(); 828 observer.Wait();
829 } 829 }
830 830
831 // http://crbug.com/53586 831 // http://crbug.com/53586
832 TEST_F(BrowserWindowFullScreenControllerTest, DISABLED_TestFullscreen) { 832 TEST_F(BrowserWindowFullScreenControllerTest, DISABLED_TestFullscreen) {
833 [controller_ showWindow:nil]; 833 [controller_ showWindow:nil];
834 EXPECT_FALSE([controller_ isFullscreen]); 834 EXPECT_FALSE([controller_ isInOrEnteringAnyFullscreenMode]);
835 835
836 [controller_ enterFullscreen]; 836 [controller_ enterFullscreenWithChrome];
837 WaitForFullScreenTransition(); 837 WaitForFullScreenTransition();
838 EXPECT_TRUE([controller_ isFullscreen]); 838 EXPECT_TRUE([controller_ isInOrEnteringAnyFullscreenMode]);
839 839
840 [controller_ exitFullscreen]; 840 [controller_ exitGenericFullscreen];
841 WaitForFullScreenTransition(); 841 WaitForFullScreenTransition();
842 EXPECT_FALSE([controller_ isFullscreen]); 842 EXPECT_FALSE([controller_ isInOrEnteringAnyFullscreenMode]);
843 } 843 }
844 844
845 // If this test fails, it is usually a sign that the bots have some sort of 845 // If this test fails, it is usually a sign that the bots have some sort of
846 // problem (such as a modal dialog up). This tests is a very useful canary, so 846 // problem (such as a modal dialog up). This tests is a very useful canary, so
847 // please do not mark it as flaky without first verifying that there are no bot 847 // please do not mark it as flaky without first verifying that there are no bot
848 // problems. 848 // problems.
849 // http://crbug.com/53586 849 // http://crbug.com/53586
850 TEST_F(BrowserWindowFullScreenControllerTest, DISABLED_TestActivate) { 850 TEST_F(BrowserWindowFullScreenControllerTest, DISABLED_TestActivate) {
851 [controller_ showWindow:nil]; 851 [controller_ showWindow:nil];
852 852
853 EXPECT_FALSE([controller_ isFullscreen]); 853 EXPECT_FALSE([controller_ isInOrEnteringAnyFullscreenMode]);
854 854
855 [controller_ activate]; 855 [controller_ activate];
856 EXPECT_TRUE(IsFrontWindow([controller_ window])); 856 EXPECT_TRUE(IsFrontWindow([controller_ window]));
857 857
858 [controller_ enterFullscreen]; 858 [controller_ enterFullscreenWithChrome];
859 WaitForFullScreenTransition(); 859 WaitForFullScreenTransition();
860 [controller_ activate]; 860 [controller_ activate];
861 861
862 // No fullscreen window on 10.7+. 862 // No fullscreen window on 10.7+.
863 if (base::mac::IsOSSnowLeopard()) 863 if (base::mac::IsOSSnowLeopard())
864 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow])); 864 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow]));
865 865
866 // We have to cleanup after ourselves by unfullscreening. 866 // We have to cleanup after ourselves by unfullscreening.
867 [controller_ exitFullscreen]; 867 [controller_ exitGenericFullscreen];
868 WaitForFullScreenTransition(); 868 WaitForFullScreenTransition();
869 } 869 }
870 870
871 @implementation BrowserWindowControllerFakeFullscreen 871 @implementation BrowserWindowControllerFakeFullscreen
872 // Override |-createFullscreenWindow| to return a dummy window. This isn't 872 // Override |-createFullscreenWindow| to return a dummy window. This isn't
873 // needed to pass the test, but because the dummy window is only 100x100, it 873 // needed to pass the test, but because the dummy window is only 100x100, it
874 // prevents the real fullscreen window from flashing up and taking over the 874 // prevents the real fullscreen window from flashing up and taking over the
875 // whole screen. We have to return an actual window because |-layoutSubviews| 875 // whole screen. We have to return an actual window because |-layoutSubviews|
876 // looks at the window's frame. 876 // looks at the window's frame.
877 - (NSWindow*)createFullscreenWindow { 877 - (NSWindow*)createFullscreenWindow {
878 if (testFullscreenWindow_.get()) 878 if (testFullscreenWindow_.get())
879 return testFullscreenWindow_.get(); 879 return testFullscreenWindow_.get();
880 880
881 testFullscreenWindow_.reset( 881 testFullscreenWindow_.reset(
882 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) 882 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400)
883 styleMask:NSBorderlessWindowMask 883 styleMask:NSBorderlessWindowMask
884 backing:NSBackingStoreBuffered 884 backing:NSBackingStoreBuffered
885 defer:NO]); 885 defer:NO]);
886 return testFullscreenWindow_.get(); 886 return testFullscreenWindow_.get();
887 } 887 }
888 @end 888 @end
889 889
890 /* TODO(???): test other methods of BrowserWindowController */ 890 /* TODO(???): test other methods of BrowserWindowController */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698