@@ -25,13 +25,14 @@ import org.junit.runners.JUnit4
25
25
import org.junit.runners.MethodSorters
26
26
import org.matrix.android.sdk.InstrumentedTest
27
27
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
28
+ import org.matrix.android.sdk.api.session.getRoom
28
29
import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent
29
30
import org.matrix.android.sdk.common.CommonTestHelper.Companion.runCryptoTest
30
31
31
32
@RunWith(JUnit4 ::class )
32
33
@FixMethodOrder(MethodSorters .JVM )
33
34
@LargeTest
34
- class E2eeTestConfig : InstrumentedTest {
35
+ class E2eeConfigTest : InstrumentedTest {
35
36
36
37
@Test
37
38
fun testBlacklistUnverifiedDefault () = runCryptoTest(context()) { cryptoTestHelper, _ ->
@@ -55,10 +56,8 @@ class E2eeTestConfig : InstrumentedTest {
55
56
56
57
val roomBobPOV = cryptoTestData.secondSession!! .roomService().getRoom(cryptoTestData.roomId)!!
57
58
// ensure other received
58
- testHelper.waitWithLatch { latch ->
59
- testHelper.retryPeriodicallyWithLatch(latch) {
60
- roomBobPOV.timelineService().getTimelineEvent(sentMessage.eventId) != null
61
- }
59
+ testHelper.retryPeriodically {
60
+ roomBobPOV.timelineService().getTimelineEvent(sentMessage.eventId) != null
62
61
}
63
62
64
63
cryptoTestHelper.ensureCannotDecrypt(listOf (sentMessage.eventId), cryptoTestData.secondSession!! , cryptoTestData.roomId)
@@ -81,10 +80,8 @@ class E2eeTestConfig : InstrumentedTest {
81
80
82
81
val roomBobPOV = cryptoTestData.secondSession!! .roomService().getRoom(cryptoTestData.roomId)!!
83
82
// ensure other received
84
- testHelper.waitWithLatch { latch ->
85
- testHelper.retryPeriodicallyWithLatch(latch) {
86
- roomBobPOV.timelineService().getTimelineEvent(sentMessage.eventId) != null
87
- }
83
+ testHelper.retryPeriodically {
84
+ roomBobPOV.timelineService().getTimelineEvent(sentMessage.eventId) != null
88
85
}
89
86
90
87
cryptoTestHelper.ensureCanDecrypt(
@@ -105,10 +102,8 @@ class E2eeTestConfig : InstrumentedTest {
105
102
106
103
val roomBobPOV = cryptoTestData.secondSession!! .roomService().getRoom(cryptoTestData.roomId)!!
107
104
// ensure other received
108
- testHelper.waitWithLatch { latch ->
109
- testHelper.retryPeriodicallyWithLatch(latch) {
110
- roomBobPOV.timelineService().getTimelineEvent(beforeMessage.eventId) != null
111
- }
105
+ testHelper.retryPeriodically {
106
+ roomBobPOV.timelineService().getTimelineEvent(beforeMessage.eventId) != null
112
107
}
113
108
114
109
cryptoTestHelper.ensureCanDecrypt(
@@ -118,10 +113,15 @@ class E2eeTestConfig : InstrumentedTest {
118
113
listOf (beforeMessage.getLastMessageContent()!! .body)
119
114
)
120
115
121
- cryptoTestData.firstSession.cryptoService().setRoomBlacklistUnverifiedDevices (cryptoTestData.roomId, true )
116
+ cryptoTestData.firstSession.cryptoService().setRoomBlockUnverifiedDevices (cryptoTestData.roomId, true )
122
117
123
118
val afterMessage = testHelper.sendTextMessage(roomAlicePOV, " you are blocked" , 1 ).first()
124
119
120
+ // ensure received
121
+ testHelper.retryPeriodically {
122
+ cryptoTestData.secondSession?.getRoom(cryptoTestData.roomId)?.timelineService()?.getTimelineEvent(afterMessage.eventId)?.root != null
123
+ }
124
+
125
125
cryptoTestHelper.ensureCannotDecrypt(
126
126
listOf (afterMessage.eventId),
127
127
cryptoTestData.secondSession!! ,
0 commit comments