Commit 1c966377 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

macviews: fix window miniaturization test with newer SDKs

This change:

1) Splits up NativeWidgetMacTest.MiniaturizeExternally, which was a bit too big;
2) Adds an override on NativeWidgetMacNSWindow of _canMiniaturize, which
   always allows Views windows to be miniaturized; this is the behavior that
   the rest of Views (and the tests) expect, and is what happened on older SDKs.

Bug: 780980
Change-Id: Ic3356787433d9325aa13f1e01a8165c4ddd07b0a
Reviewed-on: https://chromium-review.googlesource.com/c/1394010Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619656}
parent 44fb3392
......@@ -599,10 +599,12 @@ TEST_F(NativeWidgetMacTest, MiniaturizeExternally) {
EXPECT_EQ(3, view->paint_count());
widget->CloseNow();
}
TEST_F(NativeWidgetMacTest, MiniaturizeFramelessWindow) {
// Create a widget without a minimize button.
widget = CreateTopLevelFramelessPlatformWidget();
ns_window = widget->GetNativeWindow().GetNativeNSWindow();
Widget* widget = CreateTopLevelFramelessPlatformWidget();
NSWindow* ns_window = widget->GetNativeWindow().GetNativeNSWindow();
widget->SetBounds(gfx::Rect(100, 100, 300, 300));
widget->Show();
EXPECT_FALSE(widget->IsMinimized());
......@@ -613,6 +615,8 @@ TEST_F(NativeWidgetMacTest, MiniaturizeExternally) {
// But this should work.
widget->Minimize();
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(widget->IsMinimized());
// Test closing while minimized.
......
......@@ -271,6 +271,13 @@
return touchBarDelegate_ ? [touchBarDelegate_ makeTouchBar] : nil;
}
// On newer SDKs, _canMiniaturize respects NSMiniaturizableWindowMask in the
// window's styleMask. Views assumes that Widgets can always be minimized,
// regardless of their window style, so override that behavior here.
- (BOOL)_canMiniaturize {
return YES;
}
// CommandDispatchingWindow implementation.
- (void)setCommandHandler:(id<UserInterfaceItemCommandHandler>)commandHandler {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment