From 434cd2b79f2679ca8b01c10723e5663d3b265fb6 Mon Sep 17 00:00:00 2001 From: Taco Date: Fri, 10 Dec 2021 15:28:09 -0500 Subject: Update AndroidX Media and ExoPlayer (#5371) --- .../playback/PlaybackServiceMediaPlayerTest.java | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'app') diff --git a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java index 32298200e..0d05c7624 100644 --- a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java @@ -2,6 +2,7 @@ package de.test.antennapod.service.playback; import android.content.Context; +import androidx.test.annotation.UiThreadTest; import androidx.test.filters.MediumTest; import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting; @@ -56,12 +57,14 @@ public class PlaybackServiceMediaPlayerTest { private volatile AssertionFailedError assertionError; @After + @UiThreadTest public void tearDown() throws Exception { PodDBAdapter.deleteDatabase(); httpServer.stop(); } @Before + @UiThreadTest public void setUp() throws Exception { assertionError = null; EspressoTestUtils.clearPreferences(); @@ -117,6 +120,7 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testInit() { final Context c = getInstrumentation().getTargetContext(); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, new DefaultPSMPCallback()); @@ -141,6 +145,7 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testPlayMediaObjectStreamNoStartNoPrepare() throws InterruptedException { final Context c = getInstrumentation().getTargetContext(); final CountDownLatch countDownLatch = new CountDownLatch(2); @@ -181,6 +186,7 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testPlayMediaObjectStreamStartNoPrepare() throws InterruptedException { final Context c = getInstrumentation().getTargetContext(); final CountDownLatch countDownLatch = new CountDownLatch(2); @@ -222,6 +228,7 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testPlayMediaObjectStreamNoStartPrepare() throws InterruptedException { final Context c = getInstrumentation().getTargetContext(); final CountDownLatch countDownLatch = new CountDownLatch(4); @@ -264,6 +271,7 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testPlayMediaObjectStreamStartPrepare() throws InterruptedException { final Context c = getInstrumentation().getTargetContext(); final CountDownLatch countDownLatch = new CountDownLatch(5); @@ -308,6 +316,7 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testPlayMediaObjectLocalNoStartNoPrepare() throws InterruptedException { final Context c = getInstrumentation().getTargetContext(); final CountDownLatch countDownLatch = new CountDownLatch(2); @@ -347,6 +356,7 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testPlayMediaObjectLocalStartNoPrepare() throws InterruptedException { final Context c = getInstrumentation().getTargetContext(); final CountDownLatch countDownLatch = new CountDownLatch(2); @@ -386,6 +396,7 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testPlayMediaObjectLocalNoStartPrepare() throws InterruptedException { final Context c = getInstrumentation().getTargetContext(); final CountDownLatch countDownLatch = new CountDownLatch(4); @@ -427,6 +438,7 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testPlayMediaObjectLocalStartPrepare() throws InterruptedException { final Context c = getInstrumentation().getTargetContext(); final CountDownLatch countDownLatch = new CountDownLatch(5); @@ -530,46 +542,55 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testPauseDefaultState() throws InterruptedException { pauseTestSkeleton(PlayerStatus.STOPPED, false, false, false, 1); } @Test + @UiThreadTest public void testPausePlayingStateNoAbandonNoReinitNoStream() throws InterruptedException { pauseTestSkeleton(PlayerStatus.PLAYING, false, false, false, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testPausePlayingStateNoAbandonNoReinitStream() throws InterruptedException { pauseTestSkeleton(PlayerStatus.PLAYING, true, false, false, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testPausePlayingStateAbandonNoReinitNoStream() throws InterruptedException { pauseTestSkeleton(PlayerStatus.PLAYING, false, true, false, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testPausePlayingStateAbandonNoReinitStream() throws InterruptedException { pauseTestSkeleton(PlayerStatus.PLAYING, true, true, false, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testPausePlayingStateNoAbandonReinitNoStream() throws InterruptedException { pauseTestSkeleton(PlayerStatus.PLAYING, false, false, true, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testPausePlayingStateNoAbandonReinitStream() throws InterruptedException { pauseTestSkeleton(PlayerStatus.PLAYING, true, false, true, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testPausePlayingStateAbandonReinitNoStream() throws InterruptedException { pauseTestSkeleton(PlayerStatus.PLAYING, false, true, true, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testPausePlayingStateAbandonReinitStream() throws InterruptedException { pauseTestSkeleton(PlayerStatus.PLAYING, true, true, true, LATCH_TIMEOUT_SECONDS); } @@ -616,16 +637,19 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testResumePausedState() throws InterruptedException { resumeTestSkeleton(PlayerStatus.PAUSED, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testResumePreparedState() throws InterruptedException { resumeTestSkeleton(PlayerStatus.PREPARED, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testResumePlayingState() throws InterruptedException { resumeTestSkeleton(PlayerStatus.PLAYING, 1); } @@ -678,21 +702,25 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testPrepareInitializedState() throws InterruptedException { prepareTestSkeleton(PlayerStatus.INITIALIZED, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testPreparePlayingState() throws InterruptedException { prepareTestSkeleton(PlayerStatus.PLAYING, 1); } @Test + @UiThreadTest public void testPreparePausedState() throws InterruptedException { prepareTestSkeleton(PlayerStatus.PAUSED, 1); } @Test + @UiThreadTest public void testPreparePreparedState() throws InterruptedException { prepareTestSkeleton(PlayerStatus.PREPARED, 1); } @@ -735,21 +763,25 @@ public class PlaybackServiceMediaPlayerTest { } @Test + @UiThreadTest public void testReinitPlayingState() throws InterruptedException { reinitTestSkeleton(PlayerStatus.PLAYING, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testReinitPausedState() throws InterruptedException { reinitTestSkeleton(PlayerStatus.PAUSED, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testPreparedPlayingState() throws InterruptedException { reinitTestSkeleton(PlayerStatus.PREPARED, LATCH_TIMEOUT_SECONDS); } @Test + @UiThreadTest public void testReinitInitializedState() throws InterruptedException { reinitTestSkeleton(PlayerStatus.INITIALIZED, LATCH_TIMEOUT_SECONDS); } -- cgit debian/1.2.3+git2.25.1-1-2-gaceb0