Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a2cf628 authored by Will Leshner's avatar Will Leshner
Browse files

Fix communal hub tests.

A recent change broke tests for devices that don't have communal_hub
enabled. This change fixes those tests.

Bug: 352632990
Test: atest CommunalSceneStartableTest
Test: FromDozingTransitionInteractorTest
Flag: EXEMPT bugfix
Change-Id: I5f37811129b5e63ceb119b340f705ef91d5a1afb
parent f1ff109a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -16,9 +16,11 @@

package com.android.systemui.communal

import android.platform.test.annotations.EnableFlags
import android.provider.Settings
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
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
@@ -60,6 +62,7 @@ import org.mockito.kotlin.whenever
@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@RunWith(AndroidJUnit4::class)
@EnableFlags(FLAG_COMMUNAL_HUB)
class CommunalSceneStartableTest : SysuiTestCase() {
    private val kosmos = testKosmos()

+12 −7
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.compose.animation.scene.ObservableTransitionState
import com.android.internal.logging.UiEventLogger
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.systemui.Flags.FLAG_COMMUNAL_HUB
import com.android.systemui.SysuiTestCase
import com.android.systemui.ambient.touch.TouchMonitor
import com.android.systemui.ambient.touch.dagger.AmbientTouchComponent
@@ -202,8 +203,12 @@ class DreamOverlayServiceTest : SysuiTestCase() {
        whenever(mScrimManager.getCurrentController()).thenReturn(mScrimController)
        whenever(mLazyViewCapture.value).thenReturn(viewCaptureSpy)
        mWindowParams = WindowManager.LayoutParams()
        mViewCaptureAwareWindowManager = ViewCaptureAwareWindowManager(mWindowManager,
                mLazyViewCapture, isViewCaptureEnabled = false)
        mViewCaptureAwareWindowManager =
            ViewCaptureAwareWindowManager(
                mWindowManager,
                mLazyViewCapture,
                isViewCaptureEnabled = false
            )
        mService =
            DreamOverlayService(
                mContext,
@@ -634,7 +639,7 @@ class DreamOverlayServiceTest : SysuiTestCase() {
    }

    @Test
    @EnableFlags(Flags.FLAG_DREAM_WAKE_REDIRECT)
    @EnableFlags(Flags.FLAG_DREAM_WAKE_REDIRECT, FLAG_COMMUNAL_HUB)
    @kotlin.Throws(RemoteException::class)
    fun testTransitionToGlanceableHub() =
        testScope.runTest {
@@ -658,7 +663,7 @@ class DreamOverlayServiceTest : SysuiTestCase() {
        }

    @Test
    @EnableFlags(Flags.FLAG_DREAM_WAKE_REDIRECT)
    @EnableFlags(Flags.FLAG_DREAM_WAKE_REDIRECT, FLAG_COMMUNAL_HUB)
    @Throws(RemoteException::class)
    fun testRedirectExit() =
        testScope.runTest {
+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ class FromDozingTransitionInteractorTest : SysuiTestCase() {
        }

    @Test
    @EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR)
    @EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR, Flags.FLAG_COMMUNAL_HUB)
    fun testTransitionToLockscreen_onPowerButtonPress_canDream_glanceableHubAvailable() =
        testScope.runTest {
            whenever(kosmos.dreamManager.canStartDreaming(anyBoolean())).thenReturn(true)