Make F-Droid tests runnable from Gradle.
This also makes AndroidStudio integration work better, which makes running and debugging tests much nicer than the CLI. Also cleaned up imports in one test, and made the symlink tests not fail on older devices below API 19.
This commit is contained in:
parent
da566b44ce
commit
9dfa18aead
@ -39,6 +39,8 @@ if ( !hasProperty( 'sourceDeps' ) ) {
|
||||
|
||||
// Upstream doesn't have a binary on mavenCentral.
|
||||
compile(name: 'zipsigner')
|
||||
|
||||
androidTestCompile 'commons-io:commons-io:2.2'
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -76,6 +78,8 @@ if ( !hasProperty( 'sourceDeps' ) ) {
|
||||
compile 'com.android.support:support-v4:20.0.+',
|
||||
'com.android.support:appcompat-v7:20.0.+',
|
||||
'com.android.support:support-annotations:20.0.+'
|
||||
|
||||
androidTestCompile 'commons-io:commons-io:2.2'
|
||||
}
|
||||
|
||||
}
|
||||
@ -135,7 +139,16 @@ android {
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
|
||||
instrumentTest.setRoot('test')
|
||||
androidTest.setRoot('test')
|
||||
androidTest {
|
||||
manifest.srcFile 'test/AndroidManifest.xml'
|
||||
java.srcDirs = ['test/src']
|
||||
resources.srcDirs = ['test/src']
|
||||
aidl.srcDirs = ['test/src']
|
||||
renderscript.srcDirs = ['test/src']
|
||||
res.srcDirs = ['test/res']
|
||||
assets.srcDirs = ['test/assets']
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
@ -25,9 +25,14 @@ public class FileCompatTest extends InstrumentationTestCase {
|
||||
}
|
||||
|
||||
public void tearDown() {
|
||||
if (sourceFile.exists()) {
|
||||
assertTrue("Can't delete " + sourceFile.getAbsolutePath() + ".", sourceFile.delete());
|
||||
}
|
||||
|
||||
if (destFile.exists()) {
|
||||
assertTrue("Can't delete " + destFile.getAbsolutePath() + ".", destFile.delete());
|
||||
}
|
||||
}
|
||||
|
||||
public void testSymlinkRuntime() {
|
||||
SanitizedFile destFile = new SanitizedFile(dir, "dest.txt");
|
||||
|
@ -3,21 +3,15 @@ package org.fdroid.fdroid.updater;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import android.test.InstrumentationTestCase;
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.fdroid.fdroid.TestUtils;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.Repo;
|
||||
import org.fdroid.fdroid.updater.RepoUpdater.UpdateException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
@TargetApi(8)
|
||||
public class SignedRepoUpdaterTest extends InstrumentationTestCase {
|
||||
|
Loading…
x
Reference in New Issue
Block a user