diff --git a/tools/chatgui-android/router-tests/src/main/kotlin/android/app/HostNotifications.kt b/tools/chatgui-android/router-tests/src/main/kotlin/android/app/HostNotifications.kt index 79e9539a..84ee808c 100644 --- a/tools/chatgui-android/router-tests/src/main/kotlin/android/app/HostNotifications.kt +++ b/tools/chatgui-android/router-tests/src/main/kotlin/android/app/HostNotifications.kt @@ -30,7 +30,7 @@ class NotificationChannel(val id: String, val name: String, val importance: Int) /** Host OS boundaries: отказы канала, разрешений и публикации независимы. */ class NotificationManager { - companion object { const val IMPORTANCE_HIGH = 4 } + companion object { const val IMPORTANCE_HIGH = 4; const val IMPORTANCE_LOW = 2 } var failures = emptySet() var notificationsEnabled = true var fullScreenAllowed = true diff --git a/tools/chatgui-android/router-tests/src/main/kotlin/android/content/Context.kt b/tools/chatgui-android/router-tests/src/main/kotlin/android/content/Context.kt index 20c85846..fb5e8048 100644 --- a/tools/chatgui-android/router-tests/src/main/kotlin/android/content/Context.kt +++ b/tools/chatgui-android/router-tests/src/main/kotlin/android/content/Context.kt @@ -28,7 +28,7 @@ open class Context { var powerManager: PowerManager? = PowerManager() var failPowerService = false val resources = HostResources() - var windowManager: android.view.WindowManager? = android.view.WindowManager() + var windowService: android.view.WindowManager? = android.view.WindowManager() val serviceStarts = mutableListOf() val serviceStops = mutableListOf() var failServiceStart = false @@ -81,7 +81,7 @@ open class Context { VIBRATOR_SERVICE -> vibrator POWER_SERVICE -> { check(!failPowerService) { "power service lookup unavailable" }; powerManager } WIFI_SERVICE -> { check(!failWifiService) { "Wi-Fi service unavailable" }; wifiManager } - WINDOW_SERVICE -> windowManager + WINDOW_SERVICE -> windowService else -> error("Unknown service: $name") } fun getSystemService(type: Class): T? { diff --git a/tools/chatgui-android/router-tests/src/test/kotlin/com/utun/chat/data/RadioOverlayLifecycleTest.kt b/tools/chatgui-android/router-tests/src/test/kotlin/com/utun/chat/data/RadioOverlayLifecycleTest.kt index 7395beab..9d4e0a60 100644 --- a/tools/chatgui-android/router-tests/src/test/kotlin/com/utun/chat/data/RadioOverlayLifecycleTest.kt +++ b/tools/chatgui-android/router-tests/src/test/kotlin/com/utun/chat/data/RadioOverlayLifecycleTest.kt @@ -34,7 +34,7 @@ class RadioOverlayLifecycleTest { private val dispatcher = StandardTestDispatcher() private val services = mutableListOf() private var previousEngine: Any? = null - private val wm get() = requireNotNull(context.windowManager) + private val wm get() = requireNotNull(context.windowService) private val view get() = wm.windows.keys.single() private val main get() = Looper.getMainLooper() @@ -79,7 +79,7 @@ class RadioOverlayLifecycleTest { private fun drain() { io.submit {}.get(5, TimeUnit.SECONDS) } private fun create(): RadioOverlayService = RadioOverlayService().also { - services.add(it); it.notificationManager = context.notificationManager; it.windowManager = wm + services.add(it); it.notificationManager = context.notificationManager; it.windowService = wm it.permissionGranted = context.permissionGranted it.onCreate(); dispatcher.scheduler.runCurrent() } @@ -99,12 +99,12 @@ class RadioOverlayLifecycleTest { @Test fun startupChannelAndForegroundFailuresAreLoggedAndRequestStop() { for (failure in listOf("channel", "foreground", "foreground after", "window")) { - val service = RadioOverlayService().also { services.add(it); it.notificationManager = context.notificationManager; it.windowManager = wm } + val service = RadioOverlayService().also { services.add(it); it.notificationManager = context.notificationManager; it.windowService = wm } when (failure) { "channel" -> requireNotNull(context.notificationManager).failures = setOf("channel") "foreground" -> service.failForeground = true "foreground after" -> service.failForegroundAfter = true - "window" -> service.windowManager = null + "window" -> service.windowService = null } service.onCreate(); assertTrue(service.stops > 0); diagnostic("service setup failed") requireNotNull(context.notificationManager).failures = emptySet(); service.onDestroy()