| 1 |
// Copyright (C) 2021 The Android Open Source Project |
| 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 { |
| 16 |
default_applicable_licenses: ["Android-Apache-2.0"], |
| 17 |
} |
| 18 |
|
| 19 |
java_defaults { |
| 20 |
name: "ComponentAliasTests_defaults", |
| 21 |
static_libs: [ |
| 22 |
"androidx.test.rules", |
| 23 |
"compatibility-device-util-axt", |
| 24 |
"mockito-target-extended-minus-junit4", |
| 25 |
"truth-prebuilt", |
| 26 |
"ub-uiautomator", |
| 27 |
], |
| 28 |
libs: ["android.test.base"], |
| 29 |
srcs: [ |
| 30 |
"src/**/*.java", |
| 31 |
], |
| 32 |
test_suites: [ |
| 33 |
"general-tests", |
| 34 |
], |
| 35 |
platform_apis: true, // We use hidden APIs in the test. |
| 36 |
} |
| 37 |
|
| 38 |
// We build three APKs from the exact same source files, so these APKs contain the exact same tests. |
| 39 |
// And we run the tests on each APK, so that we can test various situations: |
| 40 |
// - When the alias is in the same package, target in the same package. |
| 41 |
// - When the alias is in the same package, target in another package. |
| 42 |
// - When the alias is in another package, which also contains the target. |
| 43 |
// - When the alias is in another package, and the target is in yet another package. |
| 44 |
// etc etc... |
| 45 |
|
| 46 |
android_test { |
| 47 |
name: "ComponentAliasTests", |
| 48 |
defaults: [ |
| 49 |
"ComponentAliasTests_defaults", |
| 50 |
], |
| 51 |
package_name: "android.content.componentalias.tests", |
| 52 |
manifest: "AndroidManifest.xml", |
| 53 |
additional_manifests: [ |
| 54 |
"AndroidManifest_main.xml", |
| 55 |
"AndroidManifest_service_aliases.xml", |
| 56 |
"AndroidManifest_service_targets.xml", |
| 57 |
], |
| 58 |
test_config_template: "AndroidTest-template.xml", |
| 59 |
} |
| 60 |
|
| 61 |
android_test { |
| 62 |
name: "ComponentAliasTests1", |
| 63 |
defaults: [ |
| 64 |
"ComponentAliasTests_defaults", |
| 65 |
], |
| 66 |
package_name: "android.content.componentalias.tests.sub1", |
| 67 |
manifest: "AndroidManifest.xml", |
| 68 |
additional_manifests: [ |
| 69 |
"AndroidManifest_sub1.xml", |
| 70 |
"AndroidManifest_service_targets.xml", |
| 71 |
], |
| 72 |
test_config_template: "AndroidTest-template.xml", |
| 73 |
} |
| 74 |
|
| 75 |
android_test { |
| 76 |
name: "ComponentAliasTests2", |
| 77 |
defaults: [ |
| 78 |
"ComponentAliasTests_defaults", |
| 79 |
], |
| 80 |
package_name: "android.content.componentalias.tests.sub2", |
| 81 |
manifest: "AndroidManifest.xml", |
| 82 |
additional_manifests: [ |
| 83 |
"AndroidManifest_sub2.xml", |
| 84 |
"AndroidManifest_service_targets.xml", |
| 85 |
], |
| 86 |
test_config_template: "AndroidTest-template.xml", |
| 87 |
} |