use of org.robolectric.util.Scheduler in project robolectric by robolectric.
the class ShadowLegacyLooperTest method reset_setsGlobalScheduler_forMainLooper_byDefault.
@Test
public void reset_setsGlobalScheduler_forMainLooper_byDefault() {
ShadowLooper sMainLooper = ShadowLooper.getShadowMainLooper();
Scheduler s = new Scheduler();
RuntimeEnvironment.setMasterScheduler(s);
sMainLooper.reset();
assertThat(sMainLooper.getScheduler()).isSameInstanceAs(s);
}
use of org.robolectric.util.Scheduler in project robolectric by robolectric.
the class ShadowLegacyLooperTest method reset_setsNewScheduler_forNonMainLooper_byDefault.
@Test
public void reset_setsNewScheduler_forNonMainLooper_byDefault() {
HandlerThread ht = getHandlerThread();
ShadowLooper sLooper = shadowOf(ht.getLooper());
Scheduler old = sLooper.getScheduler();
sLooper.reset();
assertThat(sLooper.getScheduler()).isNotSameInstanceAs(old);
assertThat(sLooper.getScheduler()).isNotSameInstanceAs(RuntimeEnvironment.getMasterScheduler());
}
use of org.robolectric.util.Scheduler in project robolectric by robolectric.
the class ShadowApplicationTest method getBackgroundThreadScheduler_shouldDifferFromRuntimeEnvironment_byDefault.
@Test
@LooperMode(LEGACY)
public void getBackgroundThreadScheduler_shouldDifferFromRuntimeEnvironment_byDefault() {
Scheduler s = new Scheduler();
RuntimeEnvironment.setMasterScheduler(s);
assertThat(Shadows.shadowOf(context).getBackgroundThreadScheduler()).isNotSameInstanceAs(RuntimeEnvironment.getMasterScheduler());
}
use of org.robolectric.util.Scheduler in project robolectric by robolectric.
the class ShadowLooperTest method reset_setsSchedulerToMaster_forNonMainLooper_withAdvancedScheduling.
@Test
public void reset_setsSchedulerToMaster_forNonMainLooper_withAdvancedScheduling() {
HandlerThread ht = getHandlerThread();
ShadowLooper sLooper = shadowOf(ht.getLooper());
Scheduler s = new Scheduler();
RuntimeEnvironment.setMasterScheduler(s);
setAdvancedScheduling();
sLooper.reset();
assertThat(sLooper.getScheduler()).isSameAs(s);
}
use of org.robolectric.util.Scheduler in project robolectric by robolectric.
the class ShadowLooperTest method reset_setsNewScheduler_forNonMainLooper_byDefault.
@Test
public void reset_setsNewScheduler_forNonMainLooper_byDefault() {
HandlerThread ht = getHandlerThread();
ShadowLooper sLooper = shadowOf(ht.getLooper());
Scheduler old = sLooper.getScheduler();
sLooper.reset();
assertThat(sLooper.getScheduler()).isNotSameAs(old).isNotSameAs(RuntimeEnvironment.getMasterScheduler());
}
Aggregations