• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        //"net-utils-framework-common",
33        "testables",
34    ],
35    libs: [
36        "android.test.runner",
37        "android.test.base",
38        "android.test.mock",
39    ],
40    defaults: [
41        "framework-connectivity-test-defaults",
42        "libnetworkstackutilsjni_deps"
43    ],
44    jni_libs: [
45        // For mockito extended
46        "libdexmakerjvmtiagent",
47        "libstaticjvmtiagent",
48        "libnetworkstackutilsjni",
49    ],
50    jni_uses_sdk_apis: true,
51    exclude_kotlinc_generated_files: false,
52}
53
54// Tests for NetworkStackNext.
55android_test {
56    name: "NetworkStackNextTests",
57    target_sdk_version: "current",
58    min_sdk_version: "29",
59    srcs: [], // TODO: tests that only apply to the current, non-stable API can be added here
60    test_suites: ["general-tests"],
61    defaults: [
62        "NetworkStackTestsDefaults",
63        "ConnectivityNextEnableDefaults",
64        "connectivity-mainline-presubmit-java-defaults",
65    ],
66    static_libs: ["NetworkStackApiCurrentLib"],
67    compile_multilib: "both", // Workaround for b/147785146 for mainline-presubmit
68    jarjar_rules: ":NetworkStackJarJarRules",
69}
70
71// Library containing the unit tests. This is used by the coverage test target to pull in the
72// unit test code. It is not currently used by the tests themselves because all the build
73// configuration needed by the tests is in the NetworkStackTestsDefaults rule.
74android_library {
75    name: "NetworkStackTestsLib",
76    min_sdk_version: "29",
77    defaults: ["NetworkStackTestsDefaults"],
78    static_libs: ["NetworkStackApiStableLib"],
79    visibility: [
80        "//packages/modules/NetworkStack/tests/integration",
81        "//packages/modules/Connectivity/tests:__subpackages__",
82        "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
83    ]
84}
85
86android_test {
87    name: "NetworkStackTests",
88    min_sdk_version: "29",
89    target_sdk_version: "30",
90    test_suites: ["general-tests", "mts"],
91    defaults: [
92        "NetworkStackTestsDefaults",
93        "connectivity-mainline-presubmit-java-defaults",
94    ],
95    static_libs: ["NetworkStackApiStableLib"],
96    compile_multilib: "both",
97    jarjar_rules: ":NetworkStackJarJarRules",
98}
99
100// Additional dependencies of libnetworkstackutilsjni that are not provided by the system when
101// running as a test application.
102// Using java_defaults as jni_libs does not support filegroups.
103java_defaults {
104    name: "libnetworkstackutilsjni_deps",
105    jni_libs: [
106        "libnativehelper_compat_libc++",
107        "libnetworkstacktestsjni",
108    ],
109}
110