Rupert Shuttleworth | 5c4881c | 2021-07-28 06:21:31 -0400 | [diff] [blame] | 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 | |
| 15 | package bp2build |
| 16 | |
| 17 | import ( |
| 18 | "android/soong/android" |
| 19 | "android/soong/java" |
| 20 | |
| 21 | "testing" |
| 22 | ) |
| 23 | |
Sam Delmerico | 3177a6e | 2022-06-21 19:28:33 +0000 | [diff] [blame] | 24 | func runAndroidAppCertificateTestCase(t *testing.T, tc Bp2buildTestCase) { |
Rupert Shuttleworth | 5c4881c | 2021-07-28 06:21:31 -0400 | [diff] [blame] | 25 | t.Helper() |
Sam Delmerico | 3177a6e | 2022-06-21 19:28:33 +0000 | [diff] [blame] | 26 | RunBp2BuildTestCase(t, registerAndroidAppCertificateModuleTypes, tc) |
Rupert Shuttleworth | 5c4881c | 2021-07-28 06:21:31 -0400 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | func registerAndroidAppCertificateModuleTypes(ctx android.RegistrationContext) { |
| 30 | } |
| 31 | |
| 32 | func TestAndroidAppCertificateSimple(t *testing.T) { |
Sam Delmerico | 3177a6e | 2022-06-21 19:28:33 +0000 | [diff] [blame] | 33 | runAndroidAppCertificateTestCase(t, Bp2buildTestCase{ |
| 34 | Description: "Android app certificate - simple example", |
| 35 | ModuleTypeUnderTest: "android_app_certificate", |
| 36 | ModuleTypeUnderTestFactory: java.AndroidAppCertificateFactory, |
| 37 | Filesystem: map[string]string{}, |
| 38 | Blueprint: ` |
Rupert Shuttleworth | 5c4881c | 2021-07-28 06:21:31 -0400 | [diff] [blame] | 39 | android_app_certificate { |
| 40 | name: "com.android.apogee.cert", |
| 41 | certificate: "chamber_of_secrets_dir", |
| 42 | } |
| 43 | `, |
Sam Delmerico | 3177a6e | 2022-06-21 19:28:33 +0000 | [diff] [blame] | 44 | ExpectedBazelTargets: []string{ |
| 45 | MakeBazelTargetNoRestrictions("android_app_certificate", "com.android.apogee.cert", AttrNameToString{ |
Liz Kammer | 78cfdaa | 2021-11-08 12:56:31 -0500 | [diff] [blame] | 46 | "certificate": `"chamber_of_secrets_dir"`, |
| 47 | }), |
| 48 | }}) |
Rupert Shuttleworth | 5c4881c | 2021-07-28 06:21:31 -0400 | [diff] [blame] | 49 | } |