timout -> timeout

This commit is contained in:
Benoit Marty 2020-04-21 00:29:44 +02:00
parent 59280ed18e
commit c39a0e4fd5
1 changed files with 14 additions and 14 deletions

View File

@ -278,16 +278,16 @@ class CommonTestHelper(context: Context) {
} }
var requestFailure: Throwable? = null var requestFailure: Throwable? = null
val latch = CountDownLatch(1) waitWithLatch { latch ->
matrix.authenticationService matrix.authenticationService
.getLoginWizard() .getLoginWizard()
.login(userName, badPassword, "myDevice", object : TestMatrixCallback<Session>(latch, onlySuccessful = false) { .login(userName, badPassword, "myDevice", object : TestMatrixCallback<Session>(latch, onlySuccessful = false) {
override fun onFailure(failure: Throwable) { override fun onFailure(failure: Throwable) {
requestFailure = failure requestFailure = failure
super.onFailure(failure) super.onFailure(failure)
} }
}) })
await(latch) }
requestFailure!!.isInvalidPassword().shouldBeTrue() requestFailure!!.isInvalidPassword().shouldBeTrue()
} }
@ -298,8 +298,8 @@ class CommonTestHelper(context: Context) {
* @param latch * @param latch
* @throws InterruptedException * @throws InterruptedException
*/ */
fun await(latch: CountDownLatch, timout: Long? = TestConstants.timeOutMillis) { fun await(latch: CountDownLatch, timeout: Long? = TestConstants.timeOutMillis) {
assertTrue(latch.await(timout ?: TestConstants.timeOutMillis, TimeUnit.MILLISECONDS)) assertTrue(latch.await(timeout ?: TestConstants.timeOutMillis, TimeUnit.MILLISECONDS))
} }
fun retryPeriodicallyWithLatch(latch: CountDownLatch, condition: (() -> Boolean)) { fun retryPeriodicallyWithLatch(latch: CountDownLatch, condition: (() -> Boolean)) {
@ -314,10 +314,10 @@ class CommonTestHelper(context: Context) {
} }
} }
fun waitWithLatch(timout: Long? = TestConstants.timeOutMillis, block: (CountDownLatch) -> Unit) { fun waitWithLatch(timeout: Long? = TestConstants.timeOutMillis, block: (CountDownLatch) -> Unit) {
val latch = CountDownLatch(1) val latch = CountDownLatch(1)
block(latch) block(latch)
await(latch, timout) await(latch, timeout)
} }
// Transform a method with a MatrixCallback to a synchronous method // Transform a method with a MatrixCallback to a synchronous method