test(android): isolate router application and logging fixtures

This commit is contained in:
evgeny committed 2026-10-26 20:21:58 +01:00
1 parent 3191202804
commit a60bf995bd
2 files changed
+29

No files matched your search

@@ -0,0 +1,6 @@
package com.utun.chat
import android.content.Context
/** Только host-тест; экземпляр заменяется до создания router. */
object ChatApplication { var instance = Context() }
@@ -0,0 +1,23 @@
package com.utun.chat.data
import java.util.Collections
/** Минимальная поверхность Telecom; Bluetooth lifecycle не создаёт настоящую Connection. */
class UtunConnection {
var onRouteChanged: ((AudioRoute) -> Unit)? = null
var onEndpointsChanged: (() -> Unit)? = null
var confirmedRoute: AudioRoute? = null
var headsetAvailable: Boolean? = null
fun routeTo(route: AudioRoute) {}
}
/** Собирает настоящий LogManager API router; вывод можно отключить для конкурентной серии. */
object LogManager {
data class Entry(val level: String, val category: String, val message: String)
val entries: MutableList<Entry> = Collections.synchronizedList(mutableListOf<Entry>())
var console = true
fun addLog(level: String, category: String, message: String) {
entries.add(Entry(level, category, message))
if (console || level == "ERROR") System.err.println("[$level] [$category] $message")
}
}