This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[macOS] Reuse NSWindow instance across unit tests #47350
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loic-sharma
reviewed
Oct 26, 2023
loic-sharma
approved these changes
Oct 26, 2023
Member
loic-sharma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ![]()
Adds a gtest test fixture mixin and convenience class that instantiates an NSAutoreleasePool at the beginning of each test and flushes it at the end; this allows Objective-C tests using ARC to free allocations at the end of each test. Adds a subclass for the macOS accessibility bridge tests that instantiates and re-uses an NSWindow* across any tests that use it. This is because instantiating, closing, and immediately collecting an NSWindow results in a crash. Prior to this patch, tests started failing (on my machine) around the 855th iteration, and issued the following warning on the 101st iteration: ``` 2023-10-26 13:02:45.390829-0700 flutter_desktop_darwin_unittests[40837:1509026] [Window] WARNING: NSWindow has detected an excessive live window count of 101. Window 0x1423 of class 'NSWindow' created after passing the threshold of 100. This window is not necessarily the cause, and this warning will only be shown once per window class. ( 0 AppKit 0x0000000192820d28 -[NSWindow _setWindowNumber:] + 684 1 AppKit 0x00000001933050e4 _NXCreateWindow + 284 2 AppKit 0x0000000192901ae0 -[NSWindow _commonAwake] + 672 3 AppKit 0x000000019281ff00 -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 972 4 AppKit 0x000000019281f798 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 796 5 AppKit 0x000000019281f470 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 48 6 flutter_desktop_darwin_unittests 0x0000000100001e3c _ZN7flutter7testing89AccessibilityBridgeMacTest_SendsAccessibilityCreateNotificationToWindowOfFlutterView_Test8TestBodyEv + 328 ``` See: http://www.openradar.me/FB13291861 Issue: flutter/flutter#104789 Issue: flutter/flutter#127441 Issue: flutter/flutter#124840
8 tasks
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Oct 26, 2023
fluttermirroringbot
pushed a commit
to flutter/flutter
that referenced
this pull request
Oct 26, 2023
…137380) flutter/engine@9788bb9...87f384c 2023-10-26 [email protected] [macOS] Reuse NSWindow instance across unit tests (flutter/engine#47350) 2023-10-26 [email protected] Roll Skia from fb72136c9325 to 93a0ad4d7ca6 (1 revision) (flutter/engine#47352) 2023-10-26 [email protected] Roll Fuchsia Linux SDK from akT2HxdLNPWSG-gbV... to 37VxdxlPfdkek7mwC... (flutter/engine#47351) 2023-10-26 [email protected] Fix for undefined `uint8_t` seen on Clang-15+GCC13 (flutter/engine#47288) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from akT2HxdLNPWS to 37VxdxlPfdke If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a gtest test fixture mixin and convenience class that instantiates an NSAutoreleasePool at the beginning of each test and flushes it at the end; this allows Objective-C tests using ARC to free allocations at the end of each test.
Adds a subclass for the macOS accessibility bridge tests that instantiates and re-uses an NSWindow* across any tests that use it. This is because instantiating, closing, and immediately collecting an NSWindow results in a crash.
Prior to this patch, tests started failing (on my machine) around the 855th iteration, and issued the following warning on the 101st iteration:
See: http://www.openradar.me/FB13291861
Issue: flutter/flutter#104789
Issue: flutter/flutter#127441
Issue: flutter/flutter#124840
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.