Fixed HttpDownloaderTest
This commit is contained in:
parent
6e1a533bf7
commit
a86cf89183
|
@ -162,6 +162,7 @@ public class DownloadStatus {
|
|||
this.successful = false;
|
||||
this.reason = reason;
|
||||
this.reasonDetailed = reasonDetailed;
|
||||
this.done = true;
|
||||
}
|
||||
|
||||
public void setCancelled() {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue