Skip to content

Commit 3ec802b

Browse files
committed
Remove unncessary delay in test
1 parent 0a25c79 commit 3ec802b

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
2525
import kotlinx.coroutines.Job
2626
import kotlinx.coroutines.SupervisorJob
2727
import kotlinx.coroutines.cancelAndJoin
28-
import kotlinx.coroutines.delay
2928
import kotlinx.coroutines.flow.Flow
3029
import kotlinx.coroutines.flow.catch
3130
import kotlinx.coroutines.flow.filterIsInstance
@@ -221,10 +220,7 @@ class CachingTest {
221220
assertThat(tracker.pageEventFlowCount()).isEqualTo(0)
222221
assertThat(tracker.pageDataFlowCount()).isEqualTo(0)
223222
val items = runBlocking {
224-
pageFlow.collectItemsUntilSize(9) {
225-
// see http://b/146676984
226-
delay(10)
227-
}
223+
pageFlow.collectItemsUntilSize(9)
228224
}
229225
val firstList = buildItems(
230226
version = 0,
@@ -234,10 +230,7 @@ class CachingTest {
234230
)
235231
assertThat(tracker.pageDataFlowCount()).isEqualTo(1)
236232
val items2 = runBlocking {
237-
pageFlow.collectItemsUntilSize(21) {
238-
// see http://b/146676984
239-
delay(10)
240-
}
233+
pageFlow.collectItemsUntilSize(21)
241234
}
242235
assertThat(items2).isEqualTo(
243236
buildItems(
@@ -401,7 +394,6 @@ class CachingTest {
401394

402395
private suspend fun Flow<PagingData<Item>>.collectItemsUntilSize(
403396
expectedSize: Int,
404-
onEach: (suspend () -> Unit)? = null
405397
): List<Item> {
406398
return this
407399
.mapLatest { pagingData ->
@@ -411,9 +403,6 @@ class CachingTest {
411403
val receiver = pagingData.hintReceiver
412404
var loadedPageCount = 0
413405
pagingData.flow.filterIsInstance<PageEvent.Insert<Item>>()
414-
.onEach {
415-
onEach?.invoke()
416-
}
417406
.onEach {
418407
items.addAll(
419408
it.pages.flatMap {

0 commit comments

Comments
 (0)