use of org.robolectric.shadows.ShadowInstrumentation._Instrumentation_ in project robolectric by robolectric.
the class AndroidTestEnvironment method createInstrumentation.
private Instrumentation createInstrumentation() {
final ActivityThread activityThread = (ActivityThread) RuntimeEnvironment.getActivityThread();
final _ActivityThread_ activityThreadReflector = reflector(_ActivityThread_.class, activityThread);
Instrumentation androidInstrumentation = new RoboMonitoringInstrumentation();
activityThreadReflector.setInstrumentation(androidInstrumentation);
Application dummyInitialApplication = new Application();
final ComponentName dummyInitialComponent = new ComponentName("", androidInstrumentation.getClass().getSimpleName());
// TODO Move the API check into a helper method inside ShadowInstrumentation
if (RuntimeEnvironment.getApiLevel() <= VERSION_CODES.JELLY_BEAN_MR1) {
reflector(_Instrumentation_.class, androidInstrumentation).init(activityThread, dummyInitialApplication, dummyInitialApplication, dummyInitialComponent, null);
} else {
reflector(_Instrumentation_.class, androidInstrumentation).init(activityThread, dummyInitialApplication, dummyInitialApplication, dummyInitialComponent, null, null);
}
androidInstrumentation.onCreate(new Bundle());
return androidInstrumentation;
}
Aggregations