Add unit tests for Transformer

PiperOrigin-RevId: 332416139
This commit is contained in:
kimvde 2020-09-18 10:54:46 +01:00 committed by Oliver Woodman
parent cc10657c09
commit 4aa3a0482d

View File

@ -31,11 +31,9 @@ import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.robolectric.annotation.LooperMode;
/** Tests for {@link MetadataRetriever}. */ /** Tests for {@link MetadataRetriever}. */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
@LooperMode(LooperMode.Mode.PAUSED)
public class MetadataRetrieverTest { public class MetadataRetrieverTest {
@Test @Test
@ -100,7 +98,9 @@ public class MetadataRetrieverTest {
ListenableFuture<TrackGroupArray> trackGroupsFuture) ListenableFuture<TrackGroupArray> trackGroupsFuture)
throws InterruptedException, ExecutionException { throws InterruptedException, ExecutionException {
while (!trackGroupsFuture.isDone()) { while (!trackGroupsFuture.isDone()) {
// Simulate advancing SystemClock so that delayed messages sent to handlers are received. // TODO: update once [Internal: b/168084145] is implemented.
// Advance SystemClock so that messages that are sent with a delay to the MetadataRetriever
// looper are received.
SystemClock.setCurrentTimeMillis(SystemClock.uptimeMillis() + 100); SystemClock.setCurrentTimeMillis(SystemClock.uptimeMillis() + 100);
Thread.sleep(/* millis= */ 100); Thread.sleep(/* millis= */ 100);
} }