use of androidx.media3.test.utils.robolectric.RobolectricUtil.createRobolectricConditionVariable in project media by androidx.
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 androidx.media3.test.utils.robolectric.RobolectricUtil.createRobolectricConditionVariable in project media by androidx.
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