Commit 096d7651 by tonihei Committed by Oliver Woodman

Execute actions in action schedule immediately.

Run next action immediately without using the handler when the requested
delay is zero. This ensures that no other code can run between these two
actions to improve deterministic test behaviour.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170456852
parent 28173991
......@@ -16,6 +16,7 @@
package com.google.android.exoplayer2.testutil;
import android.os.Handler;
import android.os.Looper;
import android.view.Surface;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Player;
......@@ -342,7 +343,11 @@ public final class ActionSchedule {
this.trackSelector = trackSelector;
this.surface = surface;
this.mainHandler = mainHandler;
clock.postDelayed(mainHandler, this, delayMs);
if (delayMs == 0 && Looper.myLooper() == mainHandler.getLooper()) {
run();
} else {
clock.postDelayed(mainHandler, this, delayMs);
}
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment