use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AndroidManifestValidatorTest method assetModuleWithInstantAttributeAndInstantDeliveryElement_throws.
@Test
public void assetModuleWithInstantAttributeAndInstantDeliveryElement_throws() throws Exception {
BundleModule featureModule = new BundleModuleBuilder("asset_module").setManifest(androidManifestForAssetModule(PKG_NAME, withInstantOnDemandDelivery(), withInstant(true))).build();
Throwable exception = assertThrows(InvalidBundleException.class, () -> new AndroidManifestValidator().validateModule(featureModule));
assertThat(exception).hasMessageThat().contains("The <dist:instant-delivery> element and dist:instant attribute cannot be used" + " together (module: 'asset_module').");
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AndroidManifestValidatorTest method withMultipleDistinctSplitIds_throws.
@Test
public void withMultipleDistinctSplitIds_throws() throws Exception {
BundleModule module = new BundleModuleBuilder(FEATURE_MODULE_NAME).setManifest(androidManifestForFeature(PKG_NAME, withSplitId(FEATURE_MODULE_NAME), withSecondSplitId("modulesplitname2"))).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new AndroidManifestValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("attribute 'split' cannot be declared more than once");
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AndroidManifestValidatorTest method assetModuleWithConditionalTargeting_throws.
@Test
public void assetModuleWithConditionalTargeting_throws() throws Exception {
BundleModule module = new BundleModuleBuilder("assetmodule").setManifest(androidManifestForAssetModule(PKG_NAME, withFeatureCondition("camera"))).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new AndroidManifestValidator().validateModule(module));
assertThat(exception).hasMessageThat().matches("Conditional targeting is not allowed in asset packs, but found in 'assetmodule'.");
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AndroidManifestValidatorTest method base_withOnDemandAttributeSetToFalse_ok.
@Test
public void base_withOnDemandAttributeSetToFalse_ok() throws Exception {
BundleModule module = new BundleModuleBuilder(BASE_MODULE_NAME).setManifest(androidManifest(PKG_NAME, withOnDemandAttribute(false))).build();
new AndroidManifestValidator().validateModule(module);
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AndroidManifestValidatorTest method installTimeAndOnDemandDeliveryAndInstantAttributeSetToTrue_ok.
@Test
public void installTimeAndOnDemandDeliveryAndInstantAttributeSetToTrue_ok() throws Exception {
// On-demand delivery element does not make a module on-demand if install-time element is
// present.
BundleModule module = new BundleModuleBuilder(FEATURE_MODULE_NAME).setManifest(androidManifest(PKG_NAME, withInstallTimeDelivery(), withOnDemandDelivery(), withInstant(true), withFusingAttribute(true))).build();
new AndroidManifestValidator().validateModule(module);
}
Aggregations