Search in sources :

Example 1 with PlaybackServiceTaskManager

use of de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager in project AntennaPod by AntennaPod.

the class PlaybackServiceTaskManagerTest method testGetQueueWriteBeforeCreation.

public void testGetQueueWriteBeforeCreation() throws InterruptedException {
    final Context c = getInstrumentation().getTargetContext();
    List<FeedItem> queue = writeTestQueue("a");
    assertNotNull(queue);
    PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
    List<FeedItem> testQueue = pstm.getQueue();
    assertNotNull(testQueue);
    assertTrue(queue.size() == testQueue.size());
    for (int i = 0; i < queue.size(); i++) {
        assertTrue(queue.get(i).getId() == testQueue.get(i).getId());
    }
    pstm.shutdown();
}
Also used : Context(android.content.Context) FeedItem(de.danoeh.antennapod.core.feed.FeedItem) PlaybackServiceTaskManager(de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager)

Example 2 with PlaybackServiceTaskManager

use of de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager in project AntennaPod by AntennaPod.

the class PlaybackServiceTaskManagerTest method testCancelWidgetUpdater.

@Test
public void testCancelWidgetUpdater() {
    final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
    PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
    pstm.startWidgetUpdater();
    pstm.cancelWidgetUpdater();
    assertFalse(pstm.isWidgetUpdaterActive());
    pstm.shutdown();
}
Also used : Context(android.content.Context) PlaybackServiceTaskManager(de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 3 with PlaybackServiceTaskManager

use of de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager in project AntennaPod by AntennaPod.

the class PlaybackServiceTaskManagerTest method testInit.

@Test
public void testInit() {
    Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
    PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(context, defaultPSTM);
    pstm.shutdown();
}
Also used : Context(android.content.Context) PlaybackServiceTaskManager(de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 4 with PlaybackServiceTaskManager

use of de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager in project AntennaPod by AntennaPod.

the class PlaybackServiceTaskManagerTest method testCancelAllTasksAllTasksStarted.

@Test
@UiThreadTest
public void testCancelAllTasksAllTasksStarted() {
    final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
    PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
    pstm.startWidgetUpdater();
    pstm.startPositionSaver();
    pstm.setSleepTimer(100000);
    pstm.cancelAllTasks();
    assertFalse(pstm.isPositionSaverActive());
    assertFalse(pstm.isWidgetUpdaterActive());
    assertFalse(pstm.isSleepTimerActive());
    pstm.shutdown();
}
Also used : Context(android.content.Context) PlaybackServiceTaskManager(de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 5 with PlaybackServiceTaskManager

use of de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager in project AntennaPod by AntennaPod.

the class PlaybackServiceTaskManagerTest method testIsWidgetUpdaterActive.

@Test
public void testIsWidgetUpdaterActive() {
    final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
    PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
    pstm.startWidgetUpdater();
    assertTrue(pstm.isWidgetUpdaterActive());
    pstm.shutdown();
}
Also used : Context(android.content.Context) PlaybackServiceTaskManager(de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest)

Aggregations

Context (android.content.Context)16 PlaybackServiceTaskManager (de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager)16 UiThreadTest (androidx.test.annotation.UiThreadTest)14 LargeTest (androidx.test.filters.LargeTest)14 Test (org.junit.Test)14 CountDownLatch (java.util.concurrent.CountDownLatch)5 FeedItem (de.danoeh.antennapod.core.feed.FeedItem)2 SleepTimerUpdatedEvent (de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent)2 Playable (de.danoeh.antennapod.model.playback.Playable)2 EventDistributor (de.danoeh.antennapod.core.feed.EventDistributor)1