Add default_dev_cert to android_app_import

Test: app_test.go
Bug: 122333215
Bug: 128610294
Change-Id: I4be98a57ffec0885258ed7d7bb2badc8b2798750
This commit is contained in:
Jaewoong Jung
2019-08-22 14:25:58 -07:00
parent bdefa541d9
commit 961d4fdd5b
2 changed files with 52 additions and 10 deletions

View File

@@ -1164,6 +1164,35 @@ func TestAndroidAppImport_Presigned(t *testing.T) {
}
}
func TestAndroidAppImport_DefaultDevCert(t *testing.T) {
ctx, _ := testJava(t, `
android_app_import {
name: "foo",
apk: "prebuilts/apk/app.apk",
default_dev_cert: true,
dex_preopt: {
enabled: true,
},
}
`)
variant := ctx.ModuleForTests("foo", "android_common")
// Check dexpreopt outputs.
if variant.MaybeOutput("dexpreopt/oat/arm64/package.vdex").Rule == nil ||
variant.MaybeOutput("dexpreopt/oat/arm64/package.odex").Rule == nil {
t.Errorf("can't find dexpreopt outputs")
}
// Check cert signing flag.
signedApk := variant.Output("signed/foo.apk")
signingFlag := signedApk.Args["certificates"]
expected := "build/make/target/product/security/testkey.x509.pem build/make/target/product/security/testkey.pk8"
if expected != signingFlag {
t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
}
}
func TestAndroidAppImport_DpiVariants(t *testing.T) {
bp := `
android_app_import {
@@ -1177,7 +1206,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) {
apk: "prebuilts/apk/app_xxhdpi.apk",
},
},
certificate: "PRESIGNED",
presigned: true,
dex_preopt: {
enabled: true,
},
@@ -1307,7 +1336,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) {
apk: "prebuilts/apk/app_arm64.apk",
},
},
certificate: "PRESIGNED",
presigned: true,
dex_preopt: {
enabled: true,
},
@@ -1326,7 +1355,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) {
apk: "prebuilts/apk/app_arm.apk",
},
},
certificate: "PRESIGNED",
presigned: true,
dex_preopt: {
enabled: true,
},