TestCoroutineScheduler
This is a scheduler for coroutines used in tests, providing the delay-skipping behavior.
Test dispatchers are parameterized with a scheduler. Several dispatchers can share the same scheduler, in which case their knowledge about the virtual time will be synchronized. When the dispatchers require scheduling an event at a later point in time, they notify the scheduler, which will establish the order of the tasks.
The scheduler can be queried to advance the time (via advanceTimeBy), run all the scheduled tasks advancing the virtual time as needed (via advanceUntilIdle), or run the tasks that are scheduled to run as soon as possible but haven't yet been dispatched (via runCurrent).
Properties
The current virtual time in milliseconds.
Returns the TimeSource representation of the virtual time of this scheduler.
Functions
Moves the virtual clock of this dispatcher forward by the specified amount, running the scheduled tasks in the meantime.
Runs the enqueued tasks in the specified order, advancing the virtual time as needed until there are no more tasks associated with the dispatchers linked to this scheduler.
Runs the tasks that are scheduled to execute at this moment of virtual time.