Make the test fail before unwedging implementation
This commit is contained in:
parent
00c239bc42
commit
5900245018
@ -87,6 +87,26 @@ class UnwedgingTest : InstrumentedTest {
|
|||||||
val bobTimeline = roomFromBobPOV.createTimeline(null, TimelineSettings(20))
|
val bobTimeline = roomFromBobPOV.createTimeline(null, TimelineSettings(20))
|
||||||
bobTimeline.start()
|
bobTimeline.start()
|
||||||
|
|
||||||
|
val bobFinalLatch = CountDownLatch(1)
|
||||||
|
val bobHasThreeDecryptedEventsListener = object : Timeline.Listener {
|
||||||
|
override fun onTimelineFailure(throwable: Throwable) {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNewTimelineEvents(eventIds: List<String>) {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTimelineUpdated(snapshot: List<TimelineEvent>) {
|
||||||
|
val decryptedEventReceivedByBob = snapshot.filter { it.root.getClearType() == EventType.MESSAGE }
|
||||||
|
if (decryptedEventReceivedByBob.size == 3) {
|
||||||
|
bobFinalLatch.countDown()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bobTimeline.addListener(bobHasThreeDecryptedEventsListener)
|
||||||
|
|
||||||
|
|
||||||
var latch = CountDownLatch(1)
|
var latch = CountDownLatch(1)
|
||||||
var bobEventsListener = createEventListener(latch, 1)
|
var bobEventsListener = createEventListener(latch, 1)
|
||||||
bobTimeline.addListener(bobEventsListener)
|
bobTimeline.addListener(bobEventsListener)
|
||||||
@ -146,6 +166,10 @@ class UnwedgingTest : InstrumentedTest {
|
|||||||
messagesReceivedByBob[1].root.getClearType() shouldBeEqualTo EventType.MESSAGE
|
messagesReceivedByBob[1].root.getClearType() shouldBeEqualTo EventType.MESSAGE
|
||||||
messagesReceivedByBob[2].root.getClearType() shouldBeEqualTo EventType.MESSAGE
|
messagesReceivedByBob[2].root.getClearType() shouldBeEqualTo EventType.MESSAGE
|
||||||
|
|
||||||
|
// Wait for all the message to be decrypted by bob
|
||||||
|
mTestHelper.await(bobFinalLatch)
|
||||||
|
bobTimeline.removeListener(bobHasThreeDecryptedEventsListener)
|
||||||
|
|
||||||
bobTimeline.dispose()
|
bobTimeline.dispose()
|
||||||
|
|
||||||
cryptoTestData.cleanUp(mTestHelper)
|
cryptoTestData.cleanUp(mTestHelper)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user