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

Commit 8725cf54 authored by Steve Elliott's avatar Steve Elliott Committed by Colin Cross
Browse files

Update usage of deprecated coroutines methods

This change is necessary to unblock the upgrade of the
kotlinx.coroutines library.

Bug: 239834928
Test: manual -- all existing tests and builds should pass
Change-Id: I5a15d0c2c0ccf4c4fc3e8281a1f45add188275bd
Merged-In: I5a15d0c2c0ccf4c4fc3e8281a1f45add188275bd
(cherry picked from commit 4dca36f8)
parent 13cf655c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import java.util.concurrent.Executor
import junit.framework.Assert.assertSame
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Before
import org.junit.Test
+20 −2
Original line number Diff line number Diff line
@@ -47,7 +47,11 @@ import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.TestCoroutineScheduler
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -59,6 +63,7 @@ import org.mockito.Mockito.`when` as whenever
@RunWithLooper
class FooterActionsViewModelTest : SysuiTestCase() {
    private lateinit var utils: FooterActionsTestUtils
    private val testDispatcher = UnconfinedTestDispatcher(TestCoroutineScheduler())

    @Before
    fun setUp() {
@@ -130,6 +135,7 @@ class FooterActionsViewModelTest : SysuiTestCase() {
                showPowerButton = false,
                footerActionsInteractor =
                    utils.footerActionsInteractor(
                        bgDispatcher = testDispatcher,
                        userSwitcherRepository =
                            utils.userSwitcherRepository(
                                userTracker = userTracker,
@@ -137,6 +143,7 @@ class FooterActionsViewModelTest : SysuiTestCase() {
                                userManager = userManager,
                                userInfoController = userInfoController,
                                userSwitcherController = userSwitcherControllerWrapper.controller,
                                bgDispatcher = testDispatcher,
                            ),
                    )
            )
@@ -227,9 +234,11 @@ class FooterActionsViewModelTest : SysuiTestCase() {
                footerActionsInteractor =
                    utils.footerActionsInteractor(
                        qsSecurityFooterUtils = qsSecurityFooterUtils,
                        bgDispatcher = testDispatcher,
                        securityRepository =
                            utils.securityRepository(
                                securityController = securityController,
                                bgDispatcher = testDispatcher,
                            ),
                    ),
            )
@@ -298,9 +307,14 @@ class FooterActionsViewModelTest : SysuiTestCase() {
                footerActionsInteractor =
                    utils.footerActionsInteractor(
                        qsSecurityFooterUtils = qsSecurityFooterUtils,
                        securityRepository = utils.securityRepository(securityController),
                        securityRepository =
                            utils.securityRepository(
                                securityController,
                                bgDispatcher = testDispatcher,
                            ),
                        foregroundServicesRepository =
                            utils.foregroundServicesRepository(fgsManagerController),
                        bgDispatcher = testDispatcher,
                    ),
            )

@@ -386,6 +400,7 @@ class FooterActionsViewModelTest : SysuiTestCase() {
                    utils.footerActionsInteractor(
                        qsSecurityFooterUtils = qsSecurityFooterUtils,
                        broadcastDispatcher = broadcastDispatcher,
                        bgDispatcher = testDispatcher,
                    ),
            )

@@ -410,4 +425,7 @@ class FooterActionsViewModelTest : SysuiTestCase() {
        underTest.onVisibilityChangeRequested(visible = true)
        assertThat(underTest.isVisible.value).isTrue()
    }

    private fun runBlockingTest(block: suspend TestScope.() -> Unit) =
        runTest(testDispatcher) { block() }
}