From 3ec802b2997f01c8b1b23ca110ff8b4e45f74c15 Mon Sep 17 00:00:00 2001 From: Veyndan Stuart Date: Wed, 19 Apr 2023 22:15:00 +0200 Subject: [PATCH] Remove unncessary delay in test --- .../test/kotlin/androidx/paging/CachingTest.kt | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/paging/paging-common/src/test/kotlin/androidx/paging/CachingTest.kt b/paging/paging-common/src/test/kotlin/androidx/paging/CachingTest.kt index 151431c373843..6b41869738ef6 100644 --- a/paging/paging-common/src/test/kotlin/androidx/paging/CachingTest.kt +++ b/paging/paging-common/src/test/kotlin/androidx/paging/CachingTest.kt @@ -25,7 +25,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.cancelAndJoin -import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.filterIsInstance @@ -221,10 +220,7 @@ class CachingTest { assertThat(tracker.pageEventFlowCount()).isEqualTo(0) assertThat(tracker.pageDataFlowCount()).isEqualTo(0) val items = runBlocking { - pageFlow.collectItemsUntilSize(9) { - // see http://b/146676984 - delay(10) - } + pageFlow.collectItemsUntilSize(9) } val firstList = buildItems( version = 0, @@ -234,10 +230,7 @@ class CachingTest { ) assertThat(tracker.pageDataFlowCount()).isEqualTo(1) val items2 = runBlocking { - pageFlow.collectItemsUntilSize(21) { - // see http://b/146676984 - delay(10) - } + pageFlow.collectItemsUntilSize(21) } assertThat(items2).isEqualTo( buildItems( @@ -401,7 +394,6 @@ class CachingTest { private suspend fun Flow>.collectItemsUntilSize( expectedSize: Int, - onEach: (suspend () -> Unit)? = null ): List { return this .mapLatest { pagingData -> @@ -411,9 +403,6 @@ class CachingTest { val receiver = pagingData.hintReceiver var loadedPageCount = 0 pagingData.flow.filterIsInstance>() - .onEach { - onEach?.invoke() - } .onEach { items.addAll( it.pages.flatMap {