From 66518ec44452f2fd3916805a07d3959409b0e16c Mon Sep 17 00:00:00 2001 From: bopol Date: Fri, 13 Mar 2020 20:07:36 +0100 Subject: [PATCH] check wether mediaccc streams url are secure --- .../MediaCCCStreamExtractorTest.java | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCStreamExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCStreamExtractorTest.java index c0f51437d..8120e07a8 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCStreamExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCStreamExtractorTest.java @@ -7,11 +7,14 @@ import org.schabi.newpipe.DownloaderTestImpl; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCStreamExtractor; +import org.schabi.newpipe.extractor.stream.AudioStream; +import org.schabi.newpipe.extractor.stream.VideoStream; import org.schabi.newpipe.extractor.utils.UtilsTest; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.List; import static java.util.Objects.requireNonNull; import static junit.framework.TestCase.assertEquals; @@ -86,12 +89,20 @@ public class MediaCCCStreamExtractorTest { @Test public void testVideoStreams() throws Exception { - assertEquals(4, extractor.getVideoStreams().size()); + List videoStreamList = extractor.getVideoStreams(); + assertEquals(4, videoStreamList.size()); + for (VideoStream stream : videoStreamList) { + assertIsSecureUrl(stream.getUrl()); + } } @Test public void testAudioStreams() throws Exception { - assertEquals(2, extractor.getAudioStreams().size()); + List audioStreamList = extractor.getAudioStreams(); + assertEquals(2, audioStreamList.size()); + for (AudioStream stream : audioStreamList) { + assertIsSecureUrl(stream.getUrl()); + } } @Test @@ -164,12 +175,20 @@ public class MediaCCCStreamExtractorTest { @Test public void testVideoStreams() throws Exception { - assertEquals(8, extractor.getVideoStreams().size()); + List videoStreamList = extractor.getVideoStreams(); + assertEquals(8, videoStreamList.size()); + for (VideoStream stream : videoStreamList) { + assertIsSecureUrl(stream.getUrl()); + } } @Test public void testAudioStreams() throws Exception { - assertEquals(2, extractor.getAudioStreams().size()); + List audioStreamList = extractor.getAudioStreams(); + assertEquals(2, audioStreamList.size()); + for (AudioStream stream : audioStreamList) { + assertIsSecureUrl(stream.getUrl()); + } } @Test