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
17java_defaults {
18    name: "NetworkStackTestsDefaults",
19    platform_apis: true,
20    srcs: ["src/**/*.java", "src/**/*.kt"],
21    resource_dirs: ["res"],
22    static_libs: [
23        "androidx.test.ext.junit",
24        "androidx.test.rules",
25        "kotlin-reflect",
26        "mockito-target-extended-minus-junit4",
27        "net-tests-utils",
28        "testables",
29    ],
30    libs: [
31        "android.test.runner",
32        "android.test.base",
33        "android.test.mock",
34    ],
35    defaults: ["libnetworkstackutilsjni_deps"],
36    jni_libs: [
37        // For mockito extended
38        "libdexmakerjvmtiagent",
39        "libstaticjvmtiagent",
40        "libnetworkstackutilsjni",
41    ],
42    jni_uses_sdk_apis: true,
43    jarjar_rules: ":NetworkStackJarJarRules",
44}
45
46// Tests for NetworkStackNext.
47android_test {
48    name: "NetworkStackNextTests",
49    srcs: [], // TODO: tests that only apply to the current, non-stable API can be added here
50    test_suites: ["device-tests"],
51    defaults: ["NetworkStackTestsDefaults"],
52    static_libs: ["NetworkStackApiCurrentLib"],
53}
54
55// Library containing the unit tests. This is used by the coverage test target to pull in the
56// unit test code. It is not currently used by the tests themselves because all the build
57// configuration needed by the tests is in the NetworkStackTestsDefaults rule.
58android_library {
59    name: "NetworkStackTestsLib",
60    min_sdk_version: "29",
61    defaults: ["NetworkStackTestsDefaults"],
62    static_libs: ["NetworkStackApiStableLib"],
63    visibility: [
64        "//packages/modules/NetworkStack/tests/integration",
65        "//frameworks/base/packages/Tethering/tests/integration",
66    ]
67}
68
69android_test {
70    name: "NetworkStackTests",
71    min_sdk_version: "29",
72    test_suites: ["device-tests", "mts"],
73    defaults: ["NetworkStackTestsDefaults"],
74    static_libs: ["NetworkStackApiStableLib"],
75    compile_multilib: "both",
76}
77
78// Additional dependencies of libnetworkstackutilsjni that are not provided by the system when
79// running as a test application.
80// Using java_defaults as jni_libs does not support filegroups.
81java_defaults {
82    name: "libnetworkstackutilsjni_deps",
83    jni_libs: [
84        "libnativehelper_compat_libc++",
85        "libnetworkstacktestsjni",
86    ],
87}
88