Pin the fallback test's device profile so it is not machine-dependent

Running the suite across API 33, 34, 35 and 36 emulators failed the same test
on all four, while it passed on a Pixel 10 Pro XL. The assertion was "the
hardware path should have been attempted", and the routing was correct in both
cases: those emulators expose no hardware H.264 encoder, so the router sent the
job straight to FFmpeg and Media3 was never called.

That is the same mistake made earlier with routesAFastMp4JobToMedia3 -- baking
an assumption about the host's encoders into a test. A result that flips with
the machine says nothing about the code.

This test is about the fallback mechanism rather than about routing, so it now
pins DeviceCodecs.PERMISSIVE through the existing seam and the router's choice
becomes deterministic. Routing itself is covered separately, by tests that
derive their expectation from the device.

Verified on emulators for API 33, 34, 35 and 36: 40 instrumented tests each,
0 failures, 2 skipped, with the only skips being the opt-in benchmark. That
also exercises all three foreground-service regimes for the first time -- no
type below 34, dataSync at 34, mediaProcessing from 35 -- which had previously
only ever run at API 37.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-20 13:01:42 -05:00
co-authored by Claude Opus 5
parent 99bd961022
commit a172cb137f
@@ -7,6 +7,7 @@ import androidx.test.platform.app.InstrumentationRegistry
import androidx.work.WorkInfo
import androidx.work.WorkManager
import dev.jasonmross.mediaconverter.convert.ConversionDependencies
import dev.jasonmross.mediaconverter.model.DeviceCodecs
import dev.jasonmross.mediaconverter.model.Engine
import dev.jasonmross.mediaconverter.model.OutputFormat
import dev.jasonmross.mediaconverter.model.QualityTier
@@ -77,6 +78,12 @@ class ForcedFailureTest {
val software = FakeFailures.RecordingSoftware()
ConversionDependencies.hardware = { hardware }
ConversionDependencies.software = { software }
// Pin the device profile. This test is about the fallback mechanism, not about
// routing, and most emulators expose no hardware video encoder at all -- so the
// router would legitimately send the job straight to FFmpeg and the hardware
// path would never be attempted. Without this the test passes on a Pixel and
// fails on every emulator, which says nothing about the code under test.
ConversionDependencies.deviceCodecs = { DeviceCodecs.PERMISSIVE }
val terminal = runToCompletion(convertRequest(OutputFormat.MP4_H264))