1// 2// Copyright (C) 2018 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 17package { 18 default_applicable_licenses: ["Android-Apache-2.0"], 19} 20 21java_defaults { 22 name: "NetworkStackTestsDefaults", 23 platform_apis: true, 24 srcs: ["src/**/*.java", "src/**/*.kt"], 25 resource_dirs: ["res"], 26 static_libs: [ 27 "androidx.test.ext.junit", 28 "androidx.test.rules", 29 "kotlin-reflect", 30 "mockito-target-extended-minus-junit4", 31 "net-tests-utils", 32 "testables", 33 ], 34 libs: [ 35 "android.test.runner", 36 "android.test.base", 37 "android.test.mock", 38 ], 39 defaults: [ 40 "framework-connectivity-test-defaults", 41 "libnetworkstackutilsjni_deps" 42 ], 43 jni_libs: [ 44 // For mockito extended 45 "libdexmakerjvmtiagent", 46 "libstaticjvmtiagent", 47 "libnetworkstackutilsjni", 48 ], 49 jni_uses_sdk_apis: true, 50 jarjar_rules: ":NetworkStackJarJarRules", 51} 52 53// Tests for NetworkStackNext. 54android_test { 55 name: "NetworkStackNextTests", 56 target_sdk_version: "current", 57 min_sdk_version: "29", 58 srcs: [], // TODO: tests that only apply to the current, non-stable API can be added here 59 test_suites: ["general-tests"], 60 test_mainline_modules: [ 61 "CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex", 62 "CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex" 63 ], 64 defaults: ["NetworkStackTestsDefaults"], 65 static_libs: ["NetworkStackApiCurrentLib"], 66 compile_multilib: "both", // Workaround for b/147785146 for mainline-presubmit 67} 68 69// Library containing the unit tests. This is used by the coverage test target to pull in the 70// unit test code. It is not currently used by the tests themselves because all the build 71// configuration needed by the tests is in the NetworkStackTestsDefaults rule. 72android_library { 73 name: "NetworkStackTestsLib", 74 min_sdk_version: "29", 75 defaults: ["NetworkStackTestsDefaults"], 76 static_libs: ["NetworkStackApiStableLib"], 77 visibility: [ 78 "//packages/modules/NetworkStack/tests/integration", 79 "//packages/modules/Connectivity/tests:__subpackages__", 80 "//packages/modules/Connectivity/Tethering/tests:__subpackages__", 81 ] 82} 83 84android_test { 85 name: "NetworkStackTests", 86 min_sdk_version: "29", 87 target_sdk_version: "30", 88 test_suites: ["general-tests", "mts"], 89 test_mainline_modules: [ 90 "CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex", 91 "CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex" 92 ], 93 defaults: ["NetworkStackTestsDefaults"], 94 static_libs: ["NetworkStackApiStableLib"], 95 compile_multilib: "both", 96} 97 98// Additional dependencies of libnetworkstackutilsjni that are not provided by the system when 99// running as a test application. 100// Using java_defaults as jni_libs does not support filegroups. 101java_defaults { 102 name: "libnetworkstackutilsjni_deps", 103 jni_libs: [ 104 "libnativehelper_compat_libc++", 105 "libnetworkstacktestsjni", 106 ], 107} 108