Update robolectric to 4.11.1
This commit is contained in:
@@ -17,7 +17,6 @@ public class KeychainTestRunner extends RobolectricTestRunner {
|
||||
protected Config buildGlobalConfig() {
|
||||
return new Config.Builder()
|
||||
.setSdk(27)
|
||||
.setConstants(WorkaroundBuildConfig.class)
|
||||
.setShadows(new Class[] { ShadowWorkManager.class })
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.sufficientlysecure.keychain;
|
||||
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
|
||||
/**
|
||||
* Temporary workaround for https://github.com/robolectric/robolectric/issues/1747
|
||||
*/
|
||||
public final class WorkaroundBuildConfig {
|
||||
public static final boolean DEBUG = BuildConfig.DEBUG;
|
||||
// Workaround: Use real packageName not applicationId
|
||||
public static final String APPLICATION_ID = "org.sufficientlysecure.keychain";
|
||||
public static final String BUILD_TYPE = BuildConfig.BUILD_TYPE;
|
||||
public static final String FLAVOR = BuildConfig.FLAVOR;
|
||||
public static final int VERSION_CODE = BuildConfig.VERSION_CODE;
|
||||
public static final String VERSION_NAME = BuildConfig.VERSION_NAME;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class AuthenticationOperationTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
// don't log verbosely here, we're not here to test imports
|
||||
ShadowLog.stream = oldShadowStream;
|
||||
@@ -153,13 +153,13 @@ public class AuthenticationOperationTest {
|
||||
byte[] challenge = "dies ist ein challenge ☭".getBytes();
|
||||
byte[] signature;
|
||||
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application);
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
long masterKeyId = mStaticRingRsa.getMasterKeyId();
|
||||
Long authSubKeyId = keyRepository.getEffectiveAuthenticationKeyId(masterKeyId);
|
||||
|
||||
{ // sign challenge
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.application,
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.getApplication(),
|
||||
keyRepository);
|
||||
|
||||
AuthenticationData.Builder authData = AuthenticationData.builder();
|
||||
@@ -199,13 +199,13 @@ public class AuthenticationOperationTest {
|
||||
byte[] challenge = "dies ist ein challenge ☭".getBytes();
|
||||
byte[] signature;
|
||||
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application);
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
long masterKeyId = mStaticRingEcDsa.getMasterKeyId();
|
||||
Long authSubKeyId = keyRepository.getEffectiveAuthenticationKeyId(masterKeyId);
|
||||
|
||||
{ // sign challenge
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.application,
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.getApplication(),
|
||||
keyRepository);
|
||||
|
||||
AuthenticationData.Builder authData = AuthenticationData.builder();
|
||||
@@ -245,13 +245,13 @@ public class AuthenticationOperationTest {
|
||||
byte[] challenge = "dies ist ein challenge ☭".getBytes();
|
||||
byte[] signature;
|
||||
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application);
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
long masterKeyId = mStaticRingEdDsa.getMasterKeyId();
|
||||
Long authSubKeyId = keyRepository.getEffectiveAuthenticationKeyId(masterKeyId);
|
||||
|
||||
{ // sign challenge
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.application,
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.getApplication(),
|
||||
keyRepository);
|
||||
|
||||
AuthenticationData.Builder authData = AuthenticationData.builder();
|
||||
@@ -294,13 +294,13 @@ public class AuthenticationOperationTest {
|
||||
byte[] challenge = "dies ist ein challenge ☭".getBytes();
|
||||
byte[] signature;
|
||||
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application);
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
long masterKeyId = mStaticRingDsa.getMasterKeyId();
|
||||
Long authSubKeyId = keyRepository.getEffectiveAuthenticationKeyId(masterKeyId);
|
||||
|
||||
{ // sign challenge
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.application,
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.getApplication(),
|
||||
keyRepository);
|
||||
|
||||
AuthenticationData.Builder authData = AuthenticationData.builder();
|
||||
@@ -339,13 +339,13 @@ public class AuthenticationOperationTest {
|
||||
|
||||
byte[] challenge = "dies ist ein challenge ☭".getBytes();
|
||||
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application);
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
long masterKeyId = mStaticRingEcDsa.getMasterKeyId();
|
||||
Long authSubKeyId = keyRepository.getEffectiveAuthenticationKeyId(masterKeyId);
|
||||
|
||||
{ // sign challenge - should succeed with selected key allowed
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.application,
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.getApplication(),
|
||||
keyRepository);
|
||||
|
||||
AuthenticationData.Builder authData = AuthenticationData.builder();
|
||||
@@ -368,7 +368,7 @@ public class AuthenticationOperationTest {
|
||||
Assert.assertTrue("authentication must succeed with selected key allowed", result.success());
|
||||
}
|
||||
{ // sign challenge - should fail with selected key disallowed
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.application,
|
||||
AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.getApplication(),
|
||||
keyRepository);
|
||||
|
||||
AuthenticationData.Builder authData = AuthenticationData.builder();
|
||||
|
||||
@@ -135,7 +135,7 @@ public class BackupOperationTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
// don't log verbosely here, we're not here to test imports
|
||||
ShadowLog.stream = oldShadowStream;
|
||||
@@ -149,8 +149,8 @@ public class BackupOperationTest {
|
||||
|
||||
@Test
|
||||
public void testExportAllLocalStripped() throws Exception {
|
||||
BackupOperation op = new BackupOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
BackupOperation op = new BackupOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
// make sure there is a local cert (so the later checks that there are none are meaningful)
|
||||
assertTrue("second keyring has local certification", checkForLocal(mStaticRing2));
|
||||
@@ -230,8 +230,8 @@ public class BackupOperationTest {
|
||||
|
||||
@Test
|
||||
public void testExportWithExtraHeaders() throws Exception {
|
||||
BackupOperation op = new BackupOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
BackupOperation op = new BackupOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
boolean result = op.exportKeysToStream(
|
||||
@@ -252,11 +252,11 @@ public class BackupOperationTest {
|
||||
ByteArrayOutputStream outStream1 = new ByteArrayOutputStream();
|
||||
when(mockResolver.openOutputStream(fakeOutputUri)).thenReturn(outStream1);
|
||||
|
||||
Application spyApplication = spy(RuntimeEnvironment.application);
|
||||
Application spyApplication = spy(RuntimeEnvironment.getApplication());
|
||||
when(spyApplication.getContentResolver()).thenReturn(mockResolver);
|
||||
|
||||
BackupOperation op = new BackupOperation(spyApplication,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
BackupKeyringParcel parcel = BackupKeyringParcel.create(
|
||||
new long[] { mStaticRing1.getMasterKeyId() }, false, false, true, fakeOutputUri);
|
||||
@@ -305,7 +305,7 @@ public class BackupOperationTest {
|
||||
outStream = new ByteArrayOutputStream();
|
||||
when(mockResolver.openOutputStream(fakeOutputUri)).thenReturn(outStream);
|
||||
|
||||
spyApplication = spy(RuntimeEnvironment.application);
|
||||
spyApplication = spy(RuntimeEnvironment.getApplication());
|
||||
when(spyApplication.getContentResolver()).thenReturn(mockResolver);
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ public class BackupOperationTest {
|
||||
|
||||
{ // export encrypted
|
||||
BackupOperation op = new BackupOperation(spyApplication,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
BackupKeyringParcel parcel = BackupKeyringParcel.create(
|
||||
new long[] { mStaticRing1.getMasterKeyId() }, false, true, true, fakeOutputUri);
|
||||
@@ -330,8 +330,8 @@ public class BackupOperationTest {
|
||||
}
|
||||
|
||||
{
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
PgpDecryptVerifyInputParcel input = PgpDecryptVerifyInputParcel.builder()
|
||||
.setAllowSymmetricDecryption(true)
|
||||
|
||||
@@ -46,8 +46,8 @@ public class BenchmarkOperationTest {
|
||||
|
||||
@Test
|
||||
public void testBenchmark() throws Exception {
|
||||
BenchmarkOperation op = new BenchmarkOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
BenchmarkOperation op = new BenchmarkOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
op.execute(BenchmarkInputParcel.newInstance(), null);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class CertifyOperationTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
// don't log verbosely here, we're not here to test imports
|
||||
ShadowLog.stream = oldShadowStream;
|
||||
@@ -133,7 +133,7 @@ public class CertifyOperationTest {
|
||||
@Test
|
||||
public void testSelfCertifyFlag() throws Exception {
|
||||
|
||||
CanonicalizedPublicKeyRing ring = KeyWritableRepository.create(RuntimeEnvironment.application)
|
||||
CanonicalizedPublicKeyRing ring = KeyWritableRepository.create(RuntimeEnvironment.getApplication())
|
||||
.getCanonicalizedPublicKeyRing(mStaticRing1.getMasterKeyId());
|
||||
Assert.assertEquals("secret key must be marked self-certified in database",
|
||||
// TODO this should be more correctly be VERIFIED_SELF at some point!
|
||||
@@ -143,11 +143,11 @@ public class CertifyOperationTest {
|
||||
|
||||
@Test
|
||||
public void testCertifyId() throws Exception {
|
||||
CertifyOperation op = new CertifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null, null);
|
||||
CertifyOperation op = new CertifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null, null);
|
||||
|
||||
{
|
||||
CanonicalizedPublicKeyRing ring = KeyWritableRepository.create(RuntimeEnvironment.application)
|
||||
CanonicalizedPublicKeyRing ring = KeyWritableRepository.create(RuntimeEnvironment.getApplication())
|
||||
.getCanonicalizedPublicKeyRing(mStaticRing2.getMasterKeyId());
|
||||
Assert.assertNull("public key must not be marked verified prior to certification",
|
||||
ring.getVerified());
|
||||
@@ -161,7 +161,7 @@ public class CertifyOperationTest {
|
||||
Assert.assertTrue("certification must succeed", result.success());
|
||||
|
||||
{
|
||||
CanonicalizedPublicKeyRing ring = KeyWritableRepository.create(RuntimeEnvironment.application)
|
||||
CanonicalizedPublicKeyRing ring = KeyWritableRepository.create(RuntimeEnvironment.getApplication())
|
||||
.getCanonicalizedPublicKeyRing(mStaticRing2.getMasterKeyId());
|
||||
Assert.assertEquals("new key must be verified now",
|
||||
VerificationStatus.VERIFIED_SECRET, ring.getVerified());
|
||||
@@ -171,8 +171,8 @@ public class CertifyOperationTest {
|
||||
|
||||
@Test
|
||||
public void testCertifyAttribute() throws Exception {
|
||||
KeyWritableRepository keyWritableRepository = KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
CertifyOperation op = new CertifyOperation(RuntimeEnvironment.application, keyWritableRepository, null, null);
|
||||
KeyWritableRepository keyWritableRepository = KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
CertifyOperation op = new CertifyOperation(RuntimeEnvironment.getApplication(), keyWritableRepository, null, null);
|
||||
|
||||
{
|
||||
CanonicalizedPublicKeyRing ring = keyWritableRepository.getCanonicalizedPublicKeyRing(mStaticRing2.getMasterKeyId());
|
||||
@@ -198,8 +198,8 @@ public class CertifyOperationTest {
|
||||
|
||||
@Test
|
||||
public void testCertifySelf() throws Exception {
|
||||
CertifyOperation op = new CertifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null, null);
|
||||
CertifyOperation op = new CertifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null, null);
|
||||
|
||||
CertifyActionsParcel.Builder actions = CertifyActionsParcel.builder(mStaticRing1.getMasterKeyId());
|
||||
actions.addAction(CertifyAction.createForUserIds(mStaticRing1.getMasterKeyId(),
|
||||
@@ -215,8 +215,8 @@ public class CertifyOperationTest {
|
||||
@Test
|
||||
public void testCertifyNonexistent() throws Exception {
|
||||
|
||||
CertifyOperation op = new CertifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null, null);
|
||||
CertifyOperation op = new CertifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null, null);
|
||||
|
||||
{
|
||||
CertifyActionsParcel.Builder actions = CertifyActionsParcel.builder(mStaticRing1.getMasterKeyId());
|
||||
|
||||
@@ -92,7 +92,7 @@ public class PromoteKeyOperationTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
// don't log verbosely here, we're not here to test imports
|
||||
ShadowLog.stream = oldShadowStream;
|
||||
@@ -105,8 +105,8 @@ public class PromoteKeyOperationTest {
|
||||
|
||||
@Test
|
||||
public void testPromote() throws Exception {
|
||||
KeyWritableRepository keyRepository = KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
PromoteKeyOperation op = new PromoteKeyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository keyRepository = KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
PromoteKeyOperation op = new PromoteKeyOperation(RuntimeEnvironment.getApplication(),
|
||||
keyRepository, null, null);
|
||||
|
||||
PromoteKeyResult result = op.execute(
|
||||
@@ -130,8 +130,8 @@ public class PromoteKeyOperationTest {
|
||||
|
||||
@Test
|
||||
public void testPromoteDivert() throws Exception {
|
||||
PromoteKeyOperation op = new PromoteKeyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null, null);
|
||||
PromoteKeyOperation op = new PromoteKeyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null, null);
|
||||
|
||||
byte[] aid = Hex.decode("D2760001240102000000012345670000");
|
||||
|
||||
@@ -141,7 +141,7 @@ public class PromoteKeyOperationTest {
|
||||
Assert.assertTrue("promotion must succeed", result.success());
|
||||
|
||||
{
|
||||
CanonicalizedSecretKeyRing ring = KeyWritableRepository.create(RuntimeEnvironment.application)
|
||||
CanonicalizedSecretKeyRing ring = KeyWritableRepository.create(RuntimeEnvironment.getApplication())
|
||||
.getCanonicalizedSecretKeyRing(mStaticRing.getMasterKeyId());
|
||||
|
||||
for (CanonicalizedSecretKey key : ring.secretKeyIterator()) {
|
||||
@@ -156,8 +156,8 @@ public class PromoteKeyOperationTest {
|
||||
|
||||
@Test
|
||||
public void testPromoteDivertSpecific() throws Exception {
|
||||
PromoteKeyOperation op = new PromoteKeyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null, null);
|
||||
PromoteKeyOperation op = new PromoteKeyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null, null);
|
||||
|
||||
byte[] aid = Hex.decode("D2760001240102000000012345670000");
|
||||
|
||||
@@ -171,7 +171,7 @@ public class PromoteKeyOperationTest {
|
||||
Assert.assertTrue("promotion must succeed", result.success());
|
||||
|
||||
{
|
||||
CanonicalizedSecretKeyRing ring = KeyWritableRepository.create(RuntimeEnvironment.application)
|
||||
CanonicalizedSecretKeyRing ring = KeyWritableRepository.create(RuntimeEnvironment.getApplication())
|
||||
.getCanonicalizedSecretKeyRing(mStaticRing.getMasterKeyId());
|
||||
|
||||
for (CanonicalizedSecretKey key : ring.secretKeyIterator()) {
|
||||
|
||||
@@ -126,11 +126,11 @@ public class InputDataOperationTest {
|
||||
.thenReturn(fakeOutputUri1, fakeOutputUri2);
|
||||
|
||||
// application which returns mockresolver
|
||||
Application spyApplication = spy(RuntimeEnvironment.application);
|
||||
Application spyApplication = spy(RuntimeEnvironment.getApplication());
|
||||
when(spyApplication.getContentResolver()).thenReturn(mockResolver);
|
||||
|
||||
InputDataOperation op = new InputDataOperation(spyApplication,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputDataParcel input = InputDataParcel.createInputDataParcel(fakeInputUri, null);
|
||||
|
||||
@@ -306,11 +306,11 @@ public class InputDataOperationTest {
|
||||
.thenReturn(fakeOutputUri1);
|
||||
|
||||
// application which returns mockresolver
|
||||
Application spyApplication = spy(RuntimeEnvironment.application);
|
||||
Application spyApplication = spy(RuntimeEnvironment.getApplication());
|
||||
when(spyApplication.getContentResolver()).thenReturn(mockResolver);
|
||||
|
||||
InputDataOperation op = new InputDataOperation(spyApplication,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputDataParcel input = InputDataParcel.createInputDataParcel(FAKE_CONTENT_INPUT_URI_1, null);
|
||||
return op.execute(input, CryptoInputParcel.createCryptoInputParcel());
|
||||
|
||||
@@ -148,7 +148,7 @@ public class PgpEncryptDecryptTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
// don't log verbosely here, we're not here to test imports
|
||||
ShadowLog.stream = oldShadowStream;
|
||||
@@ -171,8 +171,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(plaintext.getBytes());
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
@@ -195,8 +195,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(ciphertext);
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
PgpDecryptVerifyInputParcel input = PgpDecryptVerifyInputParcel.builder()
|
||||
.setAllowSymmetricDecryption(true)
|
||||
.build();
|
||||
@@ -226,8 +226,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(ciphertext);
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
PgpDecryptVerifyInputParcel input = PgpDecryptVerifyInputParcel.builder()
|
||||
.setAllowSymmetricDecryption(true)
|
||||
.build();
|
||||
@@ -249,8 +249,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(ciphertext);
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
PgpDecryptVerifyInputParcel input = PgpDecryptVerifyInputParcel.builder()
|
||||
.setAllowSymmetricDecryption(true)
|
||||
.build();
|
||||
@@ -271,8 +271,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(ciphertext);
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
PgpDecryptVerifyInputParcel input = PgpDecryptVerifyInputParcel.builder().build();
|
||||
DecryptVerifyResult result = op.execute(input,
|
||||
CryptoInputParcel.createCryptoInputParcel(), data, out);
|
||||
@@ -297,8 +297,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(plaintext.getBytes());
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
@@ -352,8 +352,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(plaintext.getBytes());
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
@@ -413,8 +413,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(plaintext.getBytes());
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
@@ -470,8 +470,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(plaintext.getBytes());
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
@@ -572,8 +572,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(plaintext.getBytes());
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
@@ -624,11 +624,11 @@ public class PgpEncryptDecryptTest {
|
||||
CryptoInputParcel.createCryptoInputParcel(new Date(), mKeyPhrase1));
|
||||
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
databaseInteractor.saveSecretKeyRing(modified);
|
||||
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
PgpDecryptVerifyInputParcel input = PgpDecryptVerifyInputParcel.builder()
|
||||
.setInputBytes(ciphertext)
|
||||
.build();
|
||||
@@ -649,11 +649,11 @@ public class PgpEncryptDecryptTest {
|
||||
CryptoInputParcel.createCryptoInputParcel(new Date(), mKeyPhrase1));
|
||||
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
databaseInteractor.saveSecretKeyRing(modified);
|
||||
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
PgpDecryptVerifyInputParcel input = PgpDecryptVerifyInputParcel.builder()
|
||||
.setInputBytes(ciphertext)
|
||||
.build();
|
||||
@@ -680,7 +680,7 @@ public class PgpEncryptDecryptTest {
|
||||
CryptoInputParcel.createCryptoInputParcel(new Date(), mKeyPhrase1));
|
||||
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
databaseInteractor.saveSecretKeyRing(modified);
|
||||
}
|
||||
|
||||
@@ -689,8 +689,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(plaintext.getBytes());
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
@@ -733,8 +733,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(plaintext.getBytes());
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
@@ -829,7 +829,7 @@ public class PgpEncryptDecryptTest {
|
||||
{ // decryption with passphrase cached should succeed for the other key if first is gone
|
||||
|
||||
// delete first key from database
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application).deleteKeyRing(mStaticRing1.getMasterKeyId());
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()).deleteKeyRing(mStaticRing1.getMasterKeyId());
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(ciphertext);
|
||||
@@ -861,8 +861,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(plaintext.getBytes());
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
@@ -908,7 +908,7 @@ public class PgpEncryptDecryptTest {
|
||||
{ // decryption with passphrase cached should succeed for the other key if first is gone
|
||||
|
||||
// delete first key from database
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application).deleteKeyRing(mStaticRing1.getMasterKeyId());
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()).deleteKeyRing(mStaticRing1.getMasterKeyId());
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(ciphertext);
|
||||
@@ -944,8 +944,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(plaindata);
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
@@ -1081,8 +1081,8 @@ public class PgpEncryptDecryptTest {
|
||||
private PgpDecryptVerifyOperation operationWithFakePassphraseCache(
|
||||
final Passphrase passphrase, final Long checkMasterKeyId, final Long checkSubKeyId) {
|
||||
|
||||
return new PgpDecryptVerifyOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application), null) {
|
||||
return new PgpDecryptVerifyOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication()), null) {
|
||||
@Override
|
||||
public Passphrase getCachedPassphrase(long masterKeyId, long subKeyId)
|
||||
throws NoSecretKeyException {
|
||||
@@ -1112,8 +1112,8 @@ public class PgpEncryptDecryptTest {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream("dies ist ein plaintext ☭".getBytes());
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.application,
|
||||
KeyWritableRepository.createDatabaseReadWriteInteractor(RuntimeEnvironment.application), null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(RuntimeEnvironment.getApplication(),
|
||||
KeyWritableRepository.createDatabaseReadWriteInteractor(RuntimeEnvironment.getApplication()), null);
|
||||
|
||||
InputData data = new InputData(in, in.available());
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class Cv25519Test {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
context = RuntimeEnvironment.application;
|
||||
context = RuntimeEnvironment.getApplication();
|
||||
keyRepository = KeyWritableRepository.create(context);
|
||||
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class EddsaTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
context = RuntimeEnvironment.application;
|
||||
context = RuntimeEnvironment.getApplication();
|
||||
keyRepository = KeyWritableRepository.create(context);
|
||||
|
||||
}
|
||||
|
||||
@@ -228,14 +228,14 @@ public class InteropTest {
|
||||
|
||||
private PgpDecryptVerifyOperation makeOperation(final String msg, final Passphrase passphrase,
|
||||
UncachedKeyRing decrypt, UncachedKeyRing verify) {
|
||||
KeyWritableRepository keyRepository = KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository keyRepository = KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
Assert.assertTrue(keyRepository.saveSecretKeyRing(decrypt).success());
|
||||
if (verify != null) {
|
||||
Assert.assertTrue(keyRepository.savePublicKeyRing(verify).success());
|
||||
}
|
||||
|
||||
return new PgpDecryptVerifyOperation(RuntimeEnvironment.application, keyRepository, null) {
|
||||
return new PgpDecryptVerifyOperation(RuntimeEnvironment.getApplication(), keyRepository, null) {
|
||||
@Override
|
||||
public Passphrase getCachedPassphrase(long masterKeyId, long subKeyId) {
|
||||
Assert.assertEquals(msg + ": passphrase should be for the secret key",
|
||||
|
||||
@@ -34,14 +34,14 @@ public class KeyRepositoryKeyringTest {
|
||||
|
||||
@Test
|
||||
public void testSavePublicKeyring() throws Exception {
|
||||
Assert.assertTrue(new KeyringTestingHelper(RuntimeEnvironment.application).addKeyring(Collections.singleton(
|
||||
Assert.assertTrue(new KeyringTestingHelper(RuntimeEnvironment.getApplication()).addKeyring(Collections.singleton(
|
||||
"/public-key-for-sample.blob"
|
||||
)));
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void testSavePublicKeyringRsa() throws Exception {
|
||||
Assert.assertTrue(new KeyringTestingHelper(RuntimeEnvironment.application).addKeyring(prependResourcePath(Arrays.asList(
|
||||
Assert.assertTrue(new KeyringTestingHelper(RuntimeEnvironment.getApplication()).addKeyring(prependResourcePath(Arrays.asList(
|
||||
"000001-006.public_key",
|
||||
"000002-013.user_id",
|
||||
"000003-002.sig",
|
||||
@@ -62,7 +62,7 @@ public class KeyRepositoryKeyringTest {
|
||||
|
||||
// @Test
|
||||
public void testSavePublicKeyringDsa() throws Exception {
|
||||
Assert.assertTrue(new KeyringTestingHelper(RuntimeEnvironment.application).addKeyring(prependResourcePath(Arrays.asList(
|
||||
Assert.assertTrue(new KeyringTestingHelper(RuntimeEnvironment.getApplication()).addKeyring(prependResourcePath(Arrays.asList(
|
||||
"000016-006.public_key",
|
||||
"000017-002.sig",
|
||||
"000018-012.ring_trust",
|
||||
@@ -79,7 +79,7 @@ public class KeyRepositoryKeyringTest {
|
||||
|
||||
// @Test
|
||||
public void testSavePublicKeyringDsa2() throws Exception {
|
||||
Assert.assertTrue(new KeyringTestingHelper(RuntimeEnvironment.application).addKeyring(prependResourcePath(Arrays.asList(
|
||||
Assert.assertTrue(new KeyringTestingHelper(RuntimeEnvironment.getApplication()).addKeyring(prependResourcePath(Arrays.asList(
|
||||
"000027-006.public_key",
|
||||
"000028-002.sig",
|
||||
"000029-012.ring_trust",
|
||||
|
||||
@@ -47,7 +47,7 @@ import java.util.Iterator;
|
||||
public class KeyRepositorySaveTest {
|
||||
|
||||
KeyWritableRepository mDatabaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpOnce() {
|
||||
@@ -65,9 +65,9 @@ public class KeyRepositorySaveTest {
|
||||
SaveKeyringResult result;
|
||||
|
||||
// insert both keys, second should fail
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.application).savePublicKeyRing(first);
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.getApplication()).savePublicKeyRing(first);
|
||||
Assert.assertTrue("first keyring import should succeed", result.success());
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.application).savePublicKeyRing(second);
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.getApplication()).savePublicKeyRing(second);
|
||||
Assert.assertFalse("second keyring import should fail", result.success());
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ public class KeyRepositorySaveTest {
|
||||
|
||||
SaveKeyringResult result;
|
||||
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.application).savePublicKeyRing(second);
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.getApplication()).savePublicKeyRing(second);
|
||||
Assert.assertTrue("first keyring import should succeed", result.success());
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.application).savePublicKeyRing(first);
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.getApplication()).savePublicKeyRing(first);
|
||||
Assert.assertFalse("second keyring import should fail", result.success());
|
||||
|
||||
}
|
||||
@@ -102,14 +102,14 @@ public class KeyRepositorySaveTest {
|
||||
SaveKeyringResult result;
|
||||
|
||||
// insert secret, this should fail because of missing self-cert
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.application)
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.getApplication())
|
||||
.saveSecretKeyRing(seckey);
|
||||
Assert.assertFalse("secret keyring import before pubring import should fail", result.success());
|
||||
|
||||
// insert pubkey, then seckey - both should succeed
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.application).savePublicKeyRing(pubkey);
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.getApplication()).savePublicKeyRing(pubkey);
|
||||
Assert.assertTrue("public keyring import should succeed", result.success());
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.application)
|
||||
result = KeyWritableRepository.create(RuntimeEnvironment.getApplication())
|
||||
.saveSecretKeyRing(seckey);
|
||||
Assert.assertTrue("secret keyring import after pubring import should succeed", result.success());
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class KeyRepositoryTest {
|
||||
testKeyring = KeyringTestingHelper.readRingFromResource("/test-keys/authenticate_multisub_with_revoked.asc");
|
||||
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
databaseInteractor.saveSecretKeyRing(testKeyring);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class KeyRepositoryTest {
|
||||
long expectedEncryptSubKeyId = KeyFormattingUtils.convertKeyIdHexToKeyId("0xDA7207E385A44339");
|
||||
long expectedSignSubKeyId = KeyFormattingUtils.convertKeyIdHexToKeyId("0xB8ECA89E054028D5");
|
||||
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application);
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
long masterKeyId = testKeyring.getMasterKeyId();
|
||||
long authSubKeyId = keyRepository.getEffectiveAuthenticationKeyId(masterKeyId);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class KeychainExternalProviderTest {
|
||||
public void setUp() throws Exception {
|
||||
ShadowLog.stream = System.out;
|
||||
|
||||
ShadowPackageManager packageManager = shadowOf(RuntimeEnvironment.application.getPackageManager());
|
||||
ShadowPackageManager packageManager = shadowOf(RuntimeEnvironment.getApplication().getPackageManager());
|
||||
packageManager.setPackagesForUid(PACKAGE_UID, PACKAGE_NAME);
|
||||
PackageInfo packageInfo = new PackageInfo();
|
||||
packageInfo.signatures = new Signature[] { new Signature(PACKAGE_SIGNATURE) };
|
||||
@@ -81,9 +81,9 @@ public class KeychainExternalProviderTest {
|
||||
info.authority = KeychainExternalContract.CONTENT_AUTHORITY_EXTERNAL;
|
||||
Robolectric.buildContentProvider(KeychainExternalProvider.class).create(info);
|
||||
|
||||
apiAppDao = ApiAppDao.getInstance(RuntimeEnvironment.application);
|
||||
apiPermissionHelper = new ApiPermissionHelper(RuntimeEnvironment.application, apiAppDao);
|
||||
autocryptPeerDao = AutocryptPeerDao.getInstance(RuntimeEnvironment.application);
|
||||
apiAppDao = ApiAppDao.getInstance(RuntimeEnvironment.getApplication());
|
||||
apiPermissionHelper = new ApiPermissionHelper(RuntimeEnvironment.getApplication(), apiAppDao);
|
||||
autocryptPeerDao = AutocryptPeerDao.getInstance(RuntimeEnvironment.getApplication());
|
||||
|
||||
apiAppDao.insertApiApp(PACKAGE_NAME, PACKAGE_SIGNATURE);
|
||||
}
|
||||
@@ -329,7 +329,7 @@ public class KeychainExternalProviderTest {
|
||||
certifyActionsParcel.addAction(
|
||||
CertifyAction.createForUserIds(publicMasterKeyId, Collections.singletonList(userId)));
|
||||
CertifyOperation op = new CertifyOperation(
|
||||
RuntimeEnvironment.application, databaseInteractor, new ProgressScaler(), null);
|
||||
RuntimeEnvironment.getApplication(), databaseInteractor, new ProgressScaler(), null);
|
||||
CertifyResult certifyResult = op.execute(certifyActionsParcel.build(), CryptoInputParcel.createCryptoInputParcel());
|
||||
|
||||
assertTrue(certifyResult.success());
|
||||
|
||||
@@ -70,7 +70,7 @@ public class SecurityTokenConnectionTest {
|
||||
"c59cd0f2a59cd0af059cd0c959000"); // get application related data
|
||||
|
||||
|
||||
securityTokenConnection.connectToDevice(RuntimeEnvironment.application);
|
||||
securityTokenConnection.connectToDevice(RuntimeEnvironment.getApplication());
|
||||
|
||||
|
||||
verify(transport).connect();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SshPublicKeyTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.create(RuntimeEnvironment.application);
|
||||
KeyWritableRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
// don't log verbosely here, we're not here to test imports
|
||||
ShadowLog.stream = oldShadowStream;
|
||||
@@ -73,7 +73,7 @@ public class SshPublicKeyTest {
|
||||
|
||||
@Test
|
||||
public void testECDSA() throws Exception {
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application);
|
||||
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.getApplication());
|
||||
|
||||
long masterKeyId = mStaticRingEcDsa.getMasterKeyId();
|
||||
long authSubKeyId = keyRepository.getEffectiveAuthenticationKeyId(masterKeyId);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ParcelableFileCacheTest {
|
||||
@Test
|
||||
public void testInputOutput() throws Exception {
|
||||
|
||||
ParcelableFileCache<Bundle> cache = new ParcelableFileCache<Bundle>(RuntimeEnvironment.application, "test.pcl");
|
||||
ParcelableFileCache<Bundle> cache = new ParcelableFileCache<Bundle>(RuntimeEnvironment.getApplication(), "test.pcl");
|
||||
|
||||
ArrayList<Bundle> list = new ArrayList<Bundle>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user