Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e862ed4c authored by Sebastián Franco's avatar Sebastián Franco Committed by Android (Google) Code Review
Browse files

Merge "Reducing the wait time for events for less than the Test timeout" into main

parents 40de6c4c 750e8496
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -35,9 +35,10 @@ class EventWaiter(val eventToWait: TestEvent) {

    companion object {
        private const val TAG = "EventWaiter"
        private val SIGNAL_TIMEOUT = TimeUnit.SECONDS.toMillis(5)
    }

    fun waitForSignal(timeout: Long = TimeUnit.SECONDS.toMillis(10)) = runBlocking {
    fun waitForSignal(timeout: Long = SIGNAL_TIMEOUT) = runBlocking {
        var status = withTimeoutOrNull(timeout) { deferrable.await() }
        if (status == null) {
            status = EventStatus.TIMEOUT