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

项目:FullRobolectricTestSample    文件:RobolectricTestRunner.java   
protected void configureShadows(SdkEnvironment sdkEnvironment, Config config) {
  ShadowMap shadowMap = createShadowMap();

  if (config != null) {
    Class<?>[] shadows = config.shadows();
    if (shadows.length > 0) {
      shadowMap = shadowMap.newBuilder()
          .addShadowClasses(shadows)
          .build();
    }
  }

  ClassHandler classHandler = getClassHandler(sdkEnvironment, shadowMap);
  injectClassHandler(sdkEnvironment.getRobolectricClassLoader(), classHandler);
}
项目:FullRobolectricTestSample    文件:RobolectricTestRunner.java   
private ClassHandler getClassHandler(SdkEnvironment sdkEnvironment, ShadowMap shadowMap) {
  ClassHandler classHandler;
  synchronized (sdkEnvironment) {
    classHandler = sdkEnvironment.classHandlersByShadowMap.get(shadowMap);
    if (classHandler == null) {
      classHandler = createClassHandler(shadowMap, sdkEnvironment.getSdkConfig());
    }
    sdkEnvironment.setCurrentClassHandler(classHandler);
  }
  return classHandler;
}
项目:FullRobolectricTestSample    文件:RobolectricTestRunner.java   
protected ShadowMap createShadowMap() {
  synchronized (RobolectricTestRunner.class) {
    if (mainShadowMap != null) return mainShadowMap;

    mainShadowMap = new ShadowMap.Builder()
        //.addShadowClasses(RobolectricBase.DEFAULT_SHADOW_CLASSES)
        .build();
    //mainShadowMap = new ShadowMap.Builder()
    //        .addShadowClasses(RobolectricBase.DEFAULT_SHADOW_CLASSES)
    //        .build();
    return mainShadowMap;
  }
}
项目:open    文件:MapzenTestRunner.java   
/**
 * Adds custom shadow classes to Robolectric shadow map.
 */
@Override
protected ShadowMap createShadowMap() {
    return super.createShadowMap()
            .newBuilder()
            .addShadowClass(ShadowMapView.class)
            .addShadowClass(ShadowVectorTileLayer.class)
            .addShadowClass(ShadowGLMatrix.class)
            .addShadowClass(ShadowGLShader.class)
            .addShadowClass(ShadowGLState.class)
            .addShadowClass(ShadowMint.class)
            .addShadowClass(ShadowSupportMenuInflater.class)
            .build();
}
项目:android-db-commons    文件:CustomRobolectricTestRunner.java   
@Override
protected ShadowMap createShadowMap() {
  return super.createShadowMap()
      .newBuilder()
      .addShadowClass(ShadowAsyncTaskLoader.class)
      .build();
}
项目:FullRobolectricTestSample    文件:RobolectricTestRunner.java   
protected ClassHandler createClassHandler(ShadowMap shadowMap, SdkConfig sdkConfig) {
  return new ShadowWrangler(shadowMap, sdkConfig);
}
项目:FullRobolectricTestSample    文件:TestRunners.java   
@Override protected ShadowMap createShadowMap() {
  // Don't do any class binding except the bare minimum, because that's what we're trying to test here.
  return new ShadowMap.Builder()
      .addShadowClass(ShadowSystemProperties.class)
      .build();
}
项目:FullRobolectricTestSample    文件:TestRunners.java   
@Override protected ShadowMap createShadowMap() {
  // Don't do any class binding, because that's what we're trying to test here.
  return ShadowMap.EMPTY;
}