DummyMainThread
@UnstableApi
class DummyMainThread
Helper class to simulate main/UI thread in tests.
Summary
Nested types |
|---|
interface DummyMainThread.TestRunnable
|
Constants |
|
|---|---|
const Int |
TIMEOUT_MS = 10000Default timeout value used for |
Public constructors |
|---|
Public functions |
|
|---|---|
Unit |
release() |
Unit |
runOnMainThread(runnable: Runnable!)Runs the provided |
Unit |
runOnMainThread(timeoutMs: Int, runnable: Runnable!)Runs the provided |
Unit |
runTestOnMainThread(runnable: DummyMainThread.TestRunnable!)Runs the provided |
Unit |
runTestOnMainThread(Runs the provided |
Constants
Public constructors
Public functions
runOnMainThread
fun runOnMainThread(runnable: Runnable!): Unit
Runs the provided Runnable on the main thread, blocking until execution completes or until TIMEOUT_MS milliseconds have passed.
runOnMainThread
fun runOnMainThread(timeoutMs: Int, runnable: Runnable!): Unit
Runs the provided Runnable on the main thread, blocking until execution completes or until timeout milliseconds have passed.
runTestOnMainThread
fun runTestOnMainThread(runnable: DummyMainThread.TestRunnable!): Unit
Runs the provided TestRunnable on the main thread, blocking until execution completes or until TIMEOUT_MS milliseconds have passed.
| Parameters | |
|---|---|
runnable: DummyMainThread.TestRunnable! |
The |
runTestOnMainThread
fun runTestOnMainThread(
timeoutMs: Int,
runnable: DummyMainThread.TestRunnable!
): Unit
Runs the provided TestRunnable on the main thread, blocking until execution completes or until timeout milliseconds have passed.
| Parameters | |
|---|---|
timeoutMs: Int |
The maximum time to wait in milliseconds. |
runnable: DummyMainThread.TestRunnable! |
The |