use of org.robolectric.shadows.ShadowMessageQueue in project android_packages_apps_Settings by DirtyUnicorns.
the class ShadowPackageMonitor method setupBackgroundThreadScheduler.
private static void setupBackgroundThreadScheduler() {
ShadowMessageQueue shadowMessageQueue = ((ShadowMessageQueue) ShadowExtractor.extract(BackgroundThread.getHandler().getLooper().getQueue()));
shadowMessageQueue.setScheduler(ShadowApplication.getInstance().getBackgroundThreadScheduler());
}
use of org.robolectric.shadows.ShadowMessageQueue in project RxAndroid by ReactiveX.
the class AndroidSchedulersTest method asyncIgnoredPre16.
@Test
public void asyncIgnoredPre16() {
ReflectionHelpers.setStaticField(Build.VERSION.class, "SDK_INT", 14);
ShadowLooper mainLooper = shadowOf(Looper.getMainLooper());
mainLooper.pause();
ShadowMessageQueue mainMessageQueue = shadowOf(Looper.getMainLooper().getQueue());
Scheduler main = AndroidSchedulers.from(Looper.getMainLooper(), true);
main.scheduleDirect(new Runnable() {
@Override
public void run() {
}
});
Message message = mainMessageQueue.getHead();
assertFalse(message.isAsynchronous());
}
use of org.robolectric.shadows.ShadowMessageQueue in project RxAndroid by ReactiveX.
the class AndroidSchedulersTest method fromAsyncMessagesByDefault.
@Test
public void fromAsyncMessagesByDefault() {
ShadowLooper mainLooper = shadowOf(Looper.getMainLooper());
mainLooper.pause();
ShadowMessageQueue mainMessageQueue = shadowOf(Looper.getMainLooper().getQueue());
Scheduler main = AndroidSchedulers.from(Looper.getMainLooper());
main.scheduleDirect(new Runnable() {
@Override
public void run() {
}
});
Message message = mainMessageQueue.getHead();
assertTrue(message.isAsynchronous());
}
use of org.robolectric.shadows.ShadowMessageQueue in project RxAndroid by ReactiveX.
the class AndroidSchedulersTest method mainThreadAsyncMessagesByDefault.
@Test
public void mainThreadAsyncMessagesByDefault() {
ShadowLooper mainLooper = shadowOf(Looper.getMainLooper());
mainLooper.pause();
ShadowMessageQueue mainMessageQueue = shadowOf(Looper.getMainLooper().getQueue());
Scheduler main = AndroidSchedulers.mainThread();
main.scheduleDirect(new Runnable() {
@Override
public void run() {
}
});
Message message = mainMessageQueue.getHead();
assertTrue(message.isAsynchronous());
}
use of org.robolectric.shadows.ShadowMessageQueue in project android_packages_apps_Settings by LineageOS.
the class ShadowPackageMonitor method setupBackgroundThreadScheduler.
private static void setupBackgroundThreadScheduler() {
ShadowMessageQueue shadowMessageQueue = ((ShadowMessageQueue) ShadowExtractor.extract(BackgroundThread.getHandler().getLooper().getQueue()));
shadowMessageQueue.setScheduler(ShadowApplication.getInstance().getBackgroundThreadScheduler());
}
Aggregations