diff --git a/library/core/src/main/java/com/google/android/exoplayer2/PlayerMessage.java b/library/core/src/main/java/com/google/android/exoplayer2/PlayerMessage.java index d9b5616eb4..7e2cb69bc6 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/PlayerMessage.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/PlayerMessage.java @@ -323,13 +323,13 @@ public final class PlayerMessage { * @throws InterruptedException If the current thread is interrupted while waiting for the message * to be delivered. */ - public synchronized boolean experimental_blockUntilDelivered(long timeoutMs) + public synchronized boolean experimentalBlockUntilDelivered(long timeoutMs) throws InterruptedException, TimeoutException { - return experimental_blockUntilDelivered(timeoutMs, Clock.DEFAULT); + return experimentalBlockUntilDelivered(timeoutMs, Clock.DEFAULT); } @VisibleForTesting() - /* package */ synchronized boolean experimental_blockUntilDelivered(long timeoutMs, Clock clock) + /* package */ synchronized boolean experimentalBlockUntilDelivered(long timeoutMs, Clock clock) throws InterruptedException, TimeoutException { Assertions.checkState(isSent); Assertions.checkState(handler.getLooper().getThread() != Thread.currentThread()); diff --git a/library/core/src/test/java/com/google/android/exoplayer2/PlayerMessageTest.java b/library/core/src/test/java/com/google/android/exoplayer2/PlayerMessageTest.java index e935024b2f..490cc520fe 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/PlayerMessageTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/PlayerMessageTest.java @@ -66,30 +66,30 @@ public class PlayerMessageTest { } @Test - public void experimental_blockUntilDelivered_timesOut() throws Exception { + public void experimentalBlockUntilDelivered_timesOut() throws Exception { when(clock.elapsedRealtime()).thenReturn(0L).thenReturn(TIMEOUT_MS * 2); try { - message.send().experimental_blockUntilDelivered(TIMEOUT_MS, clock); + message.send().experimentalBlockUntilDelivered(TIMEOUT_MS, clock); fail(); } catch (TimeoutException expected) { } - // Ensure experimental_blockUntilDelivered() entered the blocking loop + // Ensure experimentalBlockUntilDelivered() entered the blocking loop verify(clock, Mockito.times(2)).elapsedRealtime(); } @Test - public void experimental_blockUntilDelivered_onAlreadyProcessed_succeeds() throws Exception { + public void experimentalBlockUntilDelivered_onAlreadyProcessed_succeeds() throws Exception { when(clock.elapsedRealtime()).thenReturn(0L); message.send().markAsProcessed(/* isDelivered= */ true); - assertThat(message.experimental_blockUntilDelivered(TIMEOUT_MS, clock)).isTrue(); + assertThat(message.experimentalBlockUntilDelivered(TIMEOUT_MS, clock)).isTrue(); } @Test - public void experimental_blockUntilDelivered_markAsProcessedWhileBlocked_succeeds() + public void experimentalBlockUntilDelivered_markAsProcessedWhileBlocked_succeeds() throws Exception { message.send(); @@ -114,8 +114,8 @@ public class PlayerMessageTest { }); try { - assertThat(message.experimental_blockUntilDelivered(TIMEOUT_MS, clock)).isTrue(); - // Ensure experimental_blockUntilDelivered() entered the blocking loop. + assertThat(message.experimentalBlockUntilDelivered(TIMEOUT_MS, clock)).isTrue(); + // Ensure experimentalBlockUntilDelivered() entered the blocking loop. verify(clock, Mockito.atLeast(2)).elapsedRealtime(); future.get(1, SECONDS); } finally {