blob: 7c23d8d63cb160a2c706f1bdebd528f1550e9481 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
package com.mapbox.mapboxsdk.testapp.utils
import android.support.test.espresso.UiController
import com.mapbox.mapboxsdk.maps.MapView
object TestingAsyncUtils {
private const val DEFAULT_TIMEOUT = 15_000L
fun waitForLayer(uiController: UiController, mapView: MapView) {
val start = System.nanoTime() / 1E6
var isIdle = false
mapView.addOnDidBecomeIdleListener { isIdle = true }
while (!isIdle && System.nanoTime() / 1E6 - start < DEFAULT_TIMEOUT) {
uiController.loopMainThreadForAtLeast(100)
}
}
}
|