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

Commit b2a3d85f authored by Chaohui Wang's avatar Chaohui Wang Committed by Android (Google) Code Review
Browse files

Merge "Use runTest for AppListRepositoryTest"

parents bb563d8c 58d0e1eb
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -41,9 +41,6 @@ java_defaults {
        "SpaPrivilegedLib",
    ],
    kotlincflags: ["-Xjvm-default=all"],
    javacflags: [
        "-J-Xmx4G",
    ],
}

// Expose the srcs to tests, so the tests can access the internal classes.
+1 −3
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ android_test {
    certificate: "platform",
    platform_apis: true,
    test_suites: ["device-tests"],
    defaults: ["SpaPrivilegedLib-defaults"],

    srcs: [
        ":SpaPrivilegedLib_srcs",
@@ -30,8 +31,6 @@ android_test {
    ],

    static_libs: [
        "SpaPrivilegedLib",
        "androidx.compose.runtime_runtime",
        "androidx.compose.ui_ui-test-junit4",
        "androidx.compose.ui_ui-test-manifest",
        "androidx.test.ext.junit",
@@ -40,7 +39,6 @@ android_test {
        "truth-prebuilt",
    ],
    kotlincflags: [
        "-Xjvm-default=all",
        "-opt-in=kotlin.RequiresOptIn",
    ],
}
+5 −3
Original line number Diff line number Diff line
@@ -23,10 +23,11 @@ import android.content.pm.PackageManager.ApplicationInfoFlags
import android.content.pm.PackageManager.ResolveInfoFlags
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@@ -41,6 +42,7 @@ import org.mockito.junit.MockitoRule

private const val USER_ID = 0

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(AndroidJUnit4::class)
class AppListRepositoryTest {

@@ -82,7 +84,7 @@ class AppListRepositoryTest {
    }

    @Test
    fun notShowInstantApps(): Unit = runBlocking {
    fun notShowInstantApps() = runTest {
        val appListConfig = AppListConfig(userId = USER_ID, showInstantApps = false)

        val appListFlow = repository.loadApps(flowOf(appListConfig))
@@ -97,7 +99,7 @@ class AppListRepositoryTest {
    }

    @Test
    fun showInstantApps(): Unit = runBlocking {
    fun showInstantApps() = runTest {
        val appListConfig = AppListConfig(userId = USER_ID, showInstantApps = true)

        val appListFlow = repository.loadApps(flowOf(appListConfig))