Skip to content

Reset flutter engine internal state in framework test postTest - #193842

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
andywolff:test_randomization_2
Oct 7, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
andywolff:test_randomization_2

Conversation

@andywolff

Copy link
Copy Markdown
Contributor

Part of #192992

Follow-up to #193497.

In #193497, I introduced PlatformDispatcher.resetInternalState() to allow test harnesses to purge internal engine caches (such as Impeller's offscreen RenderTargetCache) between test cases to ensure test isolation.

Now that the engine changes have rolled into the framework, this PR connects the framework test harness:

  1. Implements TestPlatformDispatcher.resetInternalState() in packages/flutter_test/lib/src/window.dart to delegate to the underlying PlatformDispatcher.
  2. Invokes platformDispatcher.resetInternalState() in TestWidgetsFlutterBinding.postTest alongside ServicesBinding.instance.resetInternalState().
  3. Adds a unit test in packages/flutter_test/test/platform_dispatcher_test.dart to verify delegation.

Pre-launch Checklist

@github-actions github-actions Bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. labels Oct 5, 2026
@andywolff
andywolff force-pushed the test_randomization_2 branch from e06b3f3 to e6faed0 Compare October 6, 2026 18:48
@andywolff andywolff added the CICD Run CI/CD label Oct 6, 2026
@andywolff
andywolff marked this pull request as ready for review October 6, 2026 20:35

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates TestWidgetsFlutterBinding to call platformDispatcher.resetInternalState() during state reset. It also implements resetInternalState in TestPlatformDispatcher to delegate to the underlying PlatformDispatcher, and adds corresponding unit tests to verify this delegation. There are no review comments, and I have no additional feedback to provide.

@andywolff
andywolff requested a review from gaaclarke October 6, 2026 20:44

@gaaclarke gaaclarke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@andywolff andywolff added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 7, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 7, 2026
@auto-submit

auto-submit Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/193842, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@andywolff andywolff added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 7, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 7, 2026
Merged via the queue into flutter:master with commit c97791d Oct 7, 2026
22 of 23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 7, 2026
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…er#193842)

Part of flutter#192992

Follow-up to flutter#193497.

In flutter#193497, I introduced
`PlatformDispatcher.resetInternalState()` to allow test harnesses to
purge internal engine caches (such as Impeller's offscreen
`RenderTargetCache`) between test cases to ensure test isolation.

Now that the engine changes have rolled into the framework, this PR
connects the framework test harness:
1. Implements `TestPlatformDispatcher.resetInternalState()` in
`packages/flutter_test/lib/src/window.dart` to delegate to the
underlying `PlatformDispatcher`.
2. Invokes `platformDispatcher.resetInternalState()` in
`TestWidgetsFlutterBinding.postTest` alongside
`ServicesBinding.instance.resetInternalState()`.
3. Adds a unit test in
`packages/flutter_test/test/platform_dispatcher_test.dart` to verify
delegation.


## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[flutter/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tests "flutter test", flutter_test, or one of our tests CICD Run CI/CD framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants