Java 类org.robolectric.AndroidManifest 实例源码

项目:android-couchbase-dagger-robolectric    文件:RobolectricGradleTestRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {

  String appRoot = "../app/src/main/";
  String manifestPath = appRoot + "AndroidManifest.xml";
  String resDir = appRoot + "res";
  String assetsDir = appRoot + "assets";
  AndroidManifest manifest = createAppManifest(Fs.fileFromPath(manifestPath),
                                               Fs.fileFromPath(resDir),
                                               Fs.fileFromPath(assetsDir));

  // If you change the package - don't forget to change the build.gradle and the AndroidManifest.xml
  manifest.setPackageName("com.soagrowers.android");

  // Robolectric is already going to look in the  'app' dir ...
  // so no need to add to package name
  return manifest;
}
项目:springbok    文件:GradleRobolectricTestRunner.java   
@Override
public AndroidManifest getAppManifest(Config config) {
    return new AndroidManifest(
        Fs.fileFromPath(MANIFEST_PROPERTY),
        Fs.fileFromPath(RES_PROPERTY)
    ) {
        @Override
        public int getTargetSdkVersion() {
            return MAX_SDK_SUPPORTED_BY_ROBOLECTRIC;
        }

        @Override
        public String getThemeRef(Class<? extends Activity> activityClass) {
            return "@style/AppTheme"; // Needs to define default theme
        }

    };
}
项目:so    文件:MyTestRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
  String path = "src/main";
  if (!new File(path).exists()) {
    path = "app/" + path;
  }
  final String manifestProperty = path + "/AndroidManifest.xml";
  final String resProperty = path + "/res";
  return new AndroidManifest(Fs.fileFromPath(manifestProperty), Fs.fileFromPath(resProperty)) {
    @Override
    public int getTargetSdkVersion() {
      return ROBOLECTRIC_SDK_VERSION;
    }

    @Override
    public String getThemeRef(Class<? extends Activity> activityClass) {
      return ROBOLECTRIC_THEME;
    }
  };
}
项目:so    文件:MyTestRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
  String path = "src/main";
  if (!new File(path).exists()) {
    path = "app/" + path;
  }
  final String manifestProperty = path + "/AndroidManifest.xml";
  final String resProperty = path + "/res";
  return new AndroidManifest(Fs.fileFromPath(manifestProperty), Fs.fileFromPath(resProperty)) {
    @Override
    public int getTargetSdkVersion() {
      return ROBOLECTRIC_SDK_VERSION;
    }

    @Override
    public String getThemeRef(Class<? extends Activity> activityClass) {
      return ROBOLECTRIC_THEME;
    }
  };
}
项目:android-alltest-gradle-sample    文件:RobolectricGradleTestRunner.java   
@Override
 protected AndroidManifest getAppManifest(Config config) {
   //String appRoot = "D:\\TmpCodingProjects\\TripComputer\\app\\src\\main\\";
   String appRoot = "../app/src/main/";
   String manifestPath = appRoot + "AndroidManifest.xml";
   String resDir = appRoot + "res";
   String assetsDir = appRoot + "assets";
   AndroidManifest manifest = createAppManifest(Fs.fileFromPath(manifestPath),
     Fs.fileFromPath(resDir),
     Fs.fileFromPath(assetsDir));

// If you change the package - don't forget to change the build.gradle and the AndroidManifest.xml
   manifest.setPackageName("com.soagrowers.android");
   // Robolectric is already going to look in the  'app' dir ...
   // so no need to add to package name
   return manifest;
 }
项目:FullRobolectricTestSample    文件:ShadowActivity.java   
public boolean setThemeFromManifest() {
  ShadowApplication shadowApplication = shadowOf(realActivity.getApplication());
  AndroidManifest appManifest = shadowApplication.getAppManifest();
  if (appManifest == null) return false;

  String themeRef = appManifest.getThemeRef(realActivity.getClass());

  if (themeRef != null) {
    ResName style = ResName.qualifyResName(themeRef.replace("@", ""), appManifest.getPackageName(), "style");
    Integer themeRes = shadowApplication.getResourceLoader().getResourceIndex().getResourceId(style);
    if (themeRes == null)
      throw new Resources.NotFoundException("no such theme " + style.getFullyQualifiedName());
    realActivity.setTheme(themeRes);
    return true;
  }
  return false;
}
项目:FullRobolectricTestSample    文件:RobolectricPackageManager.java   
@Override public ActivityInfo getActivityInfo(ComponentName className, int flags) throws NameNotFoundException {
  String packageName = className.getPackageName();
  AndroidManifest androidManifest = androidManifests.get(packageName);
  String activityName = className.getClassName();
  ActivityData activityData = androidManifest.getActivityData(activityName);
  ActivityInfo activityInfo = new ActivityInfo();
  activityInfo.packageName = packageName;
  activityInfo.name = activityName;
  if (activityData != null) {
    ResourceIndex resourceIndex = Robolectric.getShadowApplication().getResourceLoader().getResourceIndex();
    String themeRef;

    // Based on ShadowActivity
    if (activityData.getThemeRef() != null) {
      themeRef = activityData.getThemeRef();
    } else {
      themeRef = androidManifest.getThemeRef();
    }
    if (themeRef != null) {
      ResName style = ResName.qualifyResName(themeRef.replace("@", ""), packageName, "style");
      activityInfo.theme = resourceIndex.getResourceId(style);
    }
  }
  activityInfo.applicationInfo = getApplicationInfo(packageName, flags);
  return activityInfo;
}
项目:FullRobolectricTestSample    文件:RobolectricPackageManager.java   
@Override
public ActivityInfo getReceiverInfo(ComponentName className, int flags) throws NameNotFoundException {
  String packageName = className.getPackageName();
  AndroidManifest androidManifest = androidManifests.get(packageName);
  String classString = className.getClassName();
  int index = classString.indexOf('.');
  if (index == -1) {
    classString = packageName + "." + classString;
  } else if (index == 0) {
    classString = packageName + classString;
  }

  ActivityInfo activityInfo = new ActivityInfo();
  activityInfo.packageName = packageName;
  activityInfo.name = classString;
  if ((flags & GET_META_DATA) != 0) {
    for (int i = 0; i < androidManifest.getReceiverCount(); ++i) {
      if (androidManifest.getReceiverClassName(i).equals(classString)) {
        activityInfo.metaData = metaDataToBundle(androidManifest.getReceiverMetaData(i));
        break;
      }
    }
  }
  return activityInfo;
}
项目:FullRobolectricTestSample    文件:RobolectricPackageManager.java   
private List<ResolveInfo> queryImplicitIntent(Intent intent, int flags) {
  List<ResolveInfo> resolveInfoList = new ArrayList<ResolveInfo>();

  for (Map.Entry<String, AndroidManifest> androidManifest : androidManifests.entrySet()) {
    String packageName = androidManifest.getKey();
    AndroidManifest appManifest = androidManifest.getValue();

    for (Map.Entry<String, ActivityData> activity : appManifest.getActivityDatas().entrySet()) {
      String activityName = activity.getKey();
      ActivityData activityData = activity.getValue();

      if (matchIntentFilter(activityData, intent)) {
        ResolveInfo resolveInfo = new ResolveInfo();
        resolveInfo.resolvePackageName = packageName;
        resolveInfo.activityInfo = new ActivityInfo();
        resolveInfo.activityInfo.targetActivity = activityName;

        resolveInfoList.add(resolveInfo);
      }
    }
  }

  return resolveInfoList;
}
项目:CAS2016    文件:RosieRobolectricTestRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
  String manifestProperty = "../rosie/src/test/AndroidManifest.xml";
  String resProperty = "../rosie/src/main/res";
  return new AndroidManifest(Fs.fileFromPath(manifestProperty), Fs.fileFromPath(resProperty)) {
    @Override
    public int getTargetSdkVersion() {
      return MAX_SDK_SUPPORTED_BY_ROBOLECTRIC;
    }

  };
}
项目:foundry    文件:FoundryTestRunner.java   
@Override
protected AndroidManifest createAppManifest(final FsFile manifestFile, final FsFile resDir,
        final FsFile assetsDir) {
    FsFile moduleManifestFile = fixModuleDirectoryPathIfNeeded(manifestFile);
    FsFile moduleResDir = fixModuleDirectoryPathIfNeeded(resDir);
    FsFile moduleAssetsDir = fixModuleDirectoryPathIfNeeded(assetsDir);

    return super.createAppManifest(moduleManifestFile, moduleResDir, moduleAssetsDir);
}
项目:android-ePub-Library    文件:Runner.java   
public Runner(final Class<?> testClass) throws InitializationError {
    super(RobolectricContext.bootstrap(Runner.class, testClass, new RobolectricContext.Factory() {
        @Override
        public RobolectricContext create() {
            return new RobolectricContext() {
                @Override
                protected AndroidManifest createAppManifest() {
                    return new AndroidManifest(new File("build/tmp/android"));
                }
            };
        }
    }));
}
项目:simplefragment    文件:CustomRobolectricRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
    String path = "src/main/AndroidManifest.xml";

    // android studio has a different execution root for tests than pure gradle
    // so we avoid here manual effort to get them running inside android studio
    if (!new File(path).exists()) {
        path = "app/" + path;
    }

    config = overwriteConfig(config, "manifest", path);
    return super.getAppManifest(config);
}
项目:simplefragment    文件:CustomRobolectricRunner.java   
@Override
protected SdkConfig pickSdkVersion(
        AndroidManifest appManifest, Config config) {
    // current Robolectric supports not the latest android SDK version
    // so we must downgrade to simulate the latest supported version.
    config = overwriteConfig(config, "emulateSdk", "18");
    return super.pickSdkVersion(appManifest, config);
}
项目:interview_tasks    文件:RobojavaTestRunner.java   
private static AndroidManifest getAndroidManifest() {
    return new AndroidManifest(Fs.fileFromPath(MANIFEST),
            Fs.fileFromPath(RESOURCES),
            Fs.fileFromPath(ASSETS)) {
        @Override
        public int getTargetSdkVersion() {
            return TARGET_SDK_VERSION;
        }
    };
}
项目:interview_tasks    文件:RobojavaTestRunner.java   
private static AndroidManifest getAndroidManifest() {
    return new AndroidManifest(Fs.fileFromPath(MANIFEST),
            Fs.fileFromPath(RESOURCES),
            Fs.fileFromPath(ASSETS)) {
        @Override
        public int getTargetSdkVersion() {
            return TARGET_SDK_VERSION;
        }
    };
}
项目:joogar    文件:RobolectricGradleTestRunner.java   
@Override protected AndroidManifest getAppManifest(Config config) {
    String myAppPath = ClientApp.class.getProtectionDomain().getCodeSource().getLocation().getPath();
    String manifestPath = myAppPath + "../../../../src/main/AndroidManifest.xml";
    String resPath = myAppPath + "../../../../src/main/res";
    String assetPath = myAppPath + "../../../../src/main/assets";
    return createAppManifest(Fs.fileFromPath(manifestPath), Fs.fileFromPath(resPath), Fs.fileFromPath(assetPath));
}
项目:Nox    文件:NoxRobolectricTestRunner.java   
@Override protected AndroidManifest getAppManifest(Config config) {
  String manifestProperty = "../nox/src/test/AndroidManifest.xml";
  String resProperty = "../nox/src/main/res";
  return new AndroidManifest(Fs.fileFromPath(manifestProperty), Fs.fileFromPath(resProperty)) {
    @Override public int getTargetSdkVersion() {
      return MAX_SDK_SUPPORTED_BY_ROBOLECTRIC;
    }
  };
}
项目:FullRobolectricTestSample    文件:ShadowTypeface.java   
@HiddenApi @Implementation
public static int nativeCreateFromAsset(AssetManager mgr, String fontName) {
  List<String> paths = new ArrayList<String>();

  AndroidManifest appManifest = shadowOf(Robolectric.application).getAppManifest();
  paths.add(getAssetsPath(appManifest, fontName));

  List<AndroidManifest> libraryManifests = appManifest.getLibraryManifests();
  for (AndroidManifest libraryManifest : libraryManifests) {
    paths.add(getAssetsPath(libraryManifest, fontName));
  }

  return nativeCreateFromFile(paths);
}
项目:FullRobolectricTestSample    文件:ShadowAssetManager.java   
static AssetManager bind(AssetManager assetManager, AndroidManifest androidManifest, ResourceLoader resourceLoader) {
  ShadowAssetManager shadowAssetManager = shadowOf(assetManager);
  if (shadowAssetManager.appManifest != null) throw new RuntimeException("ResourceLoader already set!");
  shadowAssetManager.appManifest = androidManifest;
  shadowAssetManager.resourceLoader = resourceLoader;
  return assetManager;
}
项目:FullRobolectricTestSample    文件:ShadowApplication.java   
/**
 * Associates a {@code ResourceLoader} with an {@code Application} instance
 *
 * @param appManifest
 * @param resourceLoader resource loader
 */
public void bind(AndroidManifest appManifest, ResourceLoader resourceLoader) {
  if (this.resourceLoader != null) throw new RuntimeException("ResourceLoader already set!");
  this.appManifest = appManifest;
  this.resourceLoader = resourceLoader;

  if (appManifest != null) {
    setPackageName(appManifest.getPackageName());
    setApplicationName(appManifest.getApplicationName());

    this.registerBroadcastReceivers(appManifest);
  }
}
项目:FullRobolectricTestSample    文件:ShadowApplication.java   
private void registerBroadcastReceivers(AndroidManifest androidManifest) {
  for (int i = 0; i < androidManifest.getReceiverCount(); i++) {
    IntentFilter filter = new IntentFilter();
    for (String action : androidManifest.getReceiverIntentFilterActions(i)) {
      filter.addAction(action);
    }
    String receiverClassName = replaceLastDotWith$IfInnerStaticClass(androidManifest.getReceiverClassName(i));
    registerReceiver((BroadcastReceiver) newInstanceOf(receiverClassName), filter);
  }
}
项目:FullRobolectricTestSample    文件:ShadowContentResolver.java   
private static ContentProvider getProvider(String authority) {
  if (!providers.containsKey(authority)) {
    AndroidManifest manifest = Robolectric.getShadowApplication().getAppManifest();
    if (manifest != null) {
      for (ContentProviderData providerData : manifest.getContentProviders()) {
        if (providerData.getAuthority().equals(authority)) {
          providers.put(providerData.getAuthority(), createAndInitialize(providerData));
        }
      }
    }
  }
  return providers.get(authority);
}
项目:FullRobolectricTestSample    文件:RobolectricPackageManager.java   
public void addManifest(AndroidManifest androidManifest, ResourceLoader loader) {
  androidManifests.put(androidManifest.getPackageName(), androidManifest);
  ResourceIndex resourceIndex = loader.getResourceIndex();

  // first opportunity to access a resource index for this manifest, use it to init the references
  androidManifest.initMetaData(loader);

  PackageInfo packageInfo = new PackageInfo();
  packageInfo.packageName = androidManifest.getPackageName();
  packageInfo.versionName = androidManifest.getVersionName();
  packageInfo.versionCode = androidManifest.getVersionCode();

  ApplicationInfo applicationInfo = new ApplicationInfo();
  applicationInfo.flags = androidManifest.getApplicationFlags();
  applicationInfo.targetSdkVersion = androidManifest.getTargetSdkVersion();
  applicationInfo.packageName = androidManifest.getPackageName();
  applicationInfo.processName = androidManifest.getProcessName();
  applicationInfo.name = androidManifest.getApplicationName();
  applicationInfo.metaData = metaDataToBundle(androidManifest.getApplicationMetaData());

  if (androidManifest.getLabelRef() != null && resourceIndex != null) {
    Integer id = ResName.getResourceId(resourceIndex, androidManifest.getLabelRef(), androidManifest.getPackageName());
    applicationInfo.labelRes = id != null ? id : 0;
  }

  packageInfo.applicationInfo = applicationInfo;
  initApplicationInfo(applicationInfo);
  addPackage(packageInfo);
}
项目:FullRobolectricTestSample    文件:ActivityController.java   
private String getActivityTitle() {
  String title = null;

  /* Get the label for the activity from the manifest */
  ShadowApplication shadowApplication = shadowOf_(component.getApplication());
  AndroidManifest appManifest = shadowApplication.getAppManifest();
  if (appManifest == null) return null;
  String labelRef = appManifest.getActivityLabel(component.getClass());

  if (labelRef != null) {
    if(labelRef.startsWith("@")){
      /* Label refers to a string value, get the resource identifier */
      ResName style = ResName.qualifyResName(labelRef.replace("@", ""), appManifest.getPackageName(), "string");
      Integer labelRes = shadowApplication.getResourceLoader().getResourceIndex().getResourceId(style);

      /* If we couldn't determine the resource ID, throw it up */
      if (labelRes == null) {
        throw new Resources.NotFoundException("no such label " + style.getFullyQualifiedName());
      }

      /* Get the resource ID, use the activity to look up the actual string */
      title = component.getString(labelRes);
    } else {
      title = labelRef; /* Label isn't an identifier, use it directly as the title */
    }
  }

  return title;
}
项目:FullRobolectricTestSample    文件:ApplicationTest.java   
private AndroidManifest newConfigWith(String packageName, String contents) throws IOException {
  File f = temporaryFolder.newFile("whatever.xml",
      "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
          "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
          "          package=\"" + packageName + "\">\n" +
          "    " + contents + "\n" +
          "</manifest>\n");
  return new AndroidManifest(Fs.newFile(f), null, null);
}
项目:FullRobolectricTestSample    文件:TypefaceTest.java   
@Before
public void setup() throws Exception {
  AndroidManifest appManifest = shadowOf(Robolectric.application).getAppManifest();
  fontFile = temporaryAsset.createFile(appManifest, "myFont.ttf", "myFontData");

  List<AndroidManifest> libraryManifests = appManifest.getLibraryManifests();
  libraryFontFile = temporaryAsset.createFile(libraryManifests.get(0), "libFont.ttf", "libFontData");
}
项目:FullRobolectricTestSample    文件:ActivityTest.java   
@Test
public void shouldRetrievePackageNameFromTheManifest() throws Exception {
  AndroidManifest appManifest = newConfigWith("com.wacka.wa", "");
  Robolectric.application = new DefaultTestLifecycle().createApplication(null, appManifest);
  shadowOf(application).bind(appManifest, null);

  assertThat("com.wacka.wa").isEqualTo(new Activity().getPackageName());
}
项目:FullRobolectricTestSample    文件:ActivityTest.java   
private AndroidManifest newConfigWith(String packageName, String contents) throws IOException {
  File f = temporaryFolder.newFile("whatever.xml",
      "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
          "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
          "          package=\"" + packageName + "\">\n" +
          "    " + contents + "\n" +
          "</manifest>\n");
  return new AndroidManifest(Fs.newFile(f), null, null);
}
项目:FullRobolectricTestSample    文件:TemporaryAsset.java   
public File createFile(AndroidManifest manifest, String fileName, String contents) throws Exception {
  File assetBase = ((FileFsFile) manifest.getAssetsDirectory()).getFile();
  File file = new File(assetBase, fileName);
  file.getParentFile().mkdirs();

  FileWriter fileWriter = new FileWriter(file);
  try {
     fileWriter.write(contents);
  } finally {
    fileWriter.close();
  }

  assetsToDelete.add(file);
  return file;
}
项目:generator-android    文件:RobolectricGradleTestRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
    String manifestProperty = System.getProperty("android.manifest");
    if (config.manifest().equals(Config.DEFAULT)
            && manifestProperty != null) {
        String resProperty = System.getProperty("android.resources");
        String assetsProperty = System.getProperty("android.assets");
        return new AndroidManifest(Fs.fileFromPath(manifestProperty),
                Fs.fileFromPath(resProperty),
                Fs.fileFromPath(assetsProperty));
    }
    return super.getAppManifest(config);
}
项目:android-unittesting    文件:RobolectricGradleTestRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
    String manifestProperty = "../app/src/main/AndroidManifest.xml";
    String resProperty = "../app/src/main/res";
    String assetsProperty = "../app/src/main/assets";
    return new AndroidManifest(Fs.fileFromPath(manifestProperty), Fs.fileFromPath(resProperty), Fs.fileFromPath(assetsProperty)) {
        @Override
        public int getTargetSdkVersion() {
            return MAX_SDK_SUPPORTED_BY_ROBOLECTRIC;
        }
    };
}
项目:Speed-Toggle-Bluetooth    文件:RobolectricGradleTestRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
    String manifestProperty = System.getProperty("android.manifest");
    if (config.manifest().equals(Config.DEFAULT) && manifestProperty != null) {
        String resProperty = System.getProperty("android.resources");
        String assetsProperty = System.getProperty("android.assets");
        return new AndroidManifest(Fs.fileFromPath(manifestProperty), Fs.fileFromPath(resProperty),
                Fs.fileFromPath(assetsProperty));
    }
    AndroidManifest appManifest = super.getAppManifest(config);
    return appManifest;
}
项目:webpay-token-android    文件:RobolectricTestRunnerWithDummyResources.java   
@Override
protected ResourceLoader createAppResourceLoader(ResourceLoader systemResourceLoader, AndroidManifest appManifest) {
    List<PackageResourceLoader> appAndLibraryResourceLoaders = new ArrayList<PackageResourceLoader>();
    for (ResourcePath resourcePath : appManifest.getIncludedResourcePaths()) {
        appAndLibraryResourceLoaders.add(createResourceLoader(resourcePath));
    }
    OverlayResourceLoader overlayResourceLoader =
            new OverlayResourceLoaderWithDummyResources(
                    appManifest.getPackageName(), appAndLibraryResourceLoaders, systemResourceLoader);

    Map<String, ResourceLoader> resourceLoaders = new HashMap<String, ResourceLoader>();
    resourceLoaders.put("android", systemResourceLoader);
    resourceLoaders.put(appManifest.getPackageName(), overlayResourceLoader);
    return new RoutingResourceLoader(resourceLoaders);
}
项目:android-uploader    文件:RobolectricGradleRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
    String manifestProperty = "src/main/AndroidManifest.xml";
    String resProperty = "src/main/res";
    return new AndroidManifest(Fs.fileFromPath(manifestProperty), Fs.fileFromPath(resProperty)) {
        @Override
        public int getTargetSdkVersion() {
            return MAX_SDK_SUPPORTED_BY_ROBOLECTRIC;
        }
    };
}
项目:piwik-sdk-android    文件:FullEnvTestLifeCycle.java   
@Override
public Application createApplication(Method method, AndroidManifest appManifest, Config config) {
    // FIXME If a future version of Robolectric implements "setInstallerPackageName", remove this.
    RobolectricPackageManager oldManager = Robolectric.packageManager;
    RobolectricPackageManager newManager = new FullEnvPackageManager();
    for (PackageInfo pkg : oldManager.getInstalledPackages(0))
        newManager.addPackage(pkg);
    Robolectric.packageManager = newManager;
    return new PiwikTestApplication();
}
项目:TruckMuncher-Android    文件:ReadableRobolectricTestRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
    String manifestProperty = "src/main/AndroidManifest.xml";
    String resProperty = "src/main/res";
    return new AndroidManifest(Fs.fileFromPath(manifestProperty), Fs.fileFromPath(resProperty)) {
        @Override
        public int getTargetSdkVersion() {
            return 18;
        }
    };
}
项目:chailmis-android    文件:RobolectricGradleTestRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
    String manifestProperty = getProperty("android.manifest");
    if (config.manifest().equals(DEFAULT) && manifestProperty != null) {
        String resProperty = getProperty("android.resources");
        String assetsProperty = getProperty("android.assets");
        return new AndroidManifest(fileFromPath(manifestProperty), fileFromPath(resProperty), fileFromPath(assetsProperty));
    }
    return super.getAppManifest(config);
}
项目:open    文件:MapzenTestRunner.java   
/**
 * Uses custom manifest as workaround to maintain backward compatibility with library projects
 * that do not yet include the <code>&lt;application/&gt;</code> tag in AndroidManifest.xml.
 * <p />
 * See https://github.com/robolectric/robolectric/pull/1309 for more info.
 */
@Override
protected AndroidManifest createAppManifest(FsFile manifestFile,
        FsFile resDir, FsFile assetsDir) {
    AndroidManifest manifest = new MapzenAndroidManifest(manifestFile, resDir, assetsDir);
    String packageName = System.getProperty("android.package");
    manifest.setPackageName(packageName);
    return manifest;
}
项目:open    文件:MapzenTestRunner.java   
@Override
protected AndroidManifest getAppManifest(Config config) {
    String manifestProperty = System.getProperty("android.manifest");
    if (config.manifest().equals(Config.DEFAULT) && manifestProperty != null) {
        String resProperty = System.getProperty("android.resources");
        String assetsProperty = System.getProperty("android.assets");
        AndroidManifest androidManifest = new AndroidManifest(
                Fs.fileFromPath(manifestProperty),
                Fs.fileFromPath(resProperty),
                Fs.fileFromPath(assetsProperty));
        androidManifest.setPackageName("com.mapzen.open");
        return androidManifest;
    }
    return super.getAppManifest(config);
}