use of com.google.android.exoplayer2.robolectric.RobolectricUtil.createRobolectricConditionVariable in project ExoPlayer by google.
the class RobolectricUtilTest method createRobolectricConditionVariable_blockWithTimeout_blocksForAtLeastTimeout.
@Test
public void createRobolectricConditionVariable_blockWithTimeout_blocksForAtLeastTimeout() throws InterruptedException {
ConditionVariable conditionVariable = RobolectricUtil.createRobolectricConditionVariable();
long startTimeMs = System.currentTimeMillis();
assertThat(conditionVariable.block(/* timeoutMs= */
500)).isFalse();
long endTimeMs = System.currentTimeMillis();
assertThat(endTimeMs - startTimeMs).isAtLeast(500);
}
use of com.google.android.exoplayer2.robolectric.RobolectricUtil.createRobolectricConditionVariable in project ExoPlayer by google.
the class RobolectricUtilTest method createRobolectricConditionVariable_blockWithTimeout_timesOut.
@Test
public void createRobolectricConditionVariable_blockWithTimeout_timesOut() throws InterruptedException {
ConditionVariable conditionVariable = RobolectricUtil.createRobolectricConditionVariable();
assertThat(conditionVariable.block(/* timeoutMs= */
1)).isFalse();
assertThat(conditionVariable.isOpen()).isFalse();
}
Aggregations