Chromium Code Reviews| Index: ui/views/widget/native_widget_mac_unittest.mm |
| diff --git a/ui/views/widget/native_widget_mac_unittest.mm b/ui/views/widget/native_widget_mac_unittest.mm |
| index a320ad3e873dd3f2cf0e562f1550123ed7d98e1d..d9ef2868eba7df50fa620476b21a1ff0c3b1ea61 100644 |
| --- a/ui/views/widget/native_widget_mac_unittest.mm |
| +++ b/ui/views/widget/native_widget_mac_unittest.mm |
| @@ -373,6 +373,53 @@ class PaintCountView : public View { |
| DISALLOW_COPY_AND_ASSIGN(PaintCountView); |
| }; |
| +// Test for correct child window restore when parent window is minimized |
| +// and restored using -makeKeyAndOrderFront:. |
| +// Parent-child window relationships in AppKit are not supported when window |
| +// visibility changes. |
| +TEST_F(NativeWidgetMacTest, OrderFrontAfterMiniaturize) { |
|
tapted
2016/06/30 12:02:37
Let's just make this DISABLED_OrderFrontAfterMinia
|
| + Widget* widget = CreateTopLevelPlatformWidget(); |
| + NSWindow* ns_window = widget->GetNativeWindow(); |
| + |
| + Widget* child_widget = CreateChildPlatformWidget(widget->GetNativeView()); |
| + NSWindow* child_ns_window = child_widget->GetNativeWindow(); |
| + |
| + // Set parent bounds that overlap child. |
| + widget->SetBounds(gfx::Rect(100, 100, 300, 300)); |
| + child_widget->SetBounds(gfx::Rect(110, 110, 100, 100)); |
| + |
| + widget->Show(); |
| + base::RunLoop().RunUntilIdle(); |
| + |
| + EXPECT_FALSE(widget->IsMinimized()); |
| + |
| + // Minimize parent. |
| + [ns_window performMiniaturize:nil]; |
| + base::RunLoop().RunUntilIdle(); |
| + |
| + EXPECT_TRUE(widget->IsMinimized()); |
| + EXPECT_FALSE(widget->IsVisible()); |
| + EXPECT_FALSE(child_widget->IsVisible()); |
| + |
| + // Restore parent window as AppController does. |
| + [ns_window makeKeyAndOrderFront:nil]; |
| + |
| + // Wait and check that child is really visible. |
| + // TODO(kirr): remove the fixed delay. |
| + base::MessageLoop::current()->PostDelayedTask( |
| + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
| + base::TimeDelta::FromSeconds(2)); |
| + base::MessageLoop::current()->Run(); |
| + |
| + EXPECT_FALSE(widget->IsMinimized()); |
| + EXPECT_TRUE(widget->IsVisible()); |
| + EXPECT_TRUE(child_widget->IsVisible()); |
| + // Check that child window is visible. |
| + EXPECT_TRUE([child_ns_window occlusionState] & NSWindowOcclusionStateVisible); |
| + EXPECT_TRUE(IsWindowStackedAbove(child_widget, widget)); |
| + widget->Close(); |
| +} |
| + |
| // Test minimized states triggered externally, implied visibility and restored |
| // bounds whilst minimized. |
| TEST_F(NativeWidgetMacTest, MiniaturizeExternally) { |
| @@ -930,8 +977,6 @@ TEST_F(NativeWidgetMacTest, WindowModalSheet) { |
| queue:nil |
| usingBlock:^(NSNotification* note) { |
| EXPECT_TRUE([sheet_window delegate]); |
| - EXPECT_FALSE(sheet_widget->IsVisible()); |
| - EXPECT_FALSE(sheet_widget->GetLayer()->IsDrawn()); |
| *did_observe_ptr = true; |
| }]; |