Fix ktlint issues
This commit is contained in:
parent
ed773dbb96
commit
35f011ba37
|
@ -50,7 +50,6 @@ class CommonTestHelper(context: Context) {
|
||||||
matrix = Matrix.getInstance(context)
|
matrix = Matrix.getInstance(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun createAccount(userNamePrefix: String, testParams: SessionTestParams): Session {
|
fun createAccount(userNamePrefix: String, testParams: SessionTestParams): Session {
|
||||||
return createAccount(userNamePrefix, TestConstants.PASSWORD, testParams)
|
return createAccount(userNamePrefix, TestConstants.PASSWORD, testParams)
|
||||||
}
|
}
|
||||||
|
@ -74,7 +73,7 @@ class CommonTestHelper(context: Context) {
|
||||||
* @param session the session to sync
|
* @param session the session to sync
|
||||||
*/
|
*/
|
||||||
fun syncSession(session: Session) {
|
fun syncSession(session: Session) {
|
||||||
//val lock = CountDownLatch(1)
|
// val lock = CountDownLatch(1)
|
||||||
|
|
||||||
// val observer = androidx.lifecycle.Observer<SyncState> { syncState ->
|
// val observer = androidx.lifecycle.Observer<SyncState> { syncState ->
|
||||||
// if (syncState is SyncState.Idle) {
|
// if (syncState is SyncState.Idle) {
|
||||||
|
@ -89,8 +88,8 @@ class CommonTestHelper(context: Context) {
|
||||||
|
|
||||||
session.open()
|
session.open()
|
||||||
session.startSync(true)
|
session.startSync(true)
|
||||||
//await(lock)
|
// await(lock)
|
||||||
//session.syncState().removeObserver(observer)
|
// session.syncState().removeObserver(observer)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,7 +128,6 @@ class CommonTestHelper(context: Context) {
|
||||||
return sentEvents
|
return sentEvents
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// PRIVATE METHODS *****************************************************************************
|
// PRIVATE METHODS *****************************************************************************
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package im.vector.matrix.android.common
|
package im.vector.matrix.android.common
|
||||||
|
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import android.text.TextUtils
|
|
||||||
import im.vector.matrix.android.api.session.Session
|
import im.vector.matrix.android.api.session.Session
|
||||||
import im.vector.matrix.android.api.session.events.model.Event
|
import im.vector.matrix.android.api.session.events.model.Event
|
||||||
import im.vector.matrix.android.api.session.events.model.EventType
|
import im.vector.matrix.android.api.session.events.model.EventType
|
||||||
|
|
|
@ -41,7 +41,6 @@ class MockOkHttpInterceptor : Interceptor {
|
||||||
|
|
||||||
private var rules: ArrayList<Rule> = ArrayList()
|
private var rules: ArrayList<Rule> = ArrayList()
|
||||||
|
|
||||||
|
|
||||||
fun addRule(rule: Rule) {
|
fun addRule(rule: Rule) {
|
||||||
rules.add(rule)
|
rules.add(rule)
|
||||||
}
|
}
|
||||||
|
@ -60,7 +59,6 @@ class MockOkHttpInterceptor : Interceptor {
|
||||||
return chain.proceed(originalRequest)
|
return chain.proceed(originalRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
abstract class Rule(val match: String) {
|
abstract class Rule(val match: String) {
|
||||||
abstract fun process(originalRequest: Request): Response?
|
abstract fun process(originalRequest: Request): Response?
|
||||||
}
|
}
|
||||||
|
@ -81,6 +79,5 @@ class MockOkHttpInterceptor : Interceptor {
|
||||||
.code(code)
|
.code(code)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package im.vector.matrix.android.internal.crypto
|
package im.vector.matrix.android.internal.crypto
|
||||||
|
|
||||||
|
|
||||||
import android.os.MemoryFile
|
import android.os.MemoryFile
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
|
@ -150,7 +150,6 @@ class KeysBackupTest : InstrumentedTest {
|
||||||
var megolmBackupCreationInfo: MegolmBackupCreationInfo? = null
|
var megolmBackupCreationInfo: MegolmBackupCreationInfo? = null
|
||||||
val latch = CountDownLatch(1)
|
val latch = CountDownLatch(1)
|
||||||
keysBackup.prepareKeysBackupVersion(null, null, object : MatrixCallback<MegolmBackupCreationInfo> {
|
keysBackup.prepareKeysBackupVersion(null, null, object : MatrixCallback<MegolmBackupCreationInfo> {
|
||||||
|
|
||||||
override fun onSuccess(data: MegolmBackupCreationInfo) {
|
override fun onSuccess(data: MegolmBackupCreationInfo) {
|
||||||
megolmBackupCreationInfo = data
|
megolmBackupCreationInfo = data
|
||||||
|
|
||||||
|
@ -210,7 +209,6 @@ class KeysBackupTest : InstrumentedTest {
|
||||||
|
|
||||||
mTestHelper.await(latch)
|
mTestHelper.await(latch)
|
||||||
|
|
||||||
|
|
||||||
val nbOfKeys = cryptoTestData.firstSession.inboundGroupSessionsCount(false)
|
val nbOfKeys = cryptoTestData.firstSession.inboundGroupSessionsCount(false)
|
||||||
val backedUpKeys = cryptoTestData.firstSession.inboundGroupSessionsCount(true)
|
val backedUpKeys = cryptoTestData.firstSession.inboundGroupSessionsCount(true)
|
||||||
|
|
||||||
|
@ -230,7 +228,6 @@ class KeysBackupTest : InstrumentedTest {
|
||||||
cryptoTestData.close()
|
cryptoTestData.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that backupAllGroupSessions() returns valid data
|
* Check that backupAllGroupSessions() returns valid data
|
||||||
*/
|
*/
|
||||||
|
@ -258,7 +255,6 @@ class KeysBackupTest : InstrumentedTest {
|
||||||
assertEquals(nbOfKeys, total)
|
assertEquals(nbOfKeys, total)
|
||||||
lastBackedUpKeysProgress = progress
|
lastBackedUpKeysProgress = progress
|
||||||
}
|
}
|
||||||
|
|
||||||
}, TestMatrixCallback(latch))
|
}, TestMatrixCallback(latch))
|
||||||
|
|
||||||
mTestHelper.await(latch)
|
mTestHelper.await(latch)
|
||||||
|
@ -400,7 +396,6 @@ class KeysBackupTest : InstrumentedTest {
|
||||||
testData.cryptoTestData.close()
|
testData.cryptoTestData.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* - Do an e2e backup to the homeserver with a recovery key
|
* - Do an e2e backup to the homeserver with a recovery key
|
||||||
* - And log Alice on a new device
|
* - And log Alice on a new device
|
||||||
|
@ -1081,7 +1076,6 @@ class KeysBackupTest : InstrumentedTest {
|
||||||
keysBackup.backupAllGroupSessions(object : ProgressListener {
|
keysBackup.backupAllGroupSessions(object : ProgressListener {
|
||||||
override fun onProgress(progress: Int, total: Int) {
|
override fun onProgress(progress: Int, total: Int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}, TestMatrixCallback(latch2, false))
|
}, TestMatrixCallback(latch2, false))
|
||||||
mTestHelper.await(latch2)
|
mTestHelper.await(latch2)
|
||||||
|
|
||||||
|
@ -1121,7 +1115,6 @@ class KeysBackupTest : InstrumentedTest {
|
||||||
val latch = CountDownLatch(1)
|
val latch = CountDownLatch(1)
|
||||||
keysBackup.backupAllGroupSessions(object : ProgressListener {
|
keysBackup.backupAllGroupSessions(object : ProgressListener {
|
||||||
override fun onProgress(progress: Int, total: Int) {
|
override fun onProgress(progress: Int, total: Int) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}, TestMatrixCallback(latch))
|
}, TestMatrixCallback(latch))
|
||||||
mTestHelper.await(latch)
|
mTestHelper.await(latch)
|
||||||
|
@ -1153,7 +1146,6 @@ class KeysBackupTest : InstrumentedTest {
|
||||||
keysBackup2.backupAllGroupSessions(object : ProgressListener {
|
keysBackup2.backupAllGroupSessions(object : ProgressListener {
|
||||||
override fun onProgress(progress: Int, total: Int) {
|
override fun onProgress(progress: Int, total: Int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}, object : TestMatrixCallback<Unit>(latch2, false) {
|
}, object : TestMatrixCallback<Unit>(latch2, false) {
|
||||||
override fun onSuccess(data: Unit) {
|
override fun onSuccess(data: Unit) {
|
||||||
isSuccessful = true
|
isSuccessful = true
|
||||||
|
@ -1274,7 +1266,6 @@ class KeysBackupTest : InstrumentedTest {
|
||||||
var megolmBackupCreationInfo: MegolmBackupCreationInfo? = null
|
var megolmBackupCreationInfo: MegolmBackupCreationInfo? = null
|
||||||
val latch = CountDownLatch(1)
|
val latch = CountDownLatch(1)
|
||||||
keysBackup.prepareKeysBackupVersion(password, null, object : MatrixCallback<MegolmBackupCreationInfo> {
|
keysBackup.prepareKeysBackupVersion(password, null, object : MatrixCallback<MegolmBackupCreationInfo> {
|
||||||
|
|
||||||
override fun onSuccess(data: MegolmBackupCreationInfo) {
|
override fun onSuccess(data: MegolmBackupCreationInfo) {
|
||||||
megolmBackupCreationInfo = data
|
megolmBackupCreationInfo = data
|
||||||
|
|
||||||
|
|
|
@ -88,13 +88,12 @@ class SASTest : InstrumentedTest {
|
||||||
assertEquals("Alice state should be started", SasVerificationTxState.Started, aliceSasTx!!.state)
|
assertEquals("Alice state should be started", SasVerificationTxState.Started, aliceSasTx!!.state)
|
||||||
assertEquals("Bob state should be started by alice", SasVerificationTxState.OnStarted, bobSasTx!!.state)
|
assertEquals("Bob state should be started by alice", SasVerificationTxState.OnStarted, bobSasTx!!.state)
|
||||||
|
|
||||||
//Let's cancel from alice side
|
// Let's cancel from alice side
|
||||||
val cancelLatch = CountDownLatch(1)
|
val cancelLatch = CountDownLatch(1)
|
||||||
|
|
||||||
val bobListener2 = object : SasVerificationService.SasVerificationListener {
|
val bobListener2 = object : SasVerificationService.SasVerificationListener {
|
||||||
override fun transactionCreated(tx: SasVerificationTransaction) {}
|
override fun transactionCreated(tx: SasVerificationTransaction) {}
|
||||||
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: SasVerificationTransaction) {
|
override fun transactionUpdated(tx: SasVerificationTransaction) {
|
||||||
if (tx.transactionId == txID) {
|
if (tx.transactionId == txID) {
|
||||||
if ((tx as SASVerificationTransaction).state === SasVerificationTxState.OnCancelled) {
|
if ((tx as SASVerificationTransaction).state === SasVerificationTxState.OnCancelled) {
|
||||||
|
@ -135,7 +134,7 @@ class SASTest : InstrumentedTest {
|
||||||
val protocols = listOf("meh_dont_know")
|
val protocols = listOf("meh_dont_know")
|
||||||
val tid = "00000000"
|
val tid = "00000000"
|
||||||
|
|
||||||
//Bob should receive a cancel
|
// Bob should receive a cancel
|
||||||
var canceledToDeviceEvent: Event? = null
|
var canceledToDeviceEvent: Event? = null
|
||||||
val cancelLatch = CountDownLatch(1)
|
val cancelLatch = CountDownLatch(1)
|
||||||
// TODO bobSession!!.dataHandler.addListener(object : MXEventListener() {
|
// TODO bobSession!!.dataHandler.addListener(object : MXEventListener() {
|
||||||
|
@ -166,7 +165,6 @@ class SASTest : InstrumentedTest {
|
||||||
}
|
}
|
||||||
aliceSession.getSasVerificationService().addListener(aliceListener)
|
aliceSession.getSasVerificationService().addListener(aliceListener)
|
||||||
|
|
||||||
|
|
||||||
fakeBobStart(bobSession, aliceUserID, aliceDevice, tid, protocols = protocols)
|
fakeBobStart(bobSession, aliceUserID, aliceDevice, tid, protocols = protocols)
|
||||||
|
|
||||||
mTestHelper.await(cancelLatch)
|
mTestHelper.await(cancelLatch)
|
||||||
|
@ -175,7 +173,6 @@ class SASTest : InstrumentedTest {
|
||||||
assertEquals("Request should be cancelled with m.unknown_method", CancelCode.UnknownMethod.value, cancelReq.code)
|
assertEquals("Request should be cancelled with m.unknown_method", CancelCode.UnknownMethod.value, cancelReq.code)
|
||||||
|
|
||||||
cryptoTestData.close()
|
cryptoTestData.close()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -187,7 +184,7 @@ class SASTest : InstrumentedTest {
|
||||||
val mac = listOf("shaBit")
|
val mac = listOf("shaBit")
|
||||||
val tid = "00000000"
|
val tid = "00000000"
|
||||||
|
|
||||||
//Bob should receive a cancel
|
// Bob should receive a cancel
|
||||||
var canceledToDeviceEvent: Event? = null
|
var canceledToDeviceEvent: Event? = null
|
||||||
val cancelLatch = CountDownLatch(1)
|
val cancelLatch = CountDownLatch(1)
|
||||||
// TODO bobSession!!.dataHandler.addListener(object : MXEventListener() {
|
// TODO bobSession!!.dataHandler.addListener(object : MXEventListener() {
|
||||||
|
@ -213,7 +210,6 @@ class SASTest : InstrumentedTest {
|
||||||
assertEquals("Request should be cancelled with m.unknown_method", CancelCode.UnknownMethod.value, cancelReq.code)
|
assertEquals("Request should be cancelled with m.unknown_method", CancelCode.UnknownMethod.value, cancelReq.code)
|
||||||
|
|
||||||
cryptoTestData.close()
|
cryptoTestData.close()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -222,11 +218,10 @@ class SASTest : InstrumentedTest {
|
||||||
|
|
||||||
val bobSession = cryptoTestData.secondSession!!
|
val bobSession = cryptoTestData.secondSession!!
|
||||||
|
|
||||||
|
|
||||||
val codes = listOf("bin", "foo", "bar")
|
val codes = listOf("bin", "foo", "bar")
|
||||||
val tid = "00000000"
|
val tid = "00000000"
|
||||||
|
|
||||||
//Bob should receive a cancel
|
// Bob should receive a cancel
|
||||||
var canceledToDeviceEvent: Event? = null
|
var canceledToDeviceEvent: Event? = null
|
||||||
val cancelLatch = CountDownLatch(1)
|
val cancelLatch = CountDownLatch(1)
|
||||||
// TODO bobSession!!.dataHandler.addListener(object : MXEventListener() {
|
// TODO bobSession!!.dataHandler.addListener(object : MXEventListener() {
|
||||||
|
@ -252,7 +247,6 @@ class SASTest : InstrumentedTest {
|
||||||
assertEquals("Request should be cancelled with m.unknown_method", CancelCode.UnknownMethod.value, cancelReq.code)
|
assertEquals("Request should be cancelled with m.unknown_method", CancelCode.UnknownMethod.value, cancelReq.code)
|
||||||
|
|
||||||
cryptoTestData.close()
|
cryptoTestData.close()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fakeBobStart(bobSession: Session,
|
private fun fakeBobStart(bobSession: Session,
|
||||||
|
@ -284,8 +278,7 @@ class SASTest : InstrumentedTest {
|
||||||
// TODO )
|
// TODO )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// any two devices may only have at most one key verification in flight at a time.
|
||||||
//any two devices may only have at most one key verification in flight at a time.
|
|
||||||
// If a device has two verifications in progress with the same device, then it should cancel both verifications.
|
// If a device has two verifications in progress with the same device, then it should cancel both verifications.
|
||||||
@Test
|
@Test
|
||||||
fun test_aliceStartTwoRequests() {
|
fun test_aliceStartTwoRequests() {
|
||||||
|
@ -294,7 +287,6 @@ class SASTest : InstrumentedTest {
|
||||||
val aliceSession = cryptoTestData.firstSession
|
val aliceSession = cryptoTestData.firstSession
|
||||||
val bobSession = cryptoTestData.secondSession
|
val bobSession = cryptoTestData.secondSession
|
||||||
|
|
||||||
|
|
||||||
val aliceSasMgr = aliceSession.getSasVerificationService()
|
val aliceSasMgr = aliceSession.getSasVerificationService()
|
||||||
|
|
||||||
val aliceCreatedLatch = CountDownLatch(2)
|
val aliceCreatedLatch = CountDownLatch(2)
|
||||||
|
@ -343,7 +335,6 @@ class SASTest : InstrumentedTest {
|
||||||
var accepted: KeyVerificationAccept? = null
|
var accepted: KeyVerificationAccept? = null
|
||||||
var startReq: KeyVerificationStart? = null
|
var startReq: KeyVerificationStart? = null
|
||||||
|
|
||||||
|
|
||||||
val aliceAcceptedLatch = CountDownLatch(1)
|
val aliceAcceptedLatch = CountDownLatch(1)
|
||||||
val aliceListener = object : SasVerificationService.SasVerificationListener {
|
val aliceListener = object : SasVerificationService.SasVerificationListener {
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
||||||
|
@ -375,7 +366,6 @@ class SASTest : InstrumentedTest {
|
||||||
}
|
}
|
||||||
bobSasMgr.addListener(bobListener)
|
bobSasMgr.addListener(bobListener)
|
||||||
|
|
||||||
|
|
||||||
val bobUserId = bobSession.myUserId
|
val bobUserId = bobSession.myUserId
|
||||||
val bobDeviceId = bobSession.getMyDevice().deviceId
|
val bobDeviceId = bobSession.getMyDevice().deviceId
|
||||||
aliceSasMgr.beginKeyVerificationSAS(bobUserId, bobDeviceId)
|
aliceSasMgr.beginKeyVerificationSAS(bobUserId, bobDeviceId)
|
||||||
|
@ -383,7 +373,7 @@ 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!!.isValid())
|
||||||
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))
|
||||||
|
@ -406,7 +396,6 @@ class SASTest : InstrumentedTest {
|
||||||
val aliceSasMgr = aliceSession.getSasVerificationService()
|
val aliceSasMgr = aliceSession.getSasVerificationService()
|
||||||
val bobSasMgr = bobSession!!.getSasVerificationService()
|
val bobSasMgr = bobSession!!.getSasVerificationService()
|
||||||
|
|
||||||
|
|
||||||
val aliceSASLatch = CountDownLatch(1)
|
val aliceSASLatch = CountDownLatch(1)
|
||||||
val aliceListener = object : SasVerificationService.SasVerificationListener {
|
val aliceListener = object : SasVerificationService.SasVerificationListener {
|
||||||
override fun transactionCreated(tx: SasVerificationTransaction) {}
|
override fun transactionCreated(tx: SasVerificationTransaction) {}
|
||||||
|
@ -446,7 +435,6 @@ class SASTest : InstrumentedTest {
|
||||||
}
|
}
|
||||||
bobSasMgr.addListener(bobListener)
|
bobSasMgr.addListener(bobListener)
|
||||||
|
|
||||||
|
|
||||||
val bobUserId = bobSession.myUserId
|
val bobUserId = bobSession.myUserId
|
||||||
val bobDeviceId = bobSession.getMyDevice().deviceId
|
val bobDeviceId = bobSession.getMyDevice().deviceId
|
||||||
val verificationSAS = aliceSasMgr.beginKeyVerificationSAS(bobUserId, bobDeviceId)
|
val verificationSAS = aliceSasMgr.beginKeyVerificationSAS(bobUserId, bobDeviceId)
|
||||||
|
@ -462,7 +450,6 @@ class SASTest : InstrumentedTest {
|
||||||
cryptoTestData.close()
|
cryptoTestData.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun test_happyPath() {
|
fun test_happyPath() {
|
||||||
val cryptoTestData = mCryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
|
val cryptoTestData = mCryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
|
||||||
|
@ -473,7 +460,6 @@ class SASTest : InstrumentedTest {
|
||||||
val aliceSasMgr = aliceSession.getSasVerificationService()
|
val aliceSasMgr = aliceSession.getSasVerificationService()
|
||||||
val bobSasMgr = bobSession!!.getSasVerificationService()
|
val bobSasMgr = bobSession!!.getSasVerificationService()
|
||||||
|
|
||||||
|
|
||||||
val aliceSASLatch = CountDownLatch(1)
|
val aliceSASLatch = CountDownLatch(1)
|
||||||
val aliceListener = object : SasVerificationService.SasVerificationListener {
|
val aliceListener = object : SasVerificationService.SasVerificationListener {
|
||||||
override fun transactionCreated(tx: SasVerificationTransaction) {}
|
override fun transactionCreated(tx: SasVerificationTransaction) {}
|
||||||
|
@ -519,18 +505,17 @@ class SASTest : InstrumentedTest {
|
||||||
}
|
}
|
||||||
bobSasMgr.addListener(bobListener)
|
bobSasMgr.addListener(bobListener)
|
||||||
|
|
||||||
|
|
||||||
val bobUserId = bobSession.myUserId
|
val bobUserId = bobSession.myUserId
|
||||||
val bobDeviceId = bobSession.getMyDevice().deviceId
|
val bobDeviceId = bobSession.getMyDevice().deviceId
|
||||||
aliceSasMgr.beginKeyVerificationSAS(bobUserId, bobDeviceId)
|
aliceSasMgr.beginKeyVerificationSAS(bobUserId, bobDeviceId)
|
||||||
mTestHelper.await(aliceSASLatch)
|
mTestHelper.await(aliceSASLatch)
|
||||||
mTestHelper.await(bobSASLatch)
|
mTestHelper.await(bobSASLatch)
|
||||||
|
|
||||||
//Assert that devices are verified
|
// Assert that devices are verified
|
||||||
val bobDeviceInfoFromAlicePOV: MXDeviceInfo? = aliceSession.getDeviceInfo(bobUserId, bobDeviceId)
|
val bobDeviceInfoFromAlicePOV: MXDeviceInfo? = aliceSession.getDeviceInfo(bobUserId, bobDeviceId)
|
||||||
val aliceDeviceInfoFromBobPOV: MXDeviceInfo? = bobSession.getDeviceInfo(aliceSession.myUserId, aliceSession.getMyDevice().deviceId)
|
val aliceDeviceInfoFromBobPOV: MXDeviceInfo? = bobSession.getDeviceInfo(aliceSession.myUserId, aliceSession.getMyDevice().deviceId)
|
||||||
|
|
||||||
//latch wait a bit again
|
// latch wait a bit again
|
||||||
Thread.sleep(1000)
|
Thread.sleep(1000)
|
||||||
|
|
||||||
assertTrue("alice device should be verified from bob point of view", aliceDeviceInfoFromBobPOV!!.isVerified)
|
assertTrue("alice device should be verified from bob point of view", aliceDeviceInfoFromBobPOV!!.isVerified)
|
||||||
|
|
|
@ -1364,7 +1364,6 @@ internal class KeysBackup @Inject constructor(
|
||||||
.executeBy(taskExecutor)
|
.executeBy(taskExecutor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
// Maximum delay in ms in {@link maybeBackupKeys}
|
// Maximum delay in ms in {@link maybeBackupKeys}
|
||||||
private const val KEY_BACKUP_WAITING_TIME_TO_SEND_KEY_BACKUP_MILLIS = 10_000L
|
private const val KEY_BACKUP_WAITING_TIME_TO_SEND_KEY_BACKUP_MILLIS = 10_000L
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package im.vector.matrix.android.internal.crypto.keysbackup.util
|
package im.vector.matrix.android.internal.crypto.keysbackup.util
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Assert.assertArrayEquals
|
import org.junit.Assert.assertArrayEquals
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.FixMethodOrder
|
import org.junit.FixMethodOrder
|
||||||
|
@ -35,7 +34,7 @@ class Base58Test {
|
||||||
@Test
|
@Test
|
||||||
fun decode() {
|
fun decode() {
|
||||||
// Example comes from https://github.com/keis/base58
|
// Example comes from https://github.com/keis/base58
|
||||||
assertArrayEquals("hello world".toByteArray(), base58decode("StV1DL6CwTryKyV"));
|
assertArrayEquals("hello world".toByteArray(), base58decode("StV1DL6CwTryKyV"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue