Repository navigation
Remove no shuffle from flutter_driver extension_test.dart and mock flutter.process channel - #187559
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the @Tags(<String>['no-shuffle']) tag, the library; declaration, and the associated TODO comment from packages/flutter_driver/test/src/real_tests/extension_test.dart. There are no review comments, and I have no feedback to provide.
|
This needs a bit more work |
f2199fb to
9cb6f9a
Compare
| TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( | ||
| SystemChannels.platform, | ||
| (MethodCall methodCall) async { | ||
| return null; | ||
| }, |
There was a problem hiding this comment.
I'm not too sure where this should be added, any advice on that?
There was a problem hiding this comment.
Yeah I think this should be reverted and moved elsewhere. Instead, maybe register SystemChannels.platform mock handling directly within extension_test.dart (e.g. in a top-level setUp or group setUp), where text widgets are constructed and tested.
There was a problem hiding this comment.
Code Review
This pull request removes the 'no-shuffle' tag from extension_test.dart and adds teardown logic to clean up mock message handlers and dispose of text controllers. It also mocks SystemChannels.platform inside mockFlutterAssets(). The review feedback suggests that mocking SystemChannels.platform inside mockFlutterAssets violates the single responsibility principle and may cause side effects. Additionally, the feedback recommends refactoring duplicated mock setup and teardown logic for SystemChannels.processText and hello channels into helper functions to improve maintainability.
| TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( | ||
| SystemChannels.platform, | ||
| (MethodCall methodCall) async { | ||
| return null; | ||
| }, | ||
| ); |
There was a problem hiding this comment.
Mocking SystemChannels.platform inside mockFlutterAssets() violates the single responsibility principle, as this function is specifically intended for mocking assets. Additionally, setting a global mock handler for SystemChannels.platform here affects all tests and might interfere with tests that expect to handle or mock platform messages differently. Consider moving this mock setup to a more appropriate global initialization phase or binding setup, or keep it localized to the tests that actually require it.
References
- Optimize for readability and maintain clean code structure. (link)
| tester.binding.defaultBinaryMessenger.setMockMethodCallHandler( | ||
| SystemChannels.processText, | ||
| (_) async => null, | ||
| ); | ||
| addTearDown(() { | ||
| tester.binding.defaultBinaryMessenger.setMockMethodCallHandler( | ||
| SystemChannels.processText, | ||
| null, | ||
| ); | ||
| }); |
There was a problem hiding this comment.
The mocking and teardown of SystemChannels.processText is duplicated across multiple tests in this file (e.g., in getText, enableTextEntryEmulation false, enableTextEntryEmulation true, and press done trigger onSubmitted and change value). To improve maintainability and reduce boilerplate, consider extracting this into a helper function at the file level, such as void _mockProcessText(WidgetTester tester) { ... }.
References
- Suggest simplification and refactoring to enhance readability and maintainability. (link)
| addTearDown(() { | ||
| tester.binding.defaultBinaryMessenger.setMockMessageHandler('helloChannel1', null); | ||
| tester.binding.defaultBinaryMessenger.setMockMessageHandler('helloChannel2', null); | ||
| }); |
There was a problem hiding this comment.
The teardown logic to clear helloChannel1 and helloChannel2 is duplicated across multiple tests (e.g., lines 354-357, 411-414, and 472-475). Consider extracting this into a helper function to keep the tests clean and maintainable.
References
- Suggest simplification and refactoring to enhance readability and maintainability. (link)
c1e5b56 to
b890ae2
Compare
| TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( | ||
| SystemChannels.platform, | ||
| (MethodCall methodCall) async { | ||
| return null; | ||
| }, |
There was a problem hiding this comment.
Yeah I think this should be reverted and moved elsewhere. Instead, maybe register SystemChannels.platform mock handling directly within extension_test.dart (e.g. in a top-level setUp or group setUp), where text widgets are constructed and tested.
| key: const ValueKey<String>('text3'), | ||
| controller: TextEditingController(text: 'Hello3'), | ||
| controller: controller3, | ||
| focusNode: FocusNode(), |
There was a problem hiding this comment.
While looking at this, I think this FocusNode leaks. Can you declare final focusNode3 = FocusNode(); before pumpWidget and register addTearDown(focusNode3.dispose); to resolve?
b890ae2 to
f51a044
Compare
f51a044 to
2cbf4eb
Compare
…12325) Manual roll requested by [email protected] flutter/flutter@c83f80b...2a230d1 2026-07-29 [email protected] Clarify CustomScrollView use cases (flutter/flutter#189692) 2026-07-29 [email protected] Fix TreeSliver first node clipping during expand/collapse animation (flutter/flutter#188626) 2026-07-29 [email protected] iOS: Migrate VSyncClient tests to Swift Testing (flutter/flutter#190054) 2026-07-29 [email protected] Remove no shuffle from flutter_driver extension_test.dart and mock flutter.process channel (flutter/flutter#187559) 2026-07-29 [email protected] Adds missing await on `instantiateImageCodecFromBuffer` (flutter/flutter#188910) 2026-07-29 [email protected] [web] Provide Content-Length header for CanvasKit files in flutter test (flutter/flutter#190155) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: 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
Part of #85160
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.