Skip to content

Commit 4593813

Browse files
committed
Replace usage of DirectDispatcher with EmptyCoroutineContext in testutils-paging
1 parent 6527d56 commit 4593813

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

paging/paging-common/src/test/kotlin/androidx/paging/PagingDataDifferTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2054,7 +2054,7 @@ class PagingDataDifferTest(
20542054
pagingSourceFactory = {
20552055
TestPagingSource(
20562056
loadDelay = 0,
2057-
loadDispatcher = loadDispatcher,
2057+
loadContext = loadDispatcher,
20582058
).also { pagingSources.add(it) }
20592059
}
20602060
),

testutils/testutils-paging/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ plugins {
2525
dependencies {
2626
api(libs.kotlinStdlib)
2727
implementation(project(":paging:paging-common"))
28-
implementation(project(":internal-testutils-ktx"))
2928
implementation(libs.kotlinTest)
3029
}
3130

testutils/testutils-paging/src/main/java/androidx/paging/TestPagingSource.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package androidx.paging
1818

19-
import androidx.testutils.DirectDispatcher
20-
import kotlinx.coroutines.CoroutineDispatcher
19+
import kotlin.coroutines.CoroutineContext
20+
import kotlin.coroutines.EmptyCoroutineContext
2121
import kotlinx.coroutines.delay
2222
import kotlinx.coroutines.withContext
2323

@@ -33,7 +33,7 @@ class TestPagingSource(
3333
override val jumpingSupported: Boolean = true,
3434
val items: List<Int> = ITEMS,
3535
private val loadDelay: Long = 1000,
36-
private val loadDispatcher: CoroutineDispatcher = DirectDispatcher,
36+
private val loadContext: CoroutineContext = EmptyCoroutineContext,
3737
private val placeholdersEnabled: Boolean = true,
3838
) : PagingSource<Int, Int>() {
3939
var errorNextLoad = false
@@ -60,7 +60,7 @@ class TestPagingSource(
6060
// execution of events.
6161
delay(loadDelay)
6262

63-
return withContext(loadDispatcher) { getLoadResult(params) }
63+
return withContext(loadContext) { getLoadResult(params) }
6464
}
6565

6666
private fun getLoadResult(params: LoadParams<Int>): LoadResult<Int, Int> {

0 commit comments

Comments
 (0)