Fix the "Use this SIM" switch does not disable during phone calls am: 4f454b43c6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/27105181 Change-Id: I2be1b144aa7d1d120692ccfece3c921e488fc308 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -120,7 +120,7 @@ class SatelliteRepositoryTest {
|
||||
@Test
|
||||
fun requestIsSessionStarted_registerFailed() = runBlocking {
|
||||
`when`(mockSatelliteManager.registerForModemStateChanged(any(), any())
|
||||
).thenAnswer { invocation ->
|
||||
).thenAnswer {
|
||||
SatelliteManager.SATELLITE_RESULT_ERROR
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ class SatelliteRepositoryTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getIsModemEnabledFlow_isSatelliteEnabledState() = runBlocking {
|
||||
fun getIsSessionStartedFlow_isSatelliteEnabledState() = runBlocking {
|
||||
`when`(
|
||||
mockSatelliteManager.registerForModemStateChanged(
|
||||
any(),
|
||||
@@ -199,13 +199,13 @@ class SatelliteRepositoryTest {
|
||||
SatelliteManager.SATELLITE_RESULT_SUCCESS
|
||||
}
|
||||
|
||||
val flow = repository.getIsModemEnabledFlow()
|
||||
val flow = repository.getIsSessionStartedFlow()
|
||||
|
||||
assertThat(flow.first()).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getIsModemEnabledFlow_isSatelliteDisabledState() = runBlocking {
|
||||
fun getIsSessionStartedFlow_isSatelliteDisabledState() = runBlocking {
|
||||
`when`(
|
||||
mockSatelliteManager.registerForModemStateChanged(
|
||||
any(),
|
||||
@@ -217,16 +217,28 @@ class SatelliteRepositoryTest {
|
||||
SatelliteManager.SATELLITE_RESULT_SUCCESS
|
||||
}
|
||||
|
||||
val flow = repository.getIsModemEnabledFlow()
|
||||
val flow = repository.getIsSessionStartedFlow()
|
||||
|
||||
assertThat(flow.first()).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getIsModemEnabledFlow_nullSatelliteManager() = runBlocking {
|
||||
fun getIsSessionStartedFlow_nullSatelliteManager() = runBlocking {
|
||||
`when`(spyContext.getSystemService(SatelliteManager::class.java)).thenReturn(null)
|
||||
|
||||
val flow = repository.getIsModemEnabledFlow()
|
||||
val flow = repository.getIsSessionStartedFlow()
|
||||
assertThat(flow.first()).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getIsSessionStartedFlow_registerFailed() = runBlocking {
|
||||
`when`(mockSatelliteManager.registerForModemStateChanged(any(), any())
|
||||
).thenAnswer {
|
||||
SatelliteManager.SATELLITE_RESULT_ERROR
|
||||
}
|
||||
|
||||
val flow = repository.getIsSessionStartedFlow()
|
||||
|
||||
assertThat(flow.first()).isFalse()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user