diff options
| author | 2025-02-24 09:09:07 -0500 | |
|---|---|---|
| committer | 2025-02-24 06:12:44 -0800 | |
| commit | 2a1a53b2f06363d9069291b96bcd19487de0fa30 (patch) | |
| tree | bfaaeada4bd59c91bc894b10800445c4065ee33c | |
| parent | fb7a2f4e2042598778c94de3aa21044a0e839bdb (diff) | |
Reset fake mobile connection repos between tests
These would hold state between tests and break depending on ordering
Flag: TEST_ONLY
Fixes: 397979839
Test: MobileIconsInteractorTest.kt
Change-Id: If12d677256e2f222d5837e1838d36d8bb9e7daac
| -rw-r--r-- | packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt index 6066a3870dfe..9e914ad0a660 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt @@ -65,10 +65,10 @@ class MobileIconsInteractorTest : SysuiTestCase() { mobileConnectionsRepository.fake.run { setMobileConnectionRepositoryMap( mapOf( - SUB_1_ID to CONNECTION_1, - SUB_2_ID to CONNECTION_2, - SUB_3_ID to CONNECTION_3, - SUB_4_ID to CONNECTION_4, + SUB_1_ID to FakeMobileConnectionRepository(SUB_1_ID, mock()), + SUB_2_ID to FakeMobileConnectionRepository(SUB_2_ID, mock()), + SUB_3_ID to FakeMobileConnectionRepository(SUB_3_ID, mock()), + SUB_4_ID to FakeMobileConnectionRepository(SUB_4_ID, mock()), ) ) setActiveMobileDataSubscriptionId(SUB_1_ID) @@ -496,7 +496,10 @@ class MobileIconsInteractorTest : SysuiTestCase() { @Test fun activeDataConnection_turnedOn() = kosmos.runTest { - CONNECTION_1.setDataEnabled(true) + (fakeMobileConnectionsRepository.getRepoForSubId(SUB_1_ID) + as FakeMobileConnectionRepository) + .dataEnabled + .value = true val latest by collectLastValue(underTest.activeDataConnectionHasDataEnabled) @@ -506,10 +509,17 @@ class MobileIconsInteractorTest : SysuiTestCase() { @Test fun activeDataConnection_turnedOff() = kosmos.runTest { - CONNECTION_1.setDataEnabled(true) + (fakeMobileConnectionsRepository.getRepoForSubId(SUB_1_ID) + as FakeMobileConnectionRepository) + .dataEnabled + .value = true + val latest by collectLastValue(underTest.activeDataConnectionHasDataEnabled) - CONNECTION_1.setDataEnabled(false) + (fakeMobileConnectionsRepository.getRepoForSubId(SUB_1_ID) + as FakeMobileConnectionRepository) + .dataEnabled + .value = false assertThat(latest).isFalse() } @@ -921,20 +931,18 @@ class MobileIconsInteractorTest : SysuiTestCase() { @EnableFlags(NewStatusBarIcons.FLAG_NAME, StatusBarRootModernization.FLAG_NAME) fun isStackable_checksForTerrestrialConnections() = kosmos.runTest { - val exclusivelyNonTerrestrialSub = - SubscriptionModel( - isExclusivelyNonTerrestrial = true, - subscriptionId = 5, - carrierName = "Carrier 5", - profileClass = PROFILE_CLASS_UNSET, - ) - val latest by collectLastValue(underTest.isStackable) connectionsRepository.setSubscriptions(listOf(SUB_1, SUB_2)) + setNumberOfLevelsForSubId(SUB_1_ID, 5) + setNumberOfLevelsForSubId(SUB_2_ID, 5) assertThat(latest).isTrue() - connectionsRepository.setSubscriptions(listOf(SUB_1, exclusivelyNonTerrestrialSub)) + (fakeMobileConnectionsRepository.getRepoForSubId(SUB_1_ID) + as FakeMobileConnectionRepository) + .isNonTerrestrial + .value = true + assertThat(latest).isFalse() } @@ -1006,7 +1014,6 @@ class MobileIconsInteractorTest : SysuiTestCase() { carrierName = "Carrier $SUB_1_ID", profileClass = PROFILE_CLASS_UNSET, ) - private val CONNECTION_1 = FakeMobileConnectionRepository(SUB_1_ID, mock()) private const val SUB_2_ID = 2 private val SUB_2 = @@ -1015,7 +1022,6 @@ class MobileIconsInteractorTest : SysuiTestCase() { carrierName = "Carrier $SUB_2_ID", profileClass = PROFILE_CLASS_UNSET, ) - private val CONNECTION_2 = FakeMobileConnectionRepository(SUB_2_ID, mock()) private const val SUB_3_ID = 3 private val SUB_3_OPP = @@ -1026,7 +1032,6 @@ class MobileIconsInteractorTest : SysuiTestCase() { carrierName = "Carrier $SUB_3_ID", profileClass = PROFILE_CLASS_UNSET, ) - private val CONNECTION_3 = FakeMobileConnectionRepository(SUB_3_ID, mock()) private const val SUB_4_ID = 4 private val SUB_4_OPP = @@ -1037,6 +1042,5 @@ class MobileIconsInteractorTest : SysuiTestCase() { carrierName = "Carrier $SUB_4_ID", profileClass = PROFILE_CLASS_UNSET, ) - private val CONNECTION_4 = FakeMobileConnectionRepository(SUB_4_ID, mock()) } } |