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