Package com.google.android.exoplayer2.testutil

## Class DummyMainThread

- java.lang.Object
- - com.google.android.exoplayer2.testutil.DummyMainThread

-     public final class DummyMainThread
      extends Object

  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 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 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 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 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()