Merge "[soong] new field in Android.bp to request APK signing V4" into rvc-dev am: 0ed9a7d674 am: 9e350cce74

Change-Id: I53501c26d3314508058f5dac5901438e9cba212d
This commit is contained in:
Songchun Fan
2020-03-26 18:21:37 +00:00
committed by Automerger Merge Worker
4 changed files with 94 additions and 8 deletions

View File

@@ -1074,6 +1074,66 @@ func TestCertificates(t *testing.T) {
}
}
func TestRequestV4SigningFlag(t *testing.T) {
testCases := []struct {
name string
bp string
expected string
}{
{
name: "default",
bp: `
android_app {
name: "foo",
srcs: ["a.java"],
sdk_version: "current",
}
`,
expected: "",
},
{
name: "default",
bp: `
android_app {
name: "foo",
srcs: ["a.java"],
sdk_version: "current",
v4_signature: false,
}
`,
expected: "",
},
{
name: "module certificate property",
bp: `
android_app {
name: "foo",
srcs: ["a.java"],
sdk_version: "current",
v4_signature: true,
}
`,
expected: "--enable-v4",
},
}
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
config := testAppConfig(nil, test.bp, nil)
ctx := testContext()
run(t, ctx, config)
foo := ctx.ModuleForTests("foo", "android_common")
signapk := foo.Output("foo.apk")
signFlags := signapk.Args["flags"]
if test.expected != signFlags {
t.Errorf("Incorrect signing flags, expected: %q, got: %q", test.expected, signFlags)
}
})
}
}
func TestPackageNameOverride(t *testing.T) {
testCases := []struct {
name string