| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 1 | // | 
 | 2 | // Copyright (C) 2019 The Android Open Source Project | 
 | 3 | // | 
 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
 | 5 | // you may not use this file except in compliance with the License. | 
 | 6 | // You may obtain a copy of the License at | 
 | 7 | // | 
 | 8 | //      http://www.apache.org/licenses/LICENSE-2.0 | 
 | 9 | // | 
 | 10 | // Unless required by applicable law or agreed to in writing, software | 
 | 11 | // distributed under the License is distributed on an "AS IS" BASIS, | 
 | 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | 13 | // See the License for the specific language governing permissions and | 
 | 14 | // limitations under the License. | 
 | 15 | // | 
 | 16 |  | 
 | 17 | // Tests in this folder are included both in unit tests and CTS. | 
 | 18 | // They must be fast and stable, and exercise public or test APIs. | 
 | 19 | package { | 
 | 20 |     // See: http://go/android-license-faq | 
| Baligh Uddin | 3684713 | 2021-05-23 16:38:40 +0000 | [diff] [blame] | 21 |     default_applicable_licenses: ["Android-Apache-2.0"], | 
| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 22 | } | 
 | 23 |  | 
 | 24 | java_library { | 
 | 25 |     name: "FrameworksNetCommonTests", | 
| Remi NGUYEN VAN | 3912c80 | 2021-03-16 01:31:07 +0000 | [diff] [blame] | 26 |     defaults: ["framework-connectivity-test-defaults"], | 
 | 27 |     srcs: [ | 
 | 28 |         "java/**/*.java", | 
 | 29 |         "java/**/*.kt", | 
 | 30 |     ], | 
| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 31 |     static_libs: [ | 
 | 32 |         "androidx.core_core", | 
 | 33 |         "androidx.test.rules", | 
 | 34 |         "junit", | 
 | 35 |         "mockito-target-minus-junit4", | 
 | 36 |         "modules-utils-build", | 
 | 37 |         "net-tests-utils", | 
 | 38 |         "net-utils-framework-common", | 
 | 39 |         "platform-test-annotations", | 
 | 40 |     ], | 
 | 41 |     libs: [ | 
 | 42 |         "android.test.base.stubs", | 
 | 43 |     ], | 
 | 44 | } | 
| Remi NGUYEN VAN | 679a8e0 | 2021-05-14 07:24:53 +0000 | [diff] [blame] | 45 |  | 
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 46 | // Connectivity coverage tests combines Tethering and Connectivity tests, each with their | 
 | 47 | // respective jarjar rules applied. | 
 | 48 | // Some tests may be duplicated (in particular static lib tests), as they need to be run under both | 
 | 49 | // jarjared packages to cover both usages. | 
 | 50 | android_library { | 
 | 51 |     name: "ConnectivityCoverageTestsLib", | 
 | 52 |     min_sdk_version: "30", | 
 | 53 |     static_libs: [ | 
 | 54 |         "FrameworksNetTestsLib", | 
 | 55 |         "NetdStaticLibTestsLib", | 
 | 56 |         "NetworkStaticLibTestsLib", | 
 | 57 |     ], | 
 | 58 |     jarjar_rules: ":connectivity-jarjar-rules", | 
 | 59 |     manifest: "AndroidManifest_coverage.xml", | 
 | 60 |     visibility: ["//visibility:private"], | 
 | 61 | } | 
 | 62 |  | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 63 | android_test { | 
 | 64 |     name: "ConnectivityCoverageTests", | 
 | 65 |     // Tethering started on SDK 30 | 
 | 66 |     min_sdk_version: "30", | 
| Chiachang Wang | 76df50c | 2021-12-22 17:47:26 +0800 | [diff] [blame] | 67 |     target_sdk_version: "31", | 
| Kimberly Kreider | c5b3f34 | 2021-10-20 18:16:59 +0000 | [diff] [blame] | 68 |     test_suites: ["general-tests", "mts-tethering"], | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 69 |     defaults: [ | 
 | 70 |         "framework-connectivity-test-defaults", | 
 | 71 |         "FrameworksNetTests-jni-defaults", | 
 | 72 |         "libnetworkstackutilsjni_deps", | 
 | 73 |     ], | 
 | 74 |     manifest: "AndroidManifest_coverage.xml", | 
 | 75 |     test_config: "AndroidTest_Coverage.xml", | 
 | 76 |     static_libs: [ | 
 | 77 |         // Added first so all tests use extended mockito, instead of all tests using regular mockito | 
 | 78 |         // (some tests would fail). | 
 | 79 |         // TODO: consider removing extended mockito usage in tests that use it, for performance | 
 | 80 |         "mockito-target-extended-minus-junit4", | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 81 |         "modules-utils-native-coverage-listener", | 
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 82 |         "ConnectivityCoverageTestsLib", | 
 | 83 |         "TetheringCoverageTestsLib", | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 84 |     ], | 
 | 85 |     jni_libs: [ | 
 | 86 |         // For mockito extended | 
 | 87 |         "libdexmakerjvmtiagent", | 
 | 88 |         "libstaticjvmtiagent", | 
 | 89 |         // For NetworkStackUtils included in NetworkStackBase | 
 | 90 |         "libnetworkstackutilsjni", | 
| markchien | f967b11 | 2021-11-09 16:56:23 +0800 | [diff] [blame] | 91 |         "libcom_android_networkstack_tethering_util_jni", | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 92 |         // For framework tests | 
 | 93 |         "libservice-connectivity", | 
 | 94 |     ], | 
 | 95 |     libs: [ | 
 | 96 |         // Although not required to compile the static libs together, the "libs" used to build each | 
 | 97 |         // of the common static test libs are necessary for R8 to avoid "Missing class" warnings and | 
 | 98 |         // incorrect optimizations | 
 | 99 |         "framework-tethering.impl", | 
 | 100 |         "framework-wifi.stubs.module_lib", | 
 | 101 |     ], | 
 | 102 |     compile_multilib: "both", | 
 | 103 | } | 
 | 104 |  | 
