diff options
author | tapted <tapted@chromium.org> | 2014-10-20 15:45:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-20 22:45:53 +0000 |
commit | 4863f1de058a942ef677ccc05805ea75b9ee4cb9 (patch) | |
tree | bd781b820a0b5de15e338049ef6b337be1c05705 /ui/views | |
parent | 7d57bdc3c5afc1fd8a5c2ef72c751735582962a1 (diff) | |
download | chromium_src-4863f1de058a942ef677ccc05805ea75b9ee4cb9.zip chromium_src-4863f1de058a942ef677ccc05805ea75b9ee4cb9.tar.gz chromium_src-4863f1de058a942ef677ccc05805ea75b9ee4cb9.tar.bz2 |
Fix MacViews views_unittest simulate FullScreen test for 10.7+ SDKs
bridged_native_widget_unittest.mm currently fails to compile on 10.7+
SDKs because there is no such thing as
NSWindowDidFailToEnterFullScreenNotification (whoops).
The failures don't go through NSNotificationCenter, but to the
NSWindowDelegate protocol directly. So, add a dummy protocol for 10.6
and, in the simulate fullscreen failure test, send
windowDidFailTo{Enter,Exit}FullScreen to the window delegate directly.
Call via `id` so the test compiles on 10.6 SDKs, but return early so the
tests pass when actually running on 10.6.
BUG=378134
TEST=By tracing the simulation test, and manually to generate an actual
failure.
Review URL: https://codereview.chromium.org/665823002
Cr-Commit-Position: refs/heads/master@{#300366}
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/cocoa/bridged_native_widget_unittest.mm | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/ui/views/cocoa/bridged_native_widget_unittest.mm b/ui/views/cocoa/bridged_native_widget_unittest.mm index fb4c679..eb44b9f 100644 --- a/ui/views/cocoa/bridged_native_widget_unittest.mm +++ b/ui/views/cocoa/bridged_native_widget_unittest.mm @@ -7,6 +7,7 @@ #import <Cocoa/Cocoa.h> #import "base/mac/foundation_util.h" +#import "base/mac/mac_util.h" #import "base/mac/sdk_forward_declarations.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" @@ -534,6 +535,9 @@ TEST_F(BridgedNativeWidgetTest, TextInput_DeleteForward) { // by the Widget code or elsewhere (e.g. by the user). TEST_F(BridgedNativeWidgetTest, FullscreenSynchronousState) { EXPECT_FALSE(widget_->IsFullscreen()); + if (base::mac::IsOSSnowLeopard()) + return; + // Allow user-initiated fullscreen changes on the Window. [test_window() setCollectionBehavior:[test_window() collectionBehavior] | @@ -594,6 +598,12 @@ TEST_F(BridgedNativeWidgetTest, FullscreenEnterAndExit) { // Ensure this works without having to change collection behavior as for the // test above. widget_->SetFullscreen(true); + if (base::mac::IsOSSnowLeopard()) { + // On Snow Leopard, SetFullscreen() isn't implemented. But shouldn't crash. + EXPECT_FALSE(widget_->IsFullscreen()); + return; + } + EXPECT_TRUE(widget_->IsFullscreen()); EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); @@ -625,6 +635,9 @@ typedef BridgedNativeWidgetTestBase BridgedNativeWidgetSimulateFullscreenTest; // mashing Ctrl+Left/Right to keep OSX in a transition between Spaces to cause // the fullscreen transition to fail. TEST_F(BridgedNativeWidgetSimulateFullscreenTest, FailToEnterAndExit) { + if (base::mac::IsOSSnowLeopard()) + return; + base::scoped_nsobject<NSWindow> owned_window( [[BridgedNativeWidgetTestFullScreenWindow alloc] initWithContentRect:NSMakeRect(50, 50, 400, 300) @@ -657,9 +670,11 @@ TEST_F(BridgedNativeWidgetSimulateFullscreenTest, FailToEnterAndExit) { EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); EXPECT_FALSE(bridge()->target_fullscreen_state()); - // Cocoa follows up with a failure notification. - [center postNotificationName:NSWindowDidFailToEnterFullScreenNotification - object:window]; + // Cocoa follows up with a failure message sent to the NSWindowDelegate (there + // is no equivalent notification for failure). Called via id so that this + // compiles on 10.6. + id window_delegate = [window delegate]; + [window_delegate windowDidFailToEnterFullScreen:window]; EXPECT_FALSE(bridge()->target_fullscreen_state()); // Now perform a successful fullscreen operation. @@ -675,10 +690,9 @@ TEST_F(BridgedNativeWidgetSimulateFullscreenTest, FailToEnterAndExit) { object:window]; EXPECT_FALSE(bridge()->target_fullscreen_state()); - // On a failure, Cocoa sends a failure notification, but then just dumps the - // Window out of fullscreen anyway (in that order). - [center postNotificationName:NSWindowDidFailToExitFullScreenNotification - object:window]; + // On a failure, Cocoa sends a failure message, but then just dumps the window + // out of fullscreen anyway (in that order). + [window_delegate windowDidFailToExitFullScreen:window]; EXPECT_FALSE(bridge()->target_fullscreen_state()); [center postNotificationName:NSWindowDidExitFullScreenNotification object:window]; |