Make the tests compile and pass
This commit is contained in:
parent
2a774833ec
commit
3425dd0a63
@ -33,7 +33,6 @@ import im.vector.matrix.android.common.CommonTestHelper
|
|||||||
import im.vector.matrix.android.common.CryptoTestHelper
|
import im.vector.matrix.android.common.CryptoTestHelper
|
||||||
import im.vector.matrix.android.internal.crypto.model.CryptoDeviceInfo
|
import im.vector.matrix.android.internal.crypto.model.CryptoDeviceInfo
|
||||||
import im.vector.matrix.android.internal.crypto.model.MXUsersDevicesMap
|
import im.vector.matrix.android.internal.crypto.model.MXUsersDevicesMap
|
||||||
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationAccept
|
|
||||||
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationCancel
|
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationCancel
|
||||||
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationStart
|
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationStart
|
||||||
import im.vector.matrix.android.internal.crypto.model.rest.toValue
|
import im.vector.matrix.android.internal.crypto.model.rest.toValue
|
||||||
@ -350,16 +349,16 @@ class SASTest : InstrumentedTest {
|
|||||||
val aliceVerificationService = aliceSession.cryptoService().verificationService()
|
val aliceVerificationService = aliceSession.cryptoService().verificationService()
|
||||||
val bobVerificationService = bobSession!!.cryptoService().verificationService()
|
val bobVerificationService = bobSession!!.cryptoService().verificationService()
|
||||||
|
|
||||||
var accepted: KeyVerificationAccept? = null
|
var accepted: ValidVerificationInfoAccept? = null
|
||||||
var startReq: KeyVerificationStart? = null
|
var startReq: ValidVerificationInfoStart.SasVerificationInfoStart? = null
|
||||||
|
|
||||||
val aliceAcceptedLatch = CountDownLatch(1)
|
val aliceAcceptedLatch = CountDownLatch(1)
|
||||||
val aliceListener = object : VerificationService.Listener {
|
val aliceListener = object : VerificationService.Listener {
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
if ((tx as SASDefaultVerificationTransaction).state === VerificationTxState.OnAccepted) {
|
if ((tx as SASDefaultVerificationTransaction).state === VerificationTxState.OnAccepted) {
|
||||||
val at = tx as SASDefaultVerificationTransaction
|
val at = tx as SASDefaultVerificationTransaction
|
||||||
accepted = at.accepted as? KeyVerificationAccept
|
accepted = at.accepted
|
||||||
startReq = at.startReq as? KeyVerificationStart
|
startReq = at.startReq
|
||||||
aliceAcceptedLatch.countDown()
|
aliceAcceptedLatch.countDown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,13 +383,13 @@ class SASTest : InstrumentedTest {
|
|||||||
assertTrue("Should have receive a commitment", accepted!!.commitment?.trim()?.isEmpty() == false)
|
assertTrue("Should have receive a commitment", accepted!!.commitment?.trim()?.isEmpty() == false)
|
||||||
|
|
||||||
// check that agreement is valid
|
// check that agreement is valid
|
||||||
assertTrue("Agreed Protocol should be Valid", accepted!!.isValid())
|
assertTrue("Agreed Protocol should be Valid", accepted != null)
|
||||||
assertTrue("Agreed Protocol should be known by alice", startReq!!.keyAgreementProtocols!!.contains(accepted!!.keyAgreementProtocol))
|
assertTrue("Agreed Protocol should be known by alice", startReq!!.keyAgreementProtocols.contains(accepted!!.keyAgreementProtocol))
|
||||||
assertTrue("Hash should be known by alice", startReq!!.hashes!!.contains(accepted!!.hash))
|
assertTrue("Hash should be known by alice", startReq!!.hashes.contains(accepted!!.hash))
|
||||||
assertTrue("Hash should be known by alice", startReq!!.messageAuthenticationCodes!!.contains(accepted!!.messageAuthenticationCode))
|
assertTrue("Hash should be known by alice", startReq!!.messageAuthenticationCodes.contains(accepted!!.messageAuthenticationCode))
|
||||||
|
|
||||||
accepted!!.shortAuthenticationStrings?.forEach {
|
accepted!!.shortAuthenticationStrings.forEach {
|
||||||
assertTrue("all agreed Short Code should be known by alice", startReq!!.shortAuthenticationStrings!!.contains(it))
|
assertTrue("all agreed Short Code should be known by alice", startReq!!.shortAuthenticationStrings.contains(it))
|
||||||
}
|
}
|
||||||
|
|
||||||
cryptoTestData.cleanUp(mTestHelper)
|
cryptoTestData.cleanUp(mTestHelper)
|
||||||
|
@ -90,8 +90,10 @@ internal abstract class SASDefaultVerificationTransaction(
|
|||||||
|
|
||||||
private var olmSas: OlmSAS? = null
|
private var olmSas: OlmSAS? = null
|
||||||
|
|
||||||
protected var startReq: ValidVerificationInfoStart.SasVerificationInfoStart? = null
|
// Visible for test
|
||||||
protected var accepted: ValidVerificationInfoAccept? = null
|
var startReq: ValidVerificationInfoStart.SasVerificationInfoStart? = null
|
||||||
|
// Visible for test
|
||||||
|
var accepted: ValidVerificationInfoAccept? = null
|
||||||
protected var otherKey: String? = null
|
protected var otherKey: String? = null
|
||||||
protected var shortCodeBytes: ByteArray? = null
|
protected var shortCodeBytes: ByteArray? = null
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user