Skip to content

Commit 880ff04

Browse files
committed
[Test] Add stream dash mpd url test
1 parent d0b1464 commit 880ff04

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/BaseStreamExtractorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public interface BaseStreamExtractorTest extends BaseExtractorTest {
2323
void testAudioStreams() throws Exception;
2424
void testVideoStreams() throws Exception;
2525
void testSubtitles() throws Exception;
26+
void testGetDashMpdUrl() throws Exception;
2627
void testFrames() throws Exception;
2728
void testHost() throws Exception;
2829
void testPrivacy() throws Exception;

extractor/src/test/java/org/schabi/newpipe/extractor/services/DefaultStreamExtractorTest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
import javax.annotation.Nullable;
2323

2424
import static org.hamcrest.CoreMatchers.containsString;
25+
import static org.hamcrest.MatcherAssert.assertThat;
2526
import static org.junit.Assert.assertEquals;
2627
import static org.junit.Assert.assertFalse;
2728
import static org.junit.Assert.assertNotNull;
2829
import static org.junit.Assert.assertNull;
29-
import static org.junit.Assert.assertThat;
3030
import static org.junit.Assert.assertTrue;
3131
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertAtLeast;
3232
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEqualsOrderIndependent;
@@ -59,6 +59,7 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
5959
public boolean expectedHasVideoStreams() { return true; } // default: there are video streams
6060
public boolean expectedHasAudioStreams() { return true; } // default: there are audio streams
6161
public boolean expectedHasSubtitles() { return true; } // default: there are subtitles streams
62+
@Nullable public String expectedDashMpdUrlContains() { return null; } // default: no dash mpd
6263
public boolean expectedHasFrames() { return true; } // default: there are frames
6364
public String expectedHost() { return ""; } // default: no host for centralized platforms
6465
public String expectedPrivacy() { return ""; } // default: no privacy policy available
@@ -306,6 +307,18 @@ public void testSubtitles() throws Exception {
306307
}
307308
}
308309

310+
@Override
311+
public void testGetDashMpdUrl() throws Exception {
312+
final String dashMpdUrl = extractor().getDashMpdUrl();
313+
if (expectedDashMpdUrlContains() == null) {
314+
assertNotNull(dashMpdUrl);
315+
assertTrue(dashMpdUrl.isEmpty());
316+
} else {
317+
assertIsSecureUrl(dashMpdUrl);
318+
assertThat(extractor().getDashMpdUrl(), containsString(expectedDashMpdUrlContains()));
319+
}
320+
}
321+
309322
@Test
310323
@Override
311324
public void testFrames() throws Exception {

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ public static void setUp() throws Exception {
5050
@Override public long expectedLikeCountAtLeast() { return 825000; }
5151
@Override public long expectedDislikeCountAtLeast() { return 15600; }
5252
@Override public boolean expectedHasSubtitles() { return false; }
53+
@Nullable @Override public String expectedDashMpdUrlContains() { return "https://manifest.googlevideo.com/api/manifest/dash/"; }
5354
@Override public boolean expectedHasFrames() { return false; }
5455
}

0 commit comments

Comments
 (0)