Commit 45b574d5 by tonihei Committed by Oliver Woodman

Fix flaky test.

The test was flaky because it didn't wait for pending commands to finish
after pausing the test playback.

Also add more debug information to the toString() method because the
expected and actual state only differed in the nextAdGroupIndex in the
flaky case.

PiperOrigin-RevId: 313175919
parent 0add067e
......@@ -874,7 +874,9 @@ public final class AnalyticsCollectorTest {
// Wait in each content part to ensure previously triggered events get a chance to be
// delivered. This prevents flakiness caused by playback progressing too fast.
.playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 3_000)
.waitForPendingPlayerCommands()
.playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 8_000)
.waitForPendingPlayerCommands()
.play()
.waitForPlaybackState(Player.STATE_ENDED)
// Wait for final timeline change that marks post-roll played.
......@@ -1361,6 +1363,9 @@ public final class AnalyticsCollectorTest {
: "")
+ ", period.hashCode="
+ mediaPeriodId.periodUid.hashCode()
+ (mediaPeriodId.nextAdGroupIndex != C.INDEX_UNSET
? ", nextAdGroup=" + mediaPeriodId.nextAdGroupIndex
: "")
+ '}'
: "{" + "window=" + windowIndex + ", period = null}";
}
......
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