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

Commit afd90a18 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Fix ControlsProviderLifecycleManagerTest" into rvc-dev am: 20dd6a26

Change-Id: Iac3c4a16ad7d40c90a4fa46a1cce3833bdb06fe2
parents 16c872ce 20dd6a26
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -97,19 +97,25 @@ class ControlsProviderLifecycleManagerTest : SysuiTestCase() {
    @Test
    @Test
    fun testBindService() {
    fun testBindService() {
        manager.bindService()
        manager.bindService()
        executor.runAllReady()
        assertTrue(mContext.isBound(componentName))
        assertTrue(mContext.isBound(componentName))
    }
    }


    @Test
    @Test
    fun testUnbindService() {
    fun testUnbindService() {
        manager.bindService()
        manager.bindService()
        executor.runAllReady()

        manager.unbindService()
        manager.unbindService()
        executor.runAllReady()

        assertFalse(mContext.isBound(componentName))
        assertFalse(mContext.isBound(componentName))
    }
    }


    @Test
    @Test
    fun testMaybeBindAndLoad() {
    fun testMaybeBindAndLoad() {
        manager.maybeBindAndLoad(subscriberService)
        manager.maybeBindAndLoad(subscriberService)
        executor.runAllReady()


        verify(service).load(subscriberService)
        verify(service).load(subscriberService)


@@ -119,14 +125,17 @@ class ControlsProviderLifecycleManagerTest : SysuiTestCase() {
    @Test
    @Test
    fun testMaybeUnbind_bindingAndCallback() {
    fun testMaybeUnbind_bindingAndCallback() {
        manager.maybeBindAndLoad(subscriberService)
        manager.maybeBindAndLoad(subscriberService)
        executor.runAllReady()


        manager.unbindService()
        manager.unbindService()
        executor.runAllReady()
        assertFalse(mContext.isBound(componentName))
        assertFalse(mContext.isBound(componentName))
    }
    }


    @Test
    @Test
    fun testMaybeBindAndLoad_timeout() {
    fun testMaybeBindAndLoad_timeout() {
        manager.maybeBindAndLoad(subscriberService)
        manager.maybeBindAndLoad(subscriberService)
        executor.runAllReady()


        executor.advanceClockToLast()
        executor.advanceClockToLast()
        executor.runAllReady()
        executor.runAllReady()
@@ -138,6 +147,7 @@ class ControlsProviderLifecycleManagerTest : SysuiTestCase() {
    fun testMaybeBindAndSubscribe() {
    fun testMaybeBindAndSubscribe() {
        val list = listOf("TEST_ID")
        val list = listOf("TEST_ID")
        manager.maybeBindAndSubscribe(list)
        manager.maybeBindAndSubscribe(list)
        executor.runAllReady()


        assertTrue(mContext.isBound(componentName))
        assertTrue(mContext.isBound(componentName))
        verify(service).subscribe(list, subscriberService)
        verify(service).subscribe(list, subscriberService)
@@ -148,6 +158,7 @@ class ControlsProviderLifecycleManagerTest : SysuiTestCase() {
        val controlId = "TEST_ID"
        val controlId = "TEST_ID"
        val action = ControlAction.ERROR_ACTION
        val action = ControlAction.ERROR_ACTION
        manager.maybeBindAndSendAction(controlId, action)
        manager.maybeBindAndSendAction(controlId, action)
        executor.runAllReady()


        assertTrue(mContext.isBound(componentName))
        assertTrue(mContext.isBound(componentName))
        verify(service).action(eq(controlId), capture(wrapperCaptor),
        verify(service).action(eq(controlId), capture(wrapperCaptor),