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
17package {
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21java_defaults {
22    name: "NetworkStackIntegrationTestsJniDefaults",
23    defaults: ["libnetworkstackutilsjni_deps"],
24    jni_libs: [
25        // For mockito extended
26        "libdexmakerjvmtiagent",
27        "libstaticjvmtiagent",
28        // For NetworkStackUtils included in NetworkStackBase
29        "libnetworkstackutilsjni",
30    ],
31    jni_uses_sdk_apis: true,
32    visibility: ["//visibility:private"],
33}
34
35java_defaults {
36    name: "NetworkStackIntegrationTestsDefaults",
37    srcs: [
38        "src/**/*.java",
39        "src/**/*.kt",
40    ],
41    static_libs: [
42        "androidx.annotation_annotation",
43        "androidx.test.rules",
44        "mockito-target-extended-minus-junit4",
45        "net-tests-utils",
46        "testables",
47    ],
48    libs: [
49        "android.test.runner",
50        "android.test.base",
51        "android.test.mock",
52    ],
53    jarjar_rules: ":NetworkStackJarJarRules",
54    visibility: ["//visibility:private"],
55}
56
57android_library {
58    name: "NetworkStackIntegrationTestsLib",
59    defaults: ["NetworkStackIntegrationTestsDefaults"],
60    min_sdk_version: "29",
61    static_libs: [
62        "NetworkStackApiStableLib",
63    ],
64}
65
66// Network stack integration tests.
67android_test {
68    name: "NetworkStackIntegrationTests",
69    defaults: ["NetworkStackIntegrationTestsJniDefaults"],
70    static_libs: ["NetworkStackIntegrationTestsLib"],
71    certificate: "networkstack",
72    platform_apis: true,
73    test_suites: ["device-tests"],
74    min_sdk_version: "29",
75}
76
77// Network stack next integration tests.
78android_test {
79    name: "NetworkStackNextIntegrationTests",
80    defaults: [
81        "NetworkStackIntegrationTestsDefaults",
82        "NetworkStackIntegrationTestsJniDefaults",
83    ],
84    static_libs: [
85        "NetworkStackApiCurrentLib",
86    ],
87    certificate: "networkstack",
88    platform_apis: true,
89    test_suites: ["device-tests"],
90}
91
92// The static lib needs to be jarjared by each module so they do not conflict with each other
93// (e.g. wifi, system server, network stack need to use different package names when including it).
94// Apply NetworkStack jarjar rules to the tests as well so classes in NetworkStaticLibTests have the
95// same package names as in module code.
96android_library {
97    name: "NetworkStackStaticLibTestsLib",
98    platform_apis: true,
99    min_sdk_version: "29",
100    jarjar_rules: ":NetworkStackJarJarRules",
101    static_libs: [
102        "NetworkStaticLibTestsLib",
103        "NetdStaticLibTestsLib",
104    ],
105}
106
107// Special version of the network stack tests that includes all tests necessary for code coverage
108// purposes. This is currently the union of NetworkStackTests and NetworkStackIntegrationTests.
109android_test {
110    name: "NetworkStackCoverageTests",
111    certificate: "networkstack",
112    platform_apis: true,
113    min_sdk_version: "29",
114    test_suites: ["device-tests", "mts"],
115    test_config: "AndroidTest_Coverage.xml",
116    defaults: ["NetworkStackIntegrationTestsJniDefaults"],
117    static_libs: [
118        "modules-utils-native-coverage-listener",
119        "NetworkStackTestsLib",
120        "NetworkStackIntegrationTestsLib",
121        "NetworkStackStaticLibTestsLib",
122    ],
123    compile_multilib: "both",
124    manifest: "AndroidManifest_coverage.xml",
125}
126