android_app_certificate_conversion_test.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2021 Google Inc. All rights reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package bp2build
  15. import (
  16. "android/soong/android"
  17. "android/soong/java"
  18. "testing"
  19. )
  20. func runAndroidAppCertificateTestCase(t *testing.T, tc Bp2buildTestCase) {
  21. t.Helper()
  22. RunBp2BuildTestCase(t, registerAndroidAppCertificateModuleTypes, tc)
  23. }
  24. func registerAndroidAppCertificateModuleTypes(ctx android.RegistrationContext) {
  25. }
  26. func TestAndroidAppCertificateSimple(t *testing.T) {
  27. runAndroidAppCertificateTestCase(t, Bp2buildTestCase{
  28. Description: "Android app certificate - simple example",
  29. ModuleTypeUnderTest: "android_app_certificate",
  30. ModuleTypeUnderTestFactory: java.AndroidAppCertificateFactory,
  31. Filesystem: map[string]string{},
  32. Blueprint: `
  33. android_app_certificate {
  34. name: "com.android.apogee.cert",
  35. certificate: "chamber_of_secrets_dir",
  36. }
  37. `,
  38. ExpectedBazelTargets: []string{
  39. MakeBazelTargetNoRestrictions("android_app_certificate", "com.android.apogee.cert", AttrNameToString{
  40. "certificate": `"chamber_of_secrets_dir"`,
  41. }),
  42. }})
  43. }