mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-06-18 04:39:45 -04:00
Use symlink instead of hardlink, which was accidentally used on API < 19.
At the same time, also changed visibility of methods to package local to remove need for test class.
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
package org.fdroid.fdroid.compat;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
|
||||
import org.fdroid.fdroid.data.SanitizedFile;
|
||||
|
||||
/**
|
||||
* Used to expose the protected methods from FileCompat in a public manner so
|
||||
* that they can be called from a test harness.
|
||||
*/
|
||||
public class FileCompatForTest extends FileCompat {
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public static void symlinkOsTest(SanitizedFile source, SanitizedFile dest) {
|
||||
symlinkOs(source, dest);
|
||||
}
|
||||
|
||||
public static void symlinkRuntimeTest(SanitizedFile source, SanitizedFile dest) {
|
||||
symlinkRuntime(source, dest);
|
||||
}
|
||||
|
||||
public static void symlinkLibcoreTest(SanitizedFile source, SanitizedFile dest) {
|
||||
symlinkLibcore(source, dest);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.fdroid.fdroid;
|
||||
package org.fdroid.fdroid.compat;
|
||||
|
||||
import android.app.Instrumentation;
|
||||
import android.content.Context;
|
||||
@@ -9,7 +9,7 @@ import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.util.Log;
|
||||
|
||||
import org.fdroid.fdroid.compat.FileCompatForTest;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.SanitizedFile;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -64,21 +64,21 @@ public class FileCompatTest {
|
||||
|
||||
@Test
|
||||
public void testSymlinkRuntime() {
|
||||
FileCompatForTest.symlinkRuntimeTest(sourceFile, destFile);
|
||||
FileCompat.symlinkRuntime(sourceFile, destFile);
|
||||
assertTrue(destFile.getAbsolutePath() + " should exist after symlinking", destFile.exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSymlinkLibcore() {
|
||||
assumeTrue(Build.VERSION.SDK_INT >= 19);
|
||||
FileCompatForTest.symlinkLibcoreTest(sourceFile, destFile);
|
||||
FileCompat.symlinkLibcore(sourceFile, destFile);
|
||||
assertTrue(destFile.getAbsolutePath() + " should exist after symlinking", destFile.exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSymlinkOs() {
|
||||
assumeTrue(Build.VERSION.SDK_INT >= 21);
|
||||
FileCompatForTest.symlinkOsTest(sourceFile, destFile);
|
||||
FileCompat.symlinkOs(sourceFile, destFile);
|
||||
assertTrue(destFile.getAbsolutePath() + " should exist after symlinking", destFile.exists());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user