mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-06-18 04:39:45 -04:00
[app] pass App object into installers, so it is available everywhere where needed
This commit is contained in:
committed by
Hans-Christoph Steiner
parent
a8d210e487
commit
6603781652
@@ -4,6 +4,7 @@ import android.content.ContextWrapper;
|
||||
|
||||
import org.fdroid.fdroid.Preferences;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
import org.fdroid.index.v2.FileV1;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -30,12 +31,14 @@ public class FileInstallerTest {
|
||||
|
||||
@Test
|
||||
public void testInstallOtaZip() {
|
||||
App app = new App();
|
||||
app.packageName = "org.fdroid.fdroid.privileged.ota";
|
||||
Apk apk = new Apk();
|
||||
apk.apkFile = new FileV1("org.fdroid.fdroid.privileged.ota_2010.zip", "hash", null, null);
|
||||
apk.packageName = "org.fdroid.fdroid.privileged.ota";
|
||||
apk.versionCode = 2010;
|
||||
assertFalse(apk.isApk());
|
||||
Installer installer = InstallerFactory.create(context, apk);
|
||||
Installer installer = InstallerFactory.create(context, app, apk);
|
||||
assertEquals("should be a FileInstaller",
|
||||
FileInstaller.class,
|
||||
installer.getClass());
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.ContextWrapper;
|
||||
|
||||
import org.fdroid.fdroid.Preferences;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
import org.fdroid.index.v2.FileV1;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -28,10 +29,12 @@ public class InstallerFactoryTest {
|
||||
@Test
|
||||
public void testApkInstallerInstance() {
|
||||
for (String filename : new String[]{"test.apk", "A.APK", "b.ApK"}) {
|
||||
App app = new App();
|
||||
app.packageName = "test";
|
||||
Apk apk = new Apk();
|
||||
apk.apkFile = new FileV1(filename, "hash", null, null);
|
||||
apk.packageName = "test";
|
||||
Installer installer = InstallerFactory.create(context, apk);
|
||||
Installer installer = InstallerFactory.create(context, app, apk);
|
||||
assertEquals(filename + " should use a DefaultInstaller",
|
||||
DefaultInstaller.class,
|
||||
installer.getClass());
|
||||
@@ -41,10 +44,12 @@ public class InstallerFactoryTest {
|
||||
@Test
|
||||
public void testFileInstallerInstance() {
|
||||
for (String filename : new String[]{"org.fdroid.fdroid.privileged.ota_2110.zip", "test.ZIP"}) {
|
||||
App app = new App();
|
||||
app.packageName = "cafe0088";
|
||||
Apk apk = new Apk();
|
||||
apk.apkFile = new FileV1(filename, "hash", null, null);
|
||||
apk.packageName = "cafe0088";
|
||||
Installer installer = InstallerFactory.create(context, apk);
|
||||
Installer installer = InstallerFactory.create(context, app, apk);
|
||||
assertEquals("should be a FileInstaller",
|
||||
FileInstaller.class,
|
||||
installer.getClass());
|
||||
|
||||
Reference in New Issue
Block a user