Loading packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/ShadeTouchHandlerTest.kt +11 −0 Original line number Diff line number Diff line Loading @@ -25,9 +25,13 @@ import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.ambient.touch.TouchHandler.TouchSession import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.shade.ShadeViewController import com.android.systemui.shared.system.InputChannelCompat import com.android.systemui.statusbar.phone.CentralSurfaces import com.android.systemui.testKosmos import com.google.common.truth.Truth import java.util.Optional import org.junit.Before Loading @@ -45,6 +49,8 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) class ShadeTouchHandlerTest : SysuiTestCase() { private var kosmos = testKosmos() private var mCentralSurfaces = mock<CentralSurfaces>() private var mShadeViewController = mock<ShadeViewController>() private var mDreamManager = mock<DreamManager>() Loading @@ -62,6 +68,7 @@ class ShadeTouchHandlerTest : SysuiTestCase() { Optional.of(mCentralSurfaces), mShadeViewController, mDreamManager, kosmos.communalSettingsInteractor, TOUCH_HEIGHT ) } Loading @@ -86,6 +93,8 @@ class ShadeTouchHandlerTest : SysuiTestCase() { @Test @EnableFlags(Flags.FLAG_COMMUNAL_HUB) fun testSwipeDown_communalEnabled_sentToCentralSurfaces() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) swipe(Direction.DOWN) // Both motion events are sent for central surfaces to process. Loading Loading @@ -117,6 +126,8 @@ class ShadeTouchHandlerTest : SysuiTestCase() { @Test @EnableFlags(Flags.FLAG_COMMUNAL_HUB) fun testSwipeUp_communalEnabled_touchesNotSent() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) swipe(Direction.UP) // Motion events are not sent for central surfaces to process as the swipe is going in the Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalDreamStartableTest.kt +6 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.data.repository.keyguardRepository Loading Loading @@ -61,9 +64,12 @@ class CommunalDreamStartableTest : SysuiTestCase() { @Before fun setUp() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) underTest = CommunalDreamStartable( powerInteractor = kosmos.powerInteractor, communalSettingsInteractor = kosmos.communalSettingsInteractor, keyguardInteractor = kosmos.keyguardInteractor, keyguardTransitionInteractor = kosmos.keyguardTransitionInteractor, dreamManager = dreamManager, Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalOngoingContentStartableTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.communal.data.repository.fakeCommunalMediaRepository import com.android.systemui.communal.data.repository.fakeCommunalSmartspaceRepository import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.communal.domain.interactor.setCommunalEnabled import com.android.systemui.flags.Flags import com.android.systemui.flags.fakeFeatureFlagsClassic Loading @@ -48,20 +49,19 @@ class CommunalOngoingContentStartableTest : SysuiTestCase() { private val mediaRepository = kosmos.fakeCommunalMediaRepository private val smartspaceRepository = kosmos.fakeCommunalSmartspaceRepository private val featureFlags = kosmos.fakeFeatureFlagsClassic.apply { set(Flags.COMMUNAL_SERVICE_ENABLED, true) } private lateinit var underTest: CommunalOngoingContentStartable @Before fun setUp() { kosmos.fakeFeatureFlagsClassic.set(Flags.COMMUNAL_SERVICE_ENABLED, true) underTest = CommunalOngoingContentStartable( bgScope = kosmos.applicationCoroutineScope, communalInteractor = kosmos.communalInteractor, communalMediaRepository = mediaRepository, communalSettingsInteractor = kosmos.communalSettingsInteractor, communalSmartspaceRepository = smartspaceRepository, featureFlags = featureFlags, ) } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.systemui.Flags.FLAG_COMMUNAL_HUB import com.android.systemui.SysuiTestCase import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.communal.domain.interactor.setCommunalAvailable import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.coroutines.collectLastValue Loading Loading @@ -78,6 +79,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { CommunalSceneStartable( dockManager = dockManager, communalInteractor = communalInteractor, communalSettingsInteractor = communalSettingsInteractor, communalSceneInteractor = communalSceneInteractor, keyguardTransitionInteractor = keyguardTransitionInteractor, keyguardInteractor = keyguardInteractor, Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSettingsRepositoryImplTest.kt +32 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,38 @@ class CommunalSettingsRepositoryImplTest : SysuiTestCase() { underTest = kosmos.communalSettingsRepository } @EnableFlags(FLAG_COMMUNAL_HUB) @Test fun getFlagEnabled_bothEnabled() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) assertThat(underTest.getFlagEnabled()).isTrue() } @DisableFlags(FLAG_COMMUNAL_HUB) @Test fun getFlagEnabled_bothDisabled() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, false) assertThat(underTest.getFlagEnabled()).isFalse() } @DisableFlags(FLAG_COMMUNAL_HUB) @Test fun getFlagEnabled_onlyClassicFlagEnabled() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) assertThat(underTest.getFlagEnabled()).isFalse() } @EnableFlags(FLAG_COMMUNAL_HUB) @Test fun getFlagEnabled_onlyTrunkFlagEnabled() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, false) assertThat(underTest.getFlagEnabled()).isFalse() } @EnableFlags(FLAG_COMMUNAL_HUB) @Test fun secondaryUserIsInvalid() = Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/ShadeTouchHandlerTest.kt +11 −0 Original line number Diff line number Diff line Loading @@ -25,9 +25,13 @@ import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.ambient.touch.TouchHandler.TouchSession import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.shade.ShadeViewController import com.android.systemui.shared.system.InputChannelCompat import com.android.systemui.statusbar.phone.CentralSurfaces import com.android.systemui.testKosmos import com.google.common.truth.Truth import java.util.Optional import org.junit.Before Loading @@ -45,6 +49,8 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) class ShadeTouchHandlerTest : SysuiTestCase() { private var kosmos = testKosmos() private var mCentralSurfaces = mock<CentralSurfaces>() private var mShadeViewController = mock<ShadeViewController>() private var mDreamManager = mock<DreamManager>() Loading @@ -62,6 +68,7 @@ class ShadeTouchHandlerTest : SysuiTestCase() { Optional.of(mCentralSurfaces), mShadeViewController, mDreamManager, kosmos.communalSettingsInteractor, TOUCH_HEIGHT ) } Loading @@ -86,6 +93,8 @@ class ShadeTouchHandlerTest : SysuiTestCase() { @Test @EnableFlags(Flags.FLAG_COMMUNAL_HUB) fun testSwipeDown_communalEnabled_sentToCentralSurfaces() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) swipe(Direction.DOWN) // Both motion events are sent for central surfaces to process. Loading Loading @@ -117,6 +126,8 @@ class ShadeTouchHandlerTest : SysuiTestCase() { @Test @EnableFlags(Flags.FLAG_COMMUNAL_HUB) fun testSwipeUp_communalEnabled_touchesNotSent() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) swipe(Direction.UP) // Motion events are not sent for central surfaces to process as the swipe is going in the Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalDreamStartableTest.kt +6 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.data.repository.keyguardRepository Loading Loading @@ -61,9 +64,12 @@ class CommunalDreamStartableTest : SysuiTestCase() { @Before fun setUp() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) underTest = CommunalDreamStartable( powerInteractor = kosmos.powerInteractor, communalSettingsInteractor = kosmos.communalSettingsInteractor, keyguardInteractor = kosmos.keyguardInteractor, keyguardTransitionInteractor = kosmos.keyguardTransitionInteractor, dreamManager = dreamManager, Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalOngoingContentStartableTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.communal.data.repository.fakeCommunalMediaRepository import com.android.systemui.communal.data.repository.fakeCommunalSmartspaceRepository import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.communal.domain.interactor.setCommunalEnabled import com.android.systemui.flags.Flags import com.android.systemui.flags.fakeFeatureFlagsClassic Loading @@ -48,20 +49,19 @@ class CommunalOngoingContentStartableTest : SysuiTestCase() { private val mediaRepository = kosmos.fakeCommunalMediaRepository private val smartspaceRepository = kosmos.fakeCommunalSmartspaceRepository private val featureFlags = kosmos.fakeFeatureFlagsClassic.apply { set(Flags.COMMUNAL_SERVICE_ENABLED, true) } private lateinit var underTest: CommunalOngoingContentStartable @Before fun setUp() { kosmos.fakeFeatureFlagsClassic.set(Flags.COMMUNAL_SERVICE_ENABLED, true) underTest = CommunalOngoingContentStartable( bgScope = kosmos.applicationCoroutineScope, communalInteractor = kosmos.communalInteractor, communalMediaRepository = mediaRepository, communalSettingsInteractor = kosmos.communalSettingsInteractor, communalSmartspaceRepository = smartspaceRepository, featureFlags = featureFlags, ) } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.systemui.Flags.FLAG_COMMUNAL_HUB import com.android.systemui.SysuiTestCase import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.communal.domain.interactor.setCommunalAvailable import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.coroutines.collectLastValue Loading Loading @@ -78,6 +79,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { CommunalSceneStartable( dockManager = dockManager, communalInteractor = communalInteractor, communalSettingsInteractor = communalSettingsInteractor, communalSceneInteractor = communalSceneInteractor, keyguardTransitionInteractor = keyguardTransitionInteractor, keyguardInteractor = keyguardInteractor, Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSettingsRepositoryImplTest.kt +32 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,38 @@ class CommunalSettingsRepositoryImplTest : SysuiTestCase() { underTest = kosmos.communalSettingsRepository } @EnableFlags(FLAG_COMMUNAL_HUB) @Test fun getFlagEnabled_bothEnabled() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) assertThat(underTest.getFlagEnabled()).isTrue() } @DisableFlags(FLAG_COMMUNAL_HUB) @Test fun getFlagEnabled_bothDisabled() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, false) assertThat(underTest.getFlagEnabled()).isFalse() } @DisableFlags(FLAG_COMMUNAL_HUB) @Test fun getFlagEnabled_onlyClassicFlagEnabled() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) assertThat(underTest.getFlagEnabled()).isFalse() } @EnableFlags(FLAG_COMMUNAL_HUB) @Test fun getFlagEnabled_onlyTrunkFlagEnabled() { kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, false) assertThat(underTest.getFlagEnabled()).isFalse() } @EnableFlags(FLAG_COMMUNAL_HUB) @Test fun secondaryUserIsInvalid() = Loading