| Remi NGUYEN VAN | 679a8e0 | 2021-05-14 07:24:53 +0000 | [diff] [blame] | 105 | // defaults for tests that need to build against framework-connectivity's @hide APIs | 
 | 106 | // Only usable from targets that have visibility on framework-connectivity.impl. | 
 | 107 | // Instead of using this, consider avoiding to depend on hidden connectivity APIs in | 
 | 108 | // tests. | 
 | 109 | java_defaults { | 
 | 110 |     name: "framework-connectivity-test-defaults", | 
 | 111 |     sdk_version: "core_platform", // tests can use @CorePlatformApi's | 
 | 112 |     libs: [ | 
 | 113 |         // order matters: classes in framework-connectivity are resolved before framework, | 
 | 114 |         // meaning @hide APIs in framework-connectivity are resolved before @SystemApi | 
 | 115 |         // stubs in framework | 
 | 116 |         "framework-connectivity.impl", | 
| paulhu | 802ab97 | 2021-12-14 01:30:22 +0000 | [diff] [blame] | 117 |         "framework-connectivity-tiramisu.impl", | 
| markchien | 2fbd3e7 | 2021-08-17 23:59:09 +0800 | [diff] [blame] | 118 |         "framework-tethering.impl", | 
| Remi NGUYEN VAN | 679a8e0 | 2021-05-14 07:24:53 +0000 | [diff] [blame] | 119 |         "framework", | 
 | 120 |  | 
 | 121 |         // if sdk_version="" this gets automatically included, but here we need to add manually. | 
 | 122 |         "framework-res", | 
 | 123 |     ], | 
 | 124 | } | 
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 125 |  | 
| Lorenzo Colitti | be53da1 | 2022-01-18 00:27:59 +0900 | [diff] [blame] | 126 | // Defaults for tests that want to run in mainline-presubmit. | 
 | 127 | // Not widely used because many of our tests have AndroidTest.xml files and | 
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 128 | // use the mainline-param config-descriptor metadata in AndroidTest.xml. | 
| Lorenzo Colitti | be53da1 | 2022-01-18 00:27:59 +0900 | [diff] [blame] | 129 |  | 
 | 130 | // test_mainline_modules is an array of strings. Each element in the array is a list of modules | 
 | 131 | // separated by "+". The modules in this list must be in alphabetical order. | 
 | 132 | // See SuiteModuleLoader.java. | 
 | 133 | // TODO: why are the modules separated by + instead of being separate entries in the array? | 
 | 134 | mainline_presubmit_modules = [ | 
 | 135 |         "CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex", | 
 | 136 | ] | 
 | 137 |  | 
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 138 | cc_defaults { | 
 | 139 |     name: "connectivity-mainline-presubmit-cc-defaults", | 
| Lorenzo Colitti | be53da1 | 2022-01-18 00:27:59 +0900 | [diff] [blame] | 140 |     test_mainline_modules: mainline_presubmit_modules, | 
 | 141 | } | 
 | 142 |  | 
 | 143 | java_defaults { | 
 | 144 |     name: "connectivity-mainline-presubmit-java-defaults", | 
 | 145 |     test_mainline_modules: mainline_presubmit_modules, | 
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 146 | } |