delete DownloaderServiceTest stub, it is now crashing
DownloaderServiceTest is just a stub of a test that doesn't really test anything yet. It is now causing a NullPointerException, so its a problem: java.lang.NullPointerException at org.fdroid.fdroid.net.DownloaderService.notifyDownloadComplete(DownloaderService.java:313) at org.fdroid.fdroid.net.DownloaderService.handleIntent(DownloaderService.java:287) at org.fdroid.fdroid.net.DownloaderService$ServiceHandler.handleMessage(DownloaderService.java:104) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.os.HandlerThread.run(HandlerThread.java:60)
This commit is contained in:
parent
0214e9e447
commit
d73dac73ad
@ -1,41 +0,0 @@
|
||||
|
||||
package org.fdroid.fdroid.net;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.test.ServiceTestCase;
|
||||
import android.util.Log;
|
||||
|
||||
@SuppressWarnings("PMD") // TODO port this to JUnit 4 semantics
|
||||
public class DownloaderServiceTest extends ServiceTestCase<DownloaderService> {
|
||||
public static final String TAG = "DownloaderServiceTest";
|
||||
|
||||
String[] urls = {
|
||||
"https://en.wikipedia.org/wiki/Index.html",
|
||||
"https://mirrors.kernel.org/debian/dists/stable/Release",
|
||||
"https://f-droid.org/archive/de.we.acaldav_5.apk",
|
||||
// sites that use SNI for HTTPS
|
||||
"https://guardianproject.info/fdroid/repo/index.jar",
|
||||
};
|
||||
|
||||
public DownloaderServiceTest() {
|
||||
super(DownloaderService.class);
|
||||
}
|
||||
|
||||
public void testQueueingDownload() throws InterruptedException {
|
||||
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(getContext());
|
||||
localBroadcastManager.registerReceiver(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.i(TAG, "onReceive " + intent);
|
||||
}
|
||||
}, new IntentFilter(Downloader.ACTION_PROGRESS));
|
||||
for (String url : urls) {
|
||||
DownloaderService.queue(getContext(), null, url);
|
||||
}
|
||||
Thread.sleep(30000);
|
||||
}
|
||||
}
|
@ -302,6 +302,10 @@ public class DownloaderService extends Service {
|
||||
downloader = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post a notification about a completed download. {@code packageName} must be a valid
|
||||
* and currently in the app index database.
|
||||
*/
|
||||
private void notifyDownloadComplete(String packageName, String urlString) {
|
||||
String title;
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user