[Test] Add stream dash mpd url test

This commit is contained in:
Stypox 2020-06-14 10:41:13 +02:00
parent d0b14644bb
commit 880ff04a5c
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
3 changed files with 16 additions and 1 deletions

View File

@ -23,6 +23,7 @@ public interface BaseStreamExtractorTest extends BaseExtractorTest {
void testAudioStreams() throws Exception;
void testVideoStreams() throws Exception;
void testSubtitles() throws Exception;
void testGetDashMpdUrl() throws Exception;
void testFrames() throws Exception;
void testHost() throws Exception;
void testPrivacy() throws Exception;

View File

@ -22,11 +22,11 @@ import java.util.TimeZone;
import javax.annotation.Nullable;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertAtLeast;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEqualsOrderIndependent;
@ -59,6 +59,7 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
public boolean expectedHasVideoStreams() { return true; } // default: there are video streams
public boolean expectedHasAudioStreams() { return true; } // default: there are audio streams
public boolean expectedHasSubtitles() { return true; } // default: there are subtitles streams
@Nullable public String expectedDashMpdUrlContains() { return null; } // default: no dash mpd
public boolean expectedHasFrames() { return true; } // default: there are frames
public String expectedHost() { return ""; } // default: no host for centralized platforms
public String expectedPrivacy() { return ""; } // default: no privacy policy available
@ -306,6 +307,18 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
}
}
@Override
public void testGetDashMpdUrl() throws Exception {
final String dashMpdUrl = extractor().getDashMpdUrl();
if (expectedDashMpdUrlContains() == null) {
assertNotNull(dashMpdUrl);
assertTrue(dashMpdUrl.isEmpty());
} else {
assertIsSecureUrl(dashMpdUrl);
assertThat(extractor().getDashMpdUrl(), containsString(expectedDashMpdUrlContains()));
}
}
@Test
@Override
public void testFrames() throws Exception {

View File

@ -50,5 +50,6 @@ public class YoutubeStreamExtractorLivestreamTest extends DefaultStreamExtractor
@Override public long expectedLikeCountAtLeast() { return 825000; }
@Override public long expectedDislikeCountAtLeast() { return 15600; }
@Override public boolean expectedHasSubtitles() { return false; }
@Nullable @Override public String expectedDashMpdUrlContains() { return "https://manifest.googlevideo.com/api/manifest/dash/"; }
@Override public boolean expectedHasFrames() { return false; }
}