use of de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager in project AntennaPod by AntennaPod.
the class PlaybackServiceTaskManagerTest method testStartWidgetUpdater.
@Test
public void testStartWidgetUpdater() throws InterruptedException {
final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
final int NUM_COUNTDOWNS = 2;
final int TIMEOUT = 3 * PlaybackServiceTaskManager.WIDGET_UPDATER_NOTIFICATION_INTERVAL;
final CountDownLatch countDownLatch = new CountDownLatch(NUM_COUNTDOWNS);
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, new PlaybackServiceTaskManager.PSTMCallback() {
@Override
public void positionSaverTick() {
}
@Override
public WidgetUpdater.WidgetState requestWidgetState() {
countDownLatch.countDown();
return null;
}
@Override
public void onChapterLoaded(Playable media) {
}
});
pstm.startWidgetUpdater();
countDownLatch.await(TIMEOUT, TimeUnit.MILLISECONDS);
pstm.shutdown();
}
Aggregations