docs/doc/reference/com/google/android/exoplayer2/testutil/DummyMainThread.html
Package com.google.android.exoplayer2.testutil
public final classDummyMainThreadextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")
Helper class to simulate main/UI thread in tests.
Nested Classes | Modifier and Type | Class | Description |
| --- | --- | --- |
| static interface | DummyMainThread.TestRunnable |
Runnable variant which can throw a checked exception.
|
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static int | TIMEOUT_MS |
Default timeout value used for runOnMainThread(Runnable).
|
Constructors | Constructor | Description |
| --- | --- |
| DummyMainThread() | |
All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | release() | |
| void | runOnMainThread(int timeoutMs, Runnable runnable) |
Runs the provided Runnable on the main thread, blocking until execution completes or until timeout milliseconds have passed.
|
| void | runOnMainThread(Runnable runnable) |
Runs the provided Runnable on the main thread, blocking until execution completes or until TIMEOUT_MS milliseconds have passed.
|
| void | runTestOnMainThread(int timeoutMs, DummyMainThread.TestRunnable runnable) |
Runs the provided DummyMainThread.TestRunnable on the main thread, blocking until execution completes or until timeout milliseconds have passed.
|
| void | runTestOnMainThread(DummyMainThread.TestRunnable runnable) |
Runs the provided DummyMainThread.TestRunnable on the main thread, blocking until execution completes or until TIMEOUT_MS milliseconds have passed.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final int TIMEOUT_MS
Default timeout value used for runOnMainThread(Runnable).
See Also:Constant Field Values
-
public DummyMainThread()
-
public void runOnMainThread([Runnable](https://developer.android.com/reference/java/lang/Runnable.html "class or interface in java.lang")runnable)
Runs the provided Runnable on the main thread, blocking until execution completes or until TIMEOUT_MS milliseconds have passed.
Parameters:runnable - The Runnable to run.
-
public void runOnMainThread(int timeoutMs,[Runnable](https://developer.android.com/reference/java/lang/Runnable.html "class or interface in java.lang")runnable)
Runs the provided Runnable on the main thread, blocking until execution completes or until timeout milliseconds have passed.
Parameters:timeoutMs - The maximum time to wait in milliseconds.runnable - The Runnable to run.
-
public void runTestOnMainThread([DummyMainThread.TestRunnable](DummyMainThread.TestRunnable.html "interface in com.google.android.exoplayer2.testutil")runnable)
Runs the provided DummyMainThread.TestRunnable on the main thread, blocking until execution completes or until TIMEOUT_MS milliseconds have passed.
Parameters:runnable - The DummyMainThread.TestRunnable to run.
-
public void runTestOnMainThread(int timeoutMs,[DummyMainThread.TestRunnable](DummyMainThread.TestRunnable.html "interface in com.google.android.exoplayer2.testutil")runnable)
Runs the provided DummyMainThread.TestRunnable on the main thread, blocking until execution completes or until timeout milliseconds have passed.
Parameters:timeoutMs - The maximum time to wait in milliseconds.runnable - The DummyMainThread.TestRunnable to run.
-
public void release()