diff --git a/src/de/danoeh/antennapod/service/download/DownloadStatus.java b/src/de/danoeh/antennapod/service/download/DownloadStatus.java index 8be73a8ae..487c3b3de 100644 --- a/src/de/danoeh/antennapod/service/download/DownloadStatus.java +++ b/src/de/danoeh/antennapod/service/download/DownloadStatus.java @@ -162,6 +162,7 @@ public class DownloadStatus { this.successful = false; this.reason = reason; this.reasonDetailed = reasonDetailed; + this.done = true; } public void setCancelled() { diff --git a/src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java b/src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java index 2cd5734d5..f91592869 100644 --- a/src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java +++ b/src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java @@ -47,42 +47,16 @@ public class HttpDownloaderTest extends AndroidTestCase { assertNotNull(status); assertTrue(status.isSuccessful() == expectedResult); assertTrue(status.isDone()); - assertTrue(new File(feedFile.getFile_url()).exists()); + // the file should not exist if the download has failed + assertTrue(new File(feedFile.getFile_url()).exists() == expectedResult); } - public void testRandomUrls() { - final String[] urls = { - "http://radiobox.omroep.nl/programme/read_programme_podcast/9168/read.rss", - "http://content.zdf.de/podcast/zdf_heute/heute_a.xml", - "http://rss.sciam.com/sciam/60secsciencepodcast", - "http://rss.sciam.com/sciam/60-second-mind", - "http://rss.sciam.com/sciam/60-second-space", - "http://rss.sciam.com/sciam/60-second-health", - "http://rss.sciam.com/sciam/60-second-tech", - "http://risky.biz/feeds/risky-business", - "http://risky.biz/feeds/rb2", - "http://podcast.hr-online.de/lateline/podcast.xml", - "http://bitlove.org/nsemak/mikrodilettanten/feed", - "http://bitlove.org/moepmoeporg/riotburnz/feed", - "http://bitlove.org/moepmoeporg/schachcast/feed", - "http://bitlove.org/moepmoeporg/sundaymoaning/feed", - "http://bitlove.org/motofunk/anekdotkast/feed", - "http://bitlove.org/motofunk/motofunk/feed", - "http://bitlove.org/nerdinand/zch/feed", - "http://podcast.homerj.de/podcasts.xml", - "http://www.dradio.de/rss/podcast/sendungen/wissenschaftundbildung/", - "http://www.dradio.de/rss/podcast/sendungen/wirtschaftundverbraucher/", - "http://www.dradio.de/rss/podcast/sendungen/literatur/", - "http://www.dradio.de/rss/podcast/sendungen/sport/", - "http://www.dradio.de/rss/podcast/sendungen/wirtschaftundgesellschaft/", - "http://www.dradio.de/rss/podcast/sendungen/filmederwoche/", - "http://www.blacksweetstories.com/feed/podcast/", - "http://feeds.5by5.tv/buildanalyze", - "http://bitlove.org/ranzzeit/ranz/feed" - }; - for (int i = 0; i < urls.length; i++) { - download(urls[i], Integer.toString(i), true); - } + public void testPassingHttp() { + download("http://httpbin.org/status/200", "test200", true); + } + + public void testPassingHttps() { + download("https://httpbin.org/status/200", "test200", true); } public void testRedirect() { @@ -111,6 +85,7 @@ public class HttpDownloaderTest extends AndroidTestCase { downloader.call(); } }; + t.start(); downloader.cancel(); try { t.join();