Skip to content

[camera]fix test flake due to expectation fulfilled before flag is toggled - #12400

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
hellohuanlin:camera_test_flake
Aug 10, 2026
Merged

[camera]fix test flake due to expectation fulfilled before flag is toggled#12400
auto-submit[bot] merged 1 commit into
flutter:mainfrom
hellohuanlin:camera_test_flake

Conversation

@hellohuanlin

@hellohuanlinhellohuanlin commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The flake is due to completion block (which fulfills the expectation) being called too early, before the flag to test is actually toggled

It flakes (rather than consistently fails) because we toggle the flag on capture session queue, while the test runs on main, resulting in a race.

Also audited all camera tests to check for similar bugs.

List which issues are fixed by this PR. You must list at least one issue.

Fixesflutter/flutter#189108

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot 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.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@gemini-code-assistgemini-code-assistBot 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 several mock camera stubs in CameraPluginDelegatingMethodTests.swift to set their respective state tracking flags before invoking their completion handlers. There are no review comments, and I have no additional feedback to provide.

@hellohuanlinhellohuanlin changed the title [camera]fix camera flake due to expectation fulfilled before flag is …[camera]fix test flake due to expectation fulfilled before flag is toggledAug 7, 2026

@stuartmorgan-gstuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

(It'll be nice when this is converted to Swift Testing, where we will just return a value from each async block directly.)

@stuartmorgan-gstuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 10, 2026
@auto-submit
auto-submitBot merged commit a85dde7 into flutter:mainAug 10, 2026
12 checks passed
pullBot pushed a commit to Klomgor/flutter that referenced this pull request Aug 11, 2026
…r#190923)
flutter/packages@1861b68...aaaf246
2026-08-10 jmccandless@google.com [cupertino_ui] Main example
(flutter/packages#12380)
2026-08-10 katelovett@google.com Update ci for + releases
(flutter/packages#12419)
2026-08-10 engine-flutter-autoroll@skia.org Manual roll Flutter from
b766512 to 27b0988 (29 revisions) (flutter/packages#12420)
2026-08-10 engine-flutter-autoroll@skia.org Manual roll Flutter from
e52f01c to b766512 (42 revisions) (flutter/packages#12406)
2026-08-10 41930132+hellohuanlin@users.noreply.github.com [camera]fix
test flake due to expectation fulfilled before flag is toggled
(flutter/packages#12400)
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-flutter-autoroll
Please CC flutter-ecosystem@google.com 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmitMerge PR when tree becomes green via auto submit AppCICDRun CI/CDp: cameraplatform-iosplatform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[camera] Flake in camera_avfoundation native unit tests

2 participants

@hellohuanlin@stuartmorgan-g