Test: Fix missed latch exceptions.
Catch timeouts, and general errors in the case of an InterupptedException. PiperOrigin-RevId: 545219647
This commit is contained in:
parent
5e96d355e1
commit
1fce0cfd4d
@ -306,6 +306,7 @@ public final class VideoFrameProcessorTestRunner {
|
||||
@Override
|
||||
public void onError(VideoFrameProcessingException exception) {
|
||||
videoFrameProcessingException.set(exception);
|
||||
checkNotNull(videoFrameProcessingEndedLatch).countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -376,15 +377,18 @@ public final class VideoFrameProcessorTestRunner {
|
||||
public void endFrameProcessing(long videoFrameProcessingWaitTimeMs) throws InterruptedException {
|
||||
videoFrameProcessor.signalEndOfInput();
|
||||
|
||||
@Nullable Exception endFrameProcessingException = null;
|
||||
try {
|
||||
checkNotNull(videoFrameProcessingEndedLatch)
|
||||
.await(videoFrameProcessingWaitTimeMs, MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
// Report videoFrameProcessingException before potentially reporting a timeout
|
||||
// InterruptedException.
|
||||
assertThat(videoFrameProcessingException.get()).isNull();
|
||||
throw e;
|
||||
if (!checkNotNull(videoFrameProcessingEndedLatch)
|
||||
.await(videoFrameProcessingWaitTimeMs, MILLISECONDS)) {
|
||||
endFrameProcessingException =
|
||||
new IllegalStateException("Video frame processing timed out.");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
endFrameProcessingException = e;
|
||||
}
|
||||
assertThat(videoFrameProcessingException.get()).isNull();
|
||||
assertThat(endFrameProcessingException).isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user