diff options
Diffstat (limited to 'app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java')
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java | 28 |
1 files changed, 14 insertions, 14 deletions
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 3511fd0b1..00fc68598 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 @@ -45,13 +45,12 @@ import static org.junit.Assert.fail; */ @MediumTest public class PlaybackServiceMediaPlayerTest { - private static final String PLAYABLE_FILE_URL = "http://127.0.0.1:" + HTTPBin.PORT + "/files/0"; private static final String PLAYABLE_DEST_URL = "psmptestfile.mp3"; private String PLAYABLE_LOCAL_URL = null; private static final int LATCH_TIMEOUT_SECONDS = 3; private HTTPBin httpServer; - + private String playableFileUrl; private volatile AssertionFailedError assertionError; @After @@ -71,6 +70,7 @@ public class PlaybackServiceMediaPlayerTest { httpServer = new HTTPBin(); httpServer.start(); + playableFileUrl = httpServer.getBaseUrl() + "/files/0"; File cacheDir = context.getExternalFilesDir("testFiles"); if (cacheDir == null) @@ -167,7 +167,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, null); + Playable p = writeTestPlayable(playableFileUrl, null); psmp.playMediaObject(p, true, false, false); boolean res = countDownLatch.await(LATCH_TIMEOUT_SECONDS, TimeUnit.SECONDS); if (assertionError != null) @@ -207,7 +207,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, null); + Playable p = writeTestPlayable(playableFileUrl, null); psmp.playMediaObject(p, true, true, false); boolean res = countDownLatch.await(LATCH_TIMEOUT_SECONDS, TimeUnit.SECONDS); @@ -251,7 +251,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, null); + Playable p = writeTestPlayable(playableFileUrl, null); psmp.playMediaObject(p, true, false, true); boolean res = countDownLatch.await(LATCH_TIMEOUT_SECONDS, TimeUnit.SECONDS); if (assertionError != null) @@ -296,7 +296,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, null); + Playable p = writeTestPlayable(playableFileUrl, null); psmp.playMediaObject(p, true, true, true); boolean res = countDownLatch.await(LATCH_TIMEOUT_SECONDS, TimeUnit.SECONDS); if (assertionError != null) @@ -334,7 +334,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, PLAYABLE_LOCAL_URL); + Playable p = writeTestPlayable(playableFileUrl, PLAYABLE_LOCAL_URL); psmp.playMediaObject(p, false, false, false); boolean res = countDownLatch.await(LATCH_TIMEOUT_SECONDS, TimeUnit.SECONDS); if (assertionError != null) @@ -373,7 +373,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, PLAYABLE_LOCAL_URL); + Playable p = writeTestPlayable(playableFileUrl, PLAYABLE_LOCAL_URL); psmp.playMediaObject(p, false, true, false); boolean res = countDownLatch.await(LATCH_TIMEOUT_SECONDS, TimeUnit.SECONDS); if (assertionError != null) @@ -415,7 +415,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, PLAYABLE_LOCAL_URL); + Playable p = writeTestPlayable(playableFileUrl, PLAYABLE_LOCAL_URL); psmp.playMediaObject(p, false, false, true); boolean res = countDownLatch.await(LATCH_TIMEOUT_SECONDS, TimeUnit.SECONDS); if (assertionError != null) @@ -460,7 +460,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, PLAYABLE_LOCAL_URL); + Playable p = writeTestPlayable(playableFileUrl, PLAYABLE_LOCAL_URL); psmp.playMediaObject(p, false, true, true); boolean res = countDownLatch.await(LATCH_TIMEOUT_SECONDS, TimeUnit.SECONDS); if (assertionError != null) @@ -523,7 +523,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, PLAYABLE_LOCAL_URL); + Playable p = writeTestPlayable(playableFileUrl, PLAYABLE_LOCAL_URL); if (initialState == PlayerStatus.PLAYING) { psmp.playMediaObject(p, stream, true, true); } @@ -616,7 +616,7 @@ public class PlaybackServiceMediaPlayerTest { PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); if (initialState == PlayerStatus.PREPARED || initialState == PlayerStatus.PLAYING || initialState == PlayerStatus.PAUSED) { boolean startWhenPrepared = (initialState != PlayerStatus.PREPARED); - psmp.playMediaObject(writeTestPlayable(PLAYABLE_FILE_URL, PLAYABLE_LOCAL_URL), false, startWhenPrepared, true); + psmp.playMediaObject(writeTestPlayable(playableFileUrl, PLAYABLE_LOCAL_URL), false, startWhenPrepared, true); } if (initialState == PlayerStatus.PAUSED) { psmp.pause(false, false); @@ -673,7 +673,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, PLAYABLE_LOCAL_URL); + Playable p = writeTestPlayable(playableFileUrl, PLAYABLE_LOCAL_URL); if (initialState == PlayerStatus.INITIALIZED || initialState == PlayerStatus.PLAYING || initialState == PlayerStatus.PREPARED @@ -747,7 +747,7 @@ public class PlaybackServiceMediaPlayerTest { } }); PlaybackServiceMediaPlayer psmp = new LocalPSMP(c, callback); - Playable p = writeTestPlayable(PLAYABLE_FILE_URL, PLAYABLE_LOCAL_URL); + Playable p = writeTestPlayable(playableFileUrl, PLAYABLE_LOCAL_URL); boolean prepareImmediately = initialState != PlayerStatus.INITIALIZED; boolean startImmediately = initialState != PlayerStatus.PREPARED; psmp.playMediaObject(p, false, startImmediately, prepareImmediately); |