Back to Exoplayer

DummyMainThread (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/testutil/DummyMainThread.html

latest5.8 KB
Original Source

Package com.google.android.exoplayer2.testutil

Class DummyMainThread


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 Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static interface | DummyMainThread.TestRunnable | Runnable variant which can throw a checked exception. |

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static int | TIMEOUT_MS | Default timeout value used for runOnMainThread(Runnable). |

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | DummyMainThread() | |

Method Summary

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. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

- 

TIMEOUT_MS

public static final int TIMEOUT_MS

Default timeout value used for runOnMainThread(Runnable). See Also:Constant Field Values

Constructor Detail

- 

DummyMainThread

public DummyMainThread()

Method Detail

- 

runOnMainThread

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.

- 

runOnMainThread

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.

- 

runTestOnMainThread

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.

- 

runTestOnMainThread

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.

- 

release

public void release()