Package com.google.android.exoplayer2.testutil

## Class AutoAdvancingFakeClock

- java.lang.Object
- - com.google.android.exoplayer2.testutil.FakeClock
  - - com.google.android.exoplayer2.testutil.AutoAdvancingFakeClock

- All Implemented Interfaces:
    `Clock`

      public final class AutoAdvancingFakeClock
      extends FakeClock

  `FakeClock` extension which automatically advances time whenever an empty message is enqueued at a future time.

  The clock time is advanced to the time of enqueued empty messages. The first Handler sending messages at a future time will be allowed to advance time to ensure there is only one primary time source at a time. This should usually be the Handler of the internal playback loop. You can `reset the handler` so that the next Handler that sends messages at a future time becomes the primary time source.

- - ### Field Summary

    - ### Fields inherited from interface com.google.android.exoplayer2.util.Clock

      `DEFAULT`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AutoAdvancingFakeClock()` | Creates the auto-advancing clock with an initial time of 0.
    `AutoAdvancingFakeClock​(long initialTimeMs)` | Creates the auto-advancing clock.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected boolean` | `addHandlerMessageAtTime​(HandlerWrapper handler, int message, long timeMs)` | Adds an empty handler message to list of pending messages.
    `void` | `resetHandler()` | Resets the internal handler, so that this clock can later be used with another handler.

    - ### Methods inherited from class com.google.android.exoplayer2.testutil.FakeClock

      `addHandlerMessageAtTime, advanceTime, createHandler, currentTimeMillis, elapsedRealtime, sleep, uptimeMillis`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### AutoAdvancingFakeClock

          public AutoAdvancingFakeClock()

      Creates the auto-advancing clock with an initial time of 0.

    - #### AutoAdvancingFakeClock

          public AutoAdvancingFakeClock​(long initialTimeMs)

      Creates the auto-advancing clock.
      Parameters:
        `initialTimeMs` - The initial time of the clock in milliseconds.

  - ### Method Detail

    - #### addHandlerMessageAtTime

          protected boolean addHandlerMessageAtTime​(HandlerWrapper handler,
                                                    int message,
                                                    long timeMs)

      Description copied from class: `FakeClock`
      Adds an empty handler message to list of pending messages.
      Overrides:
        `addHandlerMessageAtTime` in class `FakeClock`

    - #### resetHandler

          public void resetHandler()

      Resets the internal handler, so that this clock can later be used with another handler.