From c9a5db1ac86c9643c39a6273a040f4e5472450b9 Mon Sep 17 00:00:00 2001 From: darken Date: Tue, 28 Jul 2026 16:18:20 +0200 Subject: [PATCH] test(mediacontrol): Name handler registration test after what it asserts The test claimed to guard against a main-looper binding, but the assertion only checks that the injected handler instance is forwarded. Rename it and document that the Looper identity is covered by the AndroidModule provider and the runtime thread-name QA check instead. Fixes review finding F1 --- .../test/java/eu/darken/capod/common/MediaControlTest.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/test/java/eu/darken/capod/common/MediaControlTest.kt b/app/src/test/java/eu/darken/capod/common/MediaControlTest.kt index 7aaa2bda..5d5b5f72 100644 --- a/app/src/test/java/eu/darken/capod/common/MediaControlTest.kt +++ b/app/src/test/java/eu/darken/capod/common/MediaControlTest.kt @@ -242,9 +242,14 @@ class MediaControlTest : BaseTest() { } @Test - fun `playback callback is registered on the injected background handler, not the main looper`() { + fun `playback callback is registered with the injected handler rather than null`() { // Regression for the ANR cluster in onPlaybackConfigChanged: passing `null` here binds // callback delivery to the main looper, and the callback body does a binder call. + // Scope of this assertion: it only proves the injected handler is forwarded, not which + // Looper that handler is bound to — a JVM unit test cannot inspect a Looper here (this + // module does not use Robolectric). The Looper identity is covered instead by + // `AndroidModule.audioCallbackHandler()`, which is the single place that constructs it, + // and by the runtime QA check asserting the registration logs thread `CAPod-MediaControl`. verify { audioManager.registerAudioPlaybackCallback(any(), handler) } }