From 4aec9a87ec774aa0014e6f6cf6e5d9814db0dcf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaquim=20St=C3=A4hli?= Date: Fri, 25 Aug 2023 09:46:01 +0200 Subject: [PATCH] Add timeout to every test cases --- .../core/business/CommandersActTrackerTest.kt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pillarbox-core-business/src/androidTest/java/ch/srgssr/pillarbox/core/business/CommandersActTrackerTest.kt b/pillarbox-core-business/src/androidTest/java/ch/srgssr/pillarbox/core/business/CommandersActTrackerTest.kt index 298215fb8..b2b7cf6af 100644 --- a/pillarbox-core-business/src/androidTest/java/ch/srgssr/pillarbox/core/business/CommandersActTrackerTest.kt +++ b/pillarbox-core-business/src/androidTest/java/ch/srgssr/pillarbox/core/business/CommandersActTrackerTest.kt @@ -18,7 +18,6 @@ import ch.srgssr.pillarbox.player.PillarboxPlayer import ch.srgssr.pillarbox.player.test.utils.TestPlayer import ch.srgssr.pillarbox.player.tracker.MediaItemTrackerRepository import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.coroutines.test.runTest @@ -29,7 +28,6 @@ import kotlin.math.abs import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -@OptIn(ExperimentalCoroutinesApi::class) class CommandersActTrackerTest { private lateinit var commandersActDelegate: CommandersActDelegate @@ -61,7 +59,7 @@ class CommandersActTrackerTest { } @Test - fun testStartEoF() = runTest { + fun testStartEoF() = runTest(timeout = TEST_TIMEOUT) { val expected = listOf( MediaEventType.Play.toString(), MediaEventType.Eof.toString() @@ -77,7 +75,7 @@ class CommandersActTrackerTest { } @Test - fun testPlayStop() = runTest { + fun testPlayStop() = runTest(timeout = TEST_TIMEOUT) { val expected = listOf( MediaEventType.Play.toString(), MediaEventType.Stop.toString() @@ -90,7 +88,7 @@ class CommandersActTrackerTest { } @Test - fun testPlaySeekPlay() = runTest { + fun testPlaySeekPlay() = runTest(timeout = TEST_TIMEOUT) { val seekPositionMs = 2_000L val expectedEvents = listOf( CommandersActDelegate.Event(MediaEventType.Play.toString(), 0L), @@ -111,7 +109,7 @@ class CommandersActTrackerTest { * Seek event is not send but play event position should be the seek position. */ @Test - fun testPausePlaySeekPlay() = runTest { + fun testPausePlaySeekPlay() = runTest(timeout = TEST_TIMEOUT) { val seekPositionMs = 2_000L val expected = listOf( CommandersActDelegate.Event(MediaEventType.Play.toString(), seekPositionMs.milliseconds.inWholeSeconds), @@ -127,7 +125,7 @@ class CommandersActTrackerTest { } @Test - fun testPlayPauseSeekPause() = runTest { + fun testPlayPauseSeekPause() = runTest(timeout = TEST_TIMEOUT) { val seekPositionMs = 4_000L val expected = listOf( MediaEventType.Play.toString(), @@ -186,7 +184,7 @@ class CommandersActTrackerTest { @FlakyTest(detail = "POS and UPTIME not always send due to timers") @Test - fun testUpTimeLiveWithDvr() = runTest { + fun testUpTimeLiveWithDvr() = runTest(timeout = TEST_TIMEOUT) { val expected = listOf( MediaEventType.Uptime.toString(), MediaEventType.Uptime.toString(), @@ -221,7 +219,7 @@ class CommandersActTrackerTest { } @Test - fun testPauseSeekPause() = runTest { + fun testPauseSeekPause() = runTest(timeout = TEST_TIMEOUT) { val seekPositionMs = 4_000L launch(Dispatchers.Main) { val player = createPlayerWithUrn(LocalMediaCompositionDataSource.Vod, false)