Repository navigation
[tests] Use cooperative cancellation for ViewActionCallbackTests - #13822
Open
simonrozsival wants to merge 2 commits into
Open
simonrozsival wants to merge 2 commits into
simonrozsival wants to merge 2 commits into
Conversation
ViewActionCallbackTests.RemoveCallbacksCancelsScheduledDrawable timed out in build 1703649 (macOS APKs 1, Debug) waiting 10s for the activity to report readiness. Readiness is signalled from a View.Post() queued before attach, so it waits for the first traversal. On the loaded emulator the first frame's measure/layout took ~3.95s and system_server skipped up to 153 frames; the callback test body never ran. Use the same 30s bound already used for the posted-work wait. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace the per-wait TimeSpan timeouts with the MSTest cancellation token, bounding each activity-based test with [Timeout (60_000, CooperativeCancellation = true)] as other Mono.Android-Tests do. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Teardown uses the test’s canceled token after a timeout, allowing callback removal, disposal, and activity cleanup to remain pending and overlap subsequent tests.
1 open issue
What changed in this PR
This PR updates ViewActionCallbackTests to tolerate slow activity startup on contended emulators by using cooperative test cancellation instead of separate per-wait deadlines.
Changes:
- Injects
TestContextand passes its cancellation token through asynchronous helpers. - Adds a 60-second cooperative timeout to the four asynchronous test methods.
- Preserves existing callback assertions and regression coverage.
| File | Description |
|---|---|
| tests/Mono.Android-Tests/Mono.Android-Tests/Android.Views/ViewActionCallbackTests.cs | Replaces fixed wait deadlines with test cancellation and adds cooperative timeouts. |
Review effort: Balanced
| } | ||
| activity.Finish (); | ||
| }); | ||
| }, cancellationToken); |
This branch has not been deployed
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.

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
d0ccf3372686034eb063df8d471bc8d0b58198a3↑ Assertions and regression coverage are unchanged.
↓ CI for this revision has not run.
Context: #13749
The activity signals readiness only after its first traversal attaches the view. In build 1703649, the Debug run timed out in
WithActivitybefore the callback test body ran; logcat showed a slow first frame and system_server skipping up to 153 frames, consistent with emulator contention rather than a callback regression. The APKs 1 retry succeeded, and the 40 other configuration runs checked since the test was introduced had no failures.Replaced the per-wait
TimeSpantimeouts with the test's cancellation token and bounded the four asynchronous activity tests with a 60-second cooperative test timeout. Assertions and regression coverage are unchanged.Validation:
./dotnet-local.sh build -t:Install -c Debug -p:Device=emulator-5556 tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj -v:q -nologo— passed.tests/Mono.Android-Tests/Mono.Android-Tests:../../../dotnet-local.sh test Mono.Android.NET-Tests.csproj --no-build -c Debug -p:Device=emulator-5556 --report-trx --results-directory ../../../bin/TestDebug/TestResults2— passed: 1143 passed, 1 skipped, 0 failed; all 7ViewActionCallbackTestscases passed.