Avoid code duplication
This commit is contained in:
parent
b04ee7153a
commit
01597a89dc
|
@ -25,11 +25,10 @@ import im.vector.matrix.android.api.session.Session
|
||||||
import im.vector.matrix.android.api.session.securestorage.Curve25519AesSha2KeySpec
|
import im.vector.matrix.android.api.session.securestorage.Curve25519AesSha2KeySpec
|
||||||
import im.vector.matrix.android.api.session.securestorage.EncryptedSecretContent
|
import im.vector.matrix.android.api.session.securestorage.EncryptedSecretContent
|
||||||
import im.vector.matrix.android.api.session.securestorage.KeySigner
|
import im.vector.matrix.android.api.session.securestorage.KeySigner
|
||||||
import im.vector.matrix.android.api.session.securestorage.SsssKeyCreationInfo
|
|
||||||
import im.vector.matrix.android.api.session.securestorage.SecretStorageKeyContent
|
import im.vector.matrix.android.api.session.securestorage.SecretStorageKeyContent
|
||||||
|
import im.vector.matrix.android.api.session.securestorage.SsssKeyCreationInfo
|
||||||
import im.vector.matrix.android.api.util.Optional
|
import im.vector.matrix.android.api.util.Optional
|
||||||
import im.vector.matrix.android.common.CommonTestHelper
|
import im.vector.matrix.android.common.CommonTestHelper
|
||||||
import im.vector.matrix.android.common.CryptoTestHelper
|
|
||||||
import im.vector.matrix.android.common.SessionTestParams
|
import im.vector.matrix.android.common.SessionTestParams
|
||||||
import im.vector.matrix.android.common.TestConstants
|
import im.vector.matrix.android.common.TestConstants
|
||||||
import im.vector.matrix.android.common.TestMatrixCallback
|
import im.vector.matrix.android.common.TestMatrixCallback
|
||||||
|
@ -50,11 +49,16 @@ import org.junit.runners.MethodSorters
|
||||||
import java.util.concurrent.CountDownLatch
|
import java.util.concurrent.CountDownLatch
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.JVM)
|
||||||
class QuadSTests : InstrumentedTest {
|
class QuadSTests : InstrumentedTest {
|
||||||
|
|
||||||
private val mTestHelper = CommonTestHelper(context())
|
private val mTestHelper = CommonTestHelper(context())
|
||||||
private val mCryptoTestHelper = CryptoTestHelper(mTestHelper)
|
|
||||||
|
private val emptyKeySigner = object : KeySigner {
|
||||||
|
override fun sign(canonicalJson: String): Map<String, Map<String, String>>? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun test_Generate4SKey() {
|
fun test_Generate4SKey() {
|
||||||
|
@ -64,12 +68,6 @@ class QuadSTests : InstrumentedTest {
|
||||||
|
|
||||||
val quadS = aliceSession.sharedSecretStorageService
|
val quadS = aliceSession.sharedSecretStorageService
|
||||||
|
|
||||||
val emptyKeySigner = object : KeySigner {
|
|
||||||
override fun sign(canonicalJson: String): Map<String, Map<String, String>>? {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var recoveryKey: String? = null
|
var recoveryKey: String? = null
|
||||||
|
|
||||||
val TEST_KEY_ID = "my.test.Key"
|
val TEST_KEY_ID = "my.test.Key"
|
||||||
|
@ -207,12 +205,6 @@ class QuadSTests : InstrumentedTest {
|
||||||
|
|
||||||
val quadS = aliceSession.sharedSecretStorageService
|
val quadS = aliceSession.sharedSecretStorageService
|
||||||
|
|
||||||
val emptyKeySigner = object : KeySigner {
|
|
||||||
override fun sign(canonicalJson: String): Map<String, Map<String, String>>? {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val TEST_KEY_ID = "my.test.Key"
|
val TEST_KEY_ID = "my.test.Key"
|
||||||
|
|
||||||
val countDownLatch = CountDownLatch(1)
|
val countDownLatch = CountDownLatch(1)
|
||||||
|
@ -354,12 +346,6 @@ class QuadSTests : InstrumentedTest {
|
||||||
private fun generatedSecret(session: Session, keyId: String, asDefault: Boolean = true): SsssKeyCreationInfo {
|
private fun generatedSecret(session: Session, keyId: String, asDefault: Boolean = true): SsssKeyCreationInfo {
|
||||||
val quadS = session.sharedSecretStorageService
|
val quadS = session.sharedSecretStorageService
|
||||||
|
|
||||||
val emptyKeySigner = object : KeySigner {
|
|
||||||
override fun sign(canonicalJson: String): Map<String, Map<String, String>>? {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var creationInfo: SsssKeyCreationInfo? = null
|
var creationInfo: SsssKeyCreationInfo? = null
|
||||||
|
|
||||||
val generateLatch = CountDownLatch(1)
|
val generateLatch = CountDownLatch(1)
|
||||||
|
@ -395,12 +381,6 @@ class QuadSTests : InstrumentedTest {
|
||||||
private fun generatedSecretFromPassphrase(session: Session, passphrase: String, keyId: String, asDefault: Boolean = true): SsssKeyCreationInfo {
|
private fun generatedSecretFromPassphrase(session: Session, passphrase: String, keyId: String, asDefault: Boolean = true): SsssKeyCreationInfo {
|
||||||
val quadS = session.sharedSecretStorageService
|
val quadS = session.sharedSecretStorageService
|
||||||
|
|
||||||
val emptyKeySigner = object : KeySigner {
|
|
||||||
override fun sign(canonicalJson: String): Map<String, Map<String, String>>? {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var creationInfo: SsssKeyCreationInfo? = null
|
var creationInfo: SsssKeyCreationInfo? = null
|
||||||
|
|
||||||
val generateLatch = CountDownLatch(1)
|
val generateLatch = CountDownLatch(1)
|
||||||
|
|
Loading…
Reference in New Issue