use of org.robolectric.shadows.ShadowLooper in project weex-example by KalicyZhou.
the class WXDomStatementTest method setUp.
@Before
public void setUp() throws Exception {
WXSDKEngine.initialize(RuntimeEnvironment.application, new InitConfig.Builder().build());
ShadowLooper looper = WXBridgeManagerTest.getLooper();
looper.idle();
ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
instance = WXSDKInstanceTest.createInstance();
rednerManager = new WXRenderManager();
//
rednerManager.registerInstance(instance);
stmt = new WXDomStatement(instance.getInstanceId(), rednerManager);
}
use of org.robolectric.shadows.ShadowLooper in project incubator-weex by apache.
the class WXDomStatementTest method setUp.
@Before
public void setUp() throws Exception {
WXSDKEngine.initialize(RuntimeEnvironment.application, new InitConfig.Builder().build());
ShadowLooper looper = WXBridgeManagerTest.getLooper();
looper.idle();
ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
instance = WXSDKInstanceTest.createInstance();
rednerManager = new WXRenderManager();
//
rednerManager.registerInstance(instance);
WXSDKManagerTest.setRenderManager(rednerManager);
stmt = new DOMActionContextImpl(instance.getInstanceId(), rednerManager);
}
use of org.robolectric.shadows.ShadowLooper 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.ShadowLooper 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.ShadowLooper 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());
}
Aggregations