mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-06-14 19:05:18 -04:00
convert SwapRepoTest into initial UpdateServiceTest
Finally, there can be a test for running UpdateService, which is essential and has some really hairy code in it. At least swap has been removed from there. This is barebones still, but it now can be developed to test quite a bit of what is still needed in UpdateService.
This commit is contained in:
@@ -24,8 +24,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.security.cert.Certificate;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -103,7 +101,7 @@ public class SwapRepoEmulatorTest {
|
||||
assertFalse(TextUtils.isEmpty(signingCert));
|
||||
assertFalse(TextUtils.isEmpty(fingerprint));
|
||||
|
||||
assertTrue(isPortInUse(FDroidApp.ipAddressString, FDroidApp.port));
|
||||
assertTrue(Utils.isPortInUse(FDroidApp.ipAddressString, FDroidApp.port));
|
||||
Thread.sleep(100);
|
||||
|
||||
File swapJarFile = File.createTempFile("swap", "", context.getCacheDir());
|
||||
@@ -151,19 +149,6 @@ public class SwapRepoEmulatorTest {
|
||||
assertFalse(localHttpd.isAlive());
|
||||
}
|
||||
|
||||
private boolean isPortInUse(String host, int port) {
|
||||
boolean result = false;
|
||||
|
||||
try {
|
||||
(new Socket(host, port)).close();
|
||||
result = true;
|
||||
} catch (IOException e) {
|
||||
// Could not connect.
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isSystemPackage(ResolveInfo resolveInfo) {
|
||||
return (resolveInfo.activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user