Commit 86ac7381 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

macviews: fix NativeWidgetMacTest.NonWidgetParentLastReference on Big Sur

This test asserts that closing a parent NSWindow deallocates the child
NSWindow if the parent held the last reference. This is all well and
good, but needs to account for AppKit's habit of autoreleasing refs
to things while operating on them (eg, https://crbug.com/998773). Do this
by allowing the autorelease pool to drain before checking for dealloc.

Bug: 1114245
Change-Id: I46426f163b5fbdc3822ec4c4019c722cac787c83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2356910
Commit-Queue: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798275}
parent f3f5c4de
......@@ -870,8 +870,12 @@ TEST_F(NativeWidgetMacTest, NonWidgetParentLastReference) {
// to the child window is released inside WidgetOwnerNSWindowAdapter::
// OnWindowWillClose().
[native_parent close];
EXPECT_TRUE(child_dealloced);
}
// Check this only once the autorelease pool has been drained: AppKit likes to
// autorelease NSWindows when tearing them down, presumably to make UAF bugs
// with NSWindows less likely.
EXPECT_TRUE(child_dealloced);
EXPECT_TRUE(native_parent_dealloced);
}
......
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