Repository navigation
Speed Up the Android Camera and MediaControls Device Tests, and Fix a Flaky Android 10 Test - #3462
Merged
Merged
Conversation
…t Teardown Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… They Prove Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TheCodeTraveler
marked this pull request as ready for review
November 29, 2026 20:07
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndroid 10 and Older Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reword the comment and split the two low-profile steps into one named local function. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of Change
Speeds up the Android camera and MediaControls device tests by about 30 s per Android CI job: a full local API 36 run went from 1,190 s to 1,157 s. It also fixes a flaky Android 10 MediaElement device test. No library code changes. No test, row, assertion or timeout is removed or loosened.
Details for reviewers: what changed, measurements, what was kept
Where the time goes (CI API 33, run 46237553696): each row of these classes spends 0.6-1.0 s in teardown, outside its reported time. Most of it is Android work the tests must wait for:
Changes:
CameraAndroidTestBase: checks for the preview stream and for the first recorded sample every 20 ms instead of 100 ms.AssertEventuallycounts attempts, so its wall-clock timeout can only get longer. The MP4-header check stays at 100 ms, because a check duringMediaMuxer.startcan see a partly written header.CameraClosedCheck.GetDelayBeforeTheNextCheck:WaitForClosedAsyncnow checks just after a settling camera's 600 ms window ends, asAssertClosedNowAsyncalready did, instead of every 100 ms. Same window, same verdict rule. New 3-row test:TheNextCheckWaitsForTheEndOfTheWindowOnlyWhileACameraIsSettling.MediaElementAndroidTestBase: teardown skips its 1.5 s pause only when the test itself just ended with that pause, nothing was hosted after it, the service has stopped and no notification is showing. That is 3 rows; every other foreground-service row still pauses.Measured (Release, local emulators:
main766489a once, this branch 3 times):Left out on purpose:
ActivityResultManager, the code under test, would then see the next activity created before the previous one is destroyed at every row start, a state today's tests never produce.Flaky test fixed:
MauiMediaElementAndroidTests.HidingTheViewWhileInFullscreenDoesNotChangeTheSystemBars(visibility: Invisible)failed once on API 29 in this PR's first CI run ("The system bars never stayed hidden."), and about once in 100 API 29 runs overall.mainfailed 3 of 3 such runs with the CI error and passed the 6 runs where the pause missed it; this branch passed 6 of 6 such runs plus 3 normal runs. The MediaElement tests also pass on API 27, 28 and 36.Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal) (n/a: test-only)mainat time of PRAdditional information
Tested on Android API 36 and API 28 emulators (Release). CI runs every platform.
🤖 Generated with Claude Code