Search in sources :

Example 6 with ShadowMessageQueue

use of org.robolectric.shadows.ShadowMessageQueue in project android_packages_apps_Settings by omnirom.

the class ShadowPackageMonitor method setupBackgroundThreadScheduler.

private static void setupBackgroundThreadScheduler() {
    ShadowMessageQueue shadowMessageQueue = ((ShadowMessageQueue) ShadowExtractor.extract(BackgroundThread.getHandler().getLooper().getQueue()));
    shadowMessageQueue.setScheduler(ShadowApplication.getInstance().getBackgroundThreadScheduler());
}
Also used : ShadowMessageQueue(org.robolectric.shadows.ShadowMessageQueue)

Example 7 with ShadowMessageQueue

use of org.robolectric.shadows.ShadowMessageQueue in project android_packages_apps_Settings by crdroidandroid.

the class ShadowPackageMonitor method setupBackgroundThreadScheduler.

private static void setupBackgroundThreadScheduler() {
    ShadowMessageQueue shadowMessageQueue = ((ShadowMessageQueue) ShadowExtractor.extract(BackgroundThread.getHandler().getLooper().getQueue()));
    shadowMessageQueue.setScheduler(ShadowApplication.getInstance().getBackgroundThreadScheduler());
}
Also used : ShadowMessageQueue(org.robolectric.shadows.ShadowMessageQueue)

Example 8 with ShadowMessageQueue

use of org.robolectric.shadows.ShadowMessageQueue in project android_packages_apps_Settings by SudaMod.

the class ShadowPackageMonitor method setupBackgroundThreadScheduler.

private static void setupBackgroundThreadScheduler() {
    ShadowMessageQueue shadowMessageQueue = ((ShadowMessageQueue) ShadowExtractor.extract(BackgroundThread.getHandler().getLooper().getQueue()));
    shadowMessageQueue.setScheduler(ShadowApplication.getInstance().getBackgroundThreadScheduler());
}
Also used : ShadowMessageQueue(org.robolectric.shadows.ShadowMessageQueue)

Example 9 with ShadowMessageQueue

use of org.robolectric.shadows.ShadowMessageQueue in project platform_packages_apps_Settings by BlissRoms.

the class ShadowPackageMonitor method setupBackgroundThreadScheduler.

private static void setupBackgroundThreadScheduler() {
    ShadowMessageQueue shadowMessageQueue = ((ShadowMessageQueue) ShadowExtractor.extract(BackgroundThread.getHandler().getLooper().getQueue()));
    shadowMessageQueue.setScheduler(ShadowApplication.getInstance().getBackgroundThreadScheduler());
}
Also used : ShadowMessageQueue(org.robolectric.shadows.ShadowMessageQueue)

Example 10 with ShadowMessageQueue

use of org.robolectric.shadows.ShadowMessageQueue in project RxAndroid by ReactiveX.

the class HandlerSchedulerTest method workerScheduleSetAsync.

@Test
public void workerScheduleSetAsync() {
    ShadowMessageQueue mainMessageQueue = shadowOf(Looper.getMainLooper().getQueue());
    Worker worker = scheduler.createWorker();
    worker.schedule(new Runnable() {

        @Override
        public void run() {
        }
    });
    Message message = mainMessageQueue.getHead();
    assertEquals(async, message.isAsynchronous());
}
Also used : ShadowMessageQueue(org.robolectric.shadows.ShadowMessageQueue) Message(android.os.Message) CountingRunnable(io.reactivex.rxjava3.android.testutil.CountingRunnable) Worker(io.reactivex.rxjava3.core.Scheduler.Worker) Test(org.junit.Test)

Aggregations

ShadowMessageQueue (org.robolectric.shadows.ShadowMessageQueue)12 Message (android.os.Message)6 Test (org.junit.Test)6 CountingRunnable (io.reactivex.rxjava3.android.testutil.CountingRunnable)3 EmptyScheduler (io.reactivex.rxjava3.android.testutil.EmptyScheduler)3 Scheduler (io.reactivex.rxjava3.core.Scheduler)3 ShadowLooper (org.robolectric.shadows.ShadowLooper)3 Worker (io.reactivex.rxjava3.core.Scheduler.Worker)2 Build (android.os.Build)1