blob: 28339f116d298d40c24742bc989c943c6fe812db [file] [log] [blame]
Remi NGUYEN VAN678277c2021-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 Uddin2afd0982021-05-24 03:50:01 +000021 default_applicable_licenses: ["Android-Apache-2.0"],
Remi NGUYEN VAN678277c2021-05-11 13:37:06 +000022}
23
24java_library {
25 name: "FrameworksNetCommonTests",
26 defaults: ["framework-connectivity-test-defaults"],
27 srcs: [
28 "java/**/*.java",
29 "java/**/*.kt",
30 ],
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 VANdc56aa22021-05-14 07:24:53 +000045
Remi NGUYEN VAN168b3d12021-06-21 13:36:05 +000046android_test {
47 name: "ConnectivityCoverageTests",
48 // Tethering started on SDK 30
49 min_sdk_version: "30",
50 // TODO: change to 31 as soon as it is available
51 target_sdk_version: "30",
52 test_suites: ["device-tests", "mts"],
53 defaults: [
54 "framework-connectivity-test-defaults",
55 "FrameworksNetTests-jni-defaults",
56 "libnetworkstackutilsjni_deps",
57 ],
58 manifest: "AndroidManifest_coverage.xml",
59 test_config: "AndroidTest_Coverage.xml",
60 static_libs: [
61 // Added first so all tests use extended mockito, instead of all tests using regular mockito
62 // (some tests would fail).
63 // TODO: consider removing extended mockito usage in tests that use it, for performance
64 "mockito-target-extended-minus-junit4",
65 "FrameworksNetTestsLib",
66 "modules-utils-native-coverage-listener",
67 "NetdStaticLibTestsLib",
68 "NetworkStaticLibTestsLib",
69 "NetworkStackTestsLib",
70 "TetheringTestsLatestSdkLib",
71 "TetheringIntegrationTestsLatestSdkLib",
72 ],
73 jni_libs: [
74 // For mockito extended
75 "libdexmakerjvmtiagent",
76 "libstaticjvmtiagent",
77 // For NetworkStackUtils included in NetworkStackBase
78 "libnetworkstackutilsjni",
79 "libtetherutilsjni",
80 // For framework tests
81 "libservice-connectivity",
82 ],
83 libs: [
84 // Although not required to compile the static libs together, the "libs" used to build each
85 // of the common static test libs are necessary for R8 to avoid "Missing class" warnings and
86 // incorrect optimizations
87 "framework-tethering.impl",
88 "framework-wifi.stubs.module_lib",
89 ],
90 compile_multilib: "both",
91}
92
Remi NGUYEN VANdc56aa22021-05-14 07:24:53 +000093// defaults for tests that need to build against framework-connectivity's @hide APIs
94// Only usable from targets that have visibility on framework-connectivity.impl.
95// Instead of using this, consider avoiding to depend on hidden connectivity APIs in
96// tests.
97java_defaults {
98 name: "framework-connectivity-test-defaults",
99 sdk_version: "core_platform", // tests can use @CorePlatformApi's
100 libs: [
101 // order matters: classes in framework-connectivity are resolved before framework,
102 // meaning @hide APIs in framework-connectivity are resolved before @SystemApi
103 // stubs in framework
104 "framework-connectivity.impl",
105 "framework",
106
107 // if sdk_version="" this gets automatically included, but here we need to add manually.
108 "framework-res",
109 ],
110}