mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
PlayerListener: do not swallow exceptions thrown before waiting
If an error occurred in the player before the test was calling one of the waitUntilSomething() methods, a timeout exception was thrown instead of the actual error. PiperOrigin-RevId: 713292292
This commit is contained in:
parent
b321c8d3bd
commit
d9776e74c8
@ -130,9 +130,15 @@ public final class PlayerTestListener implements Player.Listener, AnalyticsListe
|
||||
|
||||
private void waitOrThrow(ConditionVariable conditionVariable)
|
||||
throws TimeoutException, PlaybackException {
|
||||
if (!conditionVariable.block(testTimeoutMs)) {
|
||||
maybeThrowPlaybackException();
|
||||
boolean conditionVariableTimedOut = !conditionVariable.block(testTimeoutMs);
|
||||
maybeThrowPlaybackException();
|
||||
if (conditionVariableTimedOut) {
|
||||
throw new TimeoutException();
|
||||
}
|
||||
}
|
||||
|
||||
private void maybeThrowPlaybackException() throws PlaybackException {
|
||||
@Nullable PlaybackException playbackException = this.playbackException.get();
|
||||
if (playbackException != null) {
|
||||
throw playbackException;
|
||||
|
Loading…
x
Reference in New Issue
Block a user