Merge "Expose the netd mock in CSTest to allow verifying calls on it" into main
This commit is contained in:
@@ -127,6 +127,7 @@ open class CSTest {
|
|||||||
val packageManager = makeMockPackageManager()
|
val packageManager = makeMockPackageManager()
|
||||||
val connResources = makeMockConnResources(sysResources, packageManager)
|
val connResources = makeMockConnResources(sysResources, packageManager)
|
||||||
|
|
||||||
|
val netd = mock<INetd>()
|
||||||
val bpfNetMaps = mock<BpfNetMaps>()
|
val bpfNetMaps = mock<BpfNetMaps>()
|
||||||
val clatCoordinator = mock<ClatCoordinator>()
|
val clatCoordinator = mock<ClatCoordinator>()
|
||||||
val proxyTracker = ProxyTracker(context, mock<Handler>(), 16 /* EVENT_PROXY_HAS_CHANGED */)
|
val proxyTracker = ProxyTracker(context, mock<Handler>(), 16 /* EVENT_PROXY_HAS_CHANGED */)
|
||||||
@@ -138,7 +139,7 @@ open class CSTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val deps = CSDeps()
|
val deps = CSDeps()
|
||||||
val service = makeConnectivityService(context, deps).also { it.systemReadyInternal() }
|
val service = makeConnectivityService(context, netd, deps).also { it.systemReadyInternal() }
|
||||||
val cm = ConnectivityManager(context, service)
|
val cm = ConnectivityManager(context, service)
|
||||||
val csHandler = Handler(csHandlerThread.looper)
|
val csHandler = Handler(csHandlerThread.looper)
|
||||||
|
|
||||||
|
|||||||
@@ -145,12 +145,13 @@ internal fun initMockedResources(res: Resources) {
|
|||||||
|
|
||||||
private val TEST_LINGER_DELAY_MS = 400
|
private val TEST_LINGER_DELAY_MS = 400
|
||||||
private val TEST_NASCENT_DELAY_MS = 300
|
private val TEST_NASCENT_DELAY_MS = 300
|
||||||
internal fun makeConnectivityService(context: Context, deps: Dependencies) = ConnectivityService(
|
internal fun makeConnectivityService(context: Context, netd: INetd, deps: Dependencies) =
|
||||||
|
ConnectivityService(
|
||||||
context,
|
context,
|
||||||
mock<IDnsResolver>(),
|
mock<IDnsResolver>(),
|
||||||
mock<IpConnectivityLog>(),
|
mock<IpConnectivityLog>(),
|
||||||
mock<INetd>(),
|
netd,
|
||||||
deps).also {
|
deps).also {
|
||||||
it.mLingerDelayMs = TEST_LINGER_DELAY_MS
|
it.mLingerDelayMs = TEST_LINGER_DELAY_MS
|
||||||
it.mNascentDelayMs = TEST_NASCENT_DELAY_MS
|
it.mNascentDelayMs = TEST_NASCENT_DELAY_MS
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user