blob: f47f6b0400bd91f842136bfcf94295ccf154f75d [file] [log] [blame]
Remi NGUYEN VAN31022d62021-05-11 13:37:06 +00001//
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.
19package {
20 // See: http://go/android-license-faq
Baligh Uddin36847132021-05-23 16:38:40 +000021 default_applicable_licenses: ["Android-Apache-2.0"],
Remi NGUYEN VAN31022d62021-05-11 13:37:06 +000022}
23
24java_library {
25 name: "FrameworksNetCommonTests",
Remi NGUYEN VAN3912c802021-03-16 01:31:07 +000026 defaults: ["framework-connectivity-test-defaults"],
27 srcs: [
28 "java/**/*.java",
29 "java/**/*.kt",
30 ],
Remi NGUYEN VAN31022d62021-05-11 13:37:06 +000031 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 VAN679a8e02021-05-14 07:24:53 +000045
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +090046// 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.
50android_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 VANfe20e132021-06-07 13:10:49 +090063android_test {
64 name: "ConnectivityCoverageTests",
65 // Tethering started on SDK 30
66 min_sdk_version: "30",
67 // TODO: change to 31 as soon as it is available
68 target_sdk_version: "30",
Kimberly Kreiderc5b3f342021-10-20 18:16:59 +000069 test_suites: ["general-tests", "mts-tethering"],
Remi NGUYEN VANfe20e132021-06-07 13:10:49 +090070 defaults: [
71 "framework-connectivity-test-defaults",
72 "FrameworksNetTests-jni-defaults",
73 "libnetworkstackutilsjni_deps",
74 ],
75 manifest: "AndroidManifest_coverage.xml",
76 test_config: "AndroidTest_Coverage.xml",
77 static_libs: [
78 // Added first so all tests use extended mockito, instead of all tests using regular mockito
79 // (some tests would fail).
80 // TODO: consider removing extended mockito usage in tests that use it, for performance
81 "mockito-target-extended-minus-junit4",
Remi NGUYEN VANfe20e132021-06-07 13:10:49 +090082 "modules-utils-native-coverage-listener",
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +090083 "ConnectivityCoverageTestsLib",
84 "TetheringCoverageTestsLib",
Remi NGUYEN VANfe20e132021-06-07 13:10:49 +090085 ],
86 jni_libs: [
87 // For mockito extended
88 "libdexmakerjvmtiagent",
89 "libstaticjvmtiagent",
90 // For NetworkStackUtils included in NetworkStackBase
91 "libnetworkstackutilsjni",
markchienf967b112021-11-09 16:56:23 +080092 "libcom_android_networkstack_tethering_util_jni",
Remi NGUYEN VANfe20e132021-06-07 13:10:49 +090093 // For framework tests
94 "libservice-connectivity",
95 ],
96 libs: [
97 // Although not required to compile the static libs together, the "libs" used to build each
98 // of the common static test libs are necessary for R8 to avoid "Missing class" warnings and
99 // incorrect optimizations
100 "framework-tethering.impl",
101 "framework-wifi.stubs.module_lib",
102 ],
103 compile_multilib: "both",
104}
105
Remi NGUYEN VAN679a8e02021-05-14 07:24:53 +0000106// defaults for tests that need to build against framework-connectivity's @hide APIs
107// Only usable from targets that have visibility on framework-connectivity.impl.
108// Instead of using this, consider avoiding to depend on hidden connectivity APIs in
109// tests.
110java_defaults {
111 name: "framework-connectivity-test-defaults",
112 sdk_version: "core_platform", // tests can use @CorePlatformApi's
113 libs: [
114 // order matters: classes in framework-connectivity are resolved before framework,
115 // meaning @hide APIs in framework-connectivity are resolved before @SystemApi
116 // stubs in framework
117 "framework-connectivity.impl",
markchien2fbd3e72021-08-17 23:59:09 +0800118 "framework-tethering.impl",
Remi NGUYEN VAN679a8e02021-05-14 07:24:53 +0000119 "framework",
120
121 // if sdk_version="" this gets automatically included, but here we need to add manually.
122 "framework-res",
123 ],
124}