Java 类org.robolectric.internal.bytecode.ShadowMap 实例源码

项目:Oleaster    文件:RoboOleaster.java   
/**
 * Create an {@link InstrumentationConfiguration} suitable for the provided {@link FrameworkMethod}.
 *
 * Custom TestRunner subclasses may wish to override this method to provide alternate configuration.
 *
 * @return an {@link InstrumentationConfiguration}
 */
private InstrumentationConfiguration createClassLoaderConfig(Config config) {
    InstrumentationConfiguration.Builder builder = InstrumentationConfiguration.newBuilder()
            .doNotAcquirePackage("java.")
            .doNotAcquirePackage("sun.")
            .doNotAcquirePackage("org.robolectric.annotation.")
            .doNotAcquirePackage("org.robolectric.internal.")
            .doNotAcquirePackage("org.robolectric.util.")
            .doNotAcquirePackage("org.junit.");

    for (Class<?> shadowClass : getExtraShadows()) {
        ShadowMap.ShadowInfo shadowInfo = ShadowMap.getShadowInfo(shadowClass);
        builder.addInstrumentedClass(shadowInfo.getShadowedClassName());
    }

    addInstrumentedPackages(builder);
    AndroidConfigurer.configure(builder, getInterceptors());
    AndroidConfigurer.withConfig(builder, config);
    return builder.build();
}
项目:Oleaster    文件:RoboOleaster.java   
private ShadowMap createShadowMap() {
    return ShadowMap.EMPTY;
}
项目:Oleaster    文件:RoboOleaster.java   
private ClassHandler createClassHandler(ShadowMap shadowMap, SdkEnvironment sdkEnvironment) {
    return new ShadowWrangler(shadowMap, sdkEnvironment.getSdkConfig().getApiLevel(), interceptors);
}
项目:AndroidUnitTest    文件:AndroidUnitTestRunner.java   
@Override
protected ShadowMap createShadowMap() {
    return super.createShadowMap()
        .newBuilder()
        .build();
}
项目:Oleaster    文件:RoboOleaster.java   
private void configureShadows(SdkEnvironment sdkEnvironment) {
    ShadowMap.Builder builder = createShadowMap().newBuilder();

    // Configure shadows *BEFORE* setting the ClassLoader. This is necessary because
    // creating the ShadowMap loads all ShadowProvider s via ServiceLoader and this is
    // not available once we install the Robolectric class loader.


    ShadowMap shadowMap = builder.build();
    sdkEnvironment.replaceShadowMap(shadowMap);

    sdkEnvironment.configure(createClassHandler(shadowMap, sdkEnvironment), getInterceptors());
}