test: cover the local network classifier and gate state machine

Extract the on-link decision into a pure function, test it with the
Android 17 SDK through Robolectric's connectivity shadows, and exercise
the gate's grant, denial, cancellation and stale-check paths with a fake
checker. The SDK 37 shadow needs jdk.internal.access exported to the
test JVM.
This commit is contained in:
austinried
2026-11-14 12:08:14 +00:00
parent 94093d5e91
commit 63c41c24b3
6 changed files with 430 additions and 31 deletions
+5
View File
@@ -91,6 +91,11 @@ android {
testOptions {
unitTests {
isIncludeAndroidResources = true
all {
// Robolectric's SDK 37 ApplicationSharedMemory reaches into jdk.internal.access via
// its FileDescriptor interceptor, which JDK 17+ does not export by default.
it.jvmArgs("--add-exports=java.base/jdk.internal.access=ALL-UNNAMED")
}
}
}