1// Copyright (C) 2023 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14package {
15    default_applicable_licenses: ["Android-Apache-2.0"],
16}
17
18android_test {
19    name: "AdServicesUIUnitTests",
20    srcs: [
21        "src/**/*.java",
22    ],
23    exclude_srcs: [
24        // The tests below are interacting with the JsSandbox singleton and should
25        // be run in a separate process
26        "src/com/android/adservices/service/js/JSScriptEngineTest.java",
27        "src/com/android/adservices/service/js/JavaScriptSandboxProviderTest.java",
28        // Exclude Mobile Data Download Test. This test need network connection and download files.
29        // This will run in a separate test suite.
30        "src/com/android/adservices/download/MobileDataDownloadTest.java",
31    ],
32    defaults: ["adservices-extended-mockito-defaults"],
33    sdk_version: "module_current",
34    // Currently this test module is failing, which results in low test coverage
35    // The reason is the target test coverage system runs on is different as what this test
36    // configures. Add below line to address the issue.
37    // See b/233124651 for details.
38    compile_multilib: "both",
39    min_sdk_version: "Tiramisu",
40
41    plugins: [
42        "auto_value_plugin",
43        "auto_annotation_plugin",
44    ],
45    static_libs: [
46        "androidx.concurrent_concurrent-futures",
47        "androidx.test.rules",
48        "compatibility-device-util-axt",
49        "truth",
50        "adservices-assets",
51        "adservices-service-core-schema",
52        "adservices-shared-testing",
53        "adservices-test-mockito-expectations",
54        "adservices-test-utility",
55        "androidx.room_room-runtime",
56        "androidx.room_room-testing",
57        "adservices-test-fixtures",
58        "mobile_data_downloader_lib",
59        "tflite_support_classifiers_java",
60        "opencensus-java-api",
61        "opencensus-java-contrib-grpc-metrics",
62    ],
63    libs: [
64        "android.test.base",
65        "android.test.mock.stubs",
66        "framework-adservices.impl",
67        "framework-annotations-lib",
68        "framework-configinfrastructure",
69        "framework-sdksandbox.impl",
70        "auto_value_annotations",
71    ],
72    test_suites: [
73        "general-tests",
74        "mts-adservices",
75    ],
76    instrumentation_for: "AdServicesApk",
77    jni_libs: [
78        "libhpke_jni",
79        "libtflite_support_classifiers_native",
80    ],
81    aaptflags: [
82        // avoid compression on lite and tflite files as the Interpreter
83        // can not load compressed flat buffer formats. (*appt compresses all
84        // assets into the apk by default)
85        // See https://elinux.org/Android_aapt for more detail.
86        "-0 .lite",
87        "-0 .tflite",
88    ],
89    lint: {
90        extra_check_modules: ["AdServicesTestLintChecker"],
91        test: false, // TODO(b/343741206): remove when checks will run on android_test
92    },
93}
94
95android_test {
96    name: "AdExtServicesUIUnitTests",
97    srcs: [
98        "src/**/*.java",
99    ],
100    exclude_srcs: [
101        // The tests below are interacting with the JsSandbox singleton and should
102        // be run in a separate process
103        "src/com/android/adservices/service/js/JSScriptEngineTest.java",
104        "src/com/android/adservices/service/js/JavaScriptSandboxProviderTest.java",
105        // Exclude Mobile Data Download Test. This test need network connection and download files.
106        // This will run in a separate test suite.
107        "src/com/android/adservices/download/MobileDataDownloadTest.java",
108    ],
109    defaults: ["adservices-extended-mockito-defaults"],
110    sdk_version: "module_current",
111    // Currently this test module is failing, which results in low test coverage
112    // The reason is the target test coverage system runs on is different as what this test
113    // configures. Add below line to address the issue.
114    // See b/233124651 for details.
115    compile_multilib: "both",
116    min_sdk_version: "30",
117    max_sdk_version: "32",
118    static_libs: [
119        "adservices-assets",
120        "adservices-service-core-schema",
121        "adservices-shared-testing",
122        "adservices-test-fixtures",
123        "adservices-test-mockito-expectations",
124        "adservices-test-utility",
125        "androidx.concurrent_concurrent-futures",
126        "androidx.room_room-runtime",
127        "androidx.room_room-testing",
128        "androidx.test.rules",
129        "compatibility-device-util-axt",
130        "mobile_data_downloader_lib",
131        "opencensus-java-api",
132        "opencensus-java-contrib-grpc-metrics",
133        "tflite_support_classifiers_java",
134        "truth",
135    ],
136    libs: [
137        "android.ext.adservices",
138        "android.test.base",
139        "android.test.mock.stubs",
140        "framework-annotations-lib",
141        "framework-configinfrastructure",
142        "framework-sdksandbox.impl",
143    ],
144    test_suites: [
145        "general-tests",
146        "mts-extservices",
147    ],
148    test_config: "AndroidTest.ExtServices.xml",
149    instrumentation_for: "ExtServices-sminus",
150    jni_libs: [
151        "libhpke_jni",
152        "libtflite_support_classifiers_native",
153    ],
154    aaptflags: [
155        // avoid compression on lite and tflite files as the Interpreter
156        // can not load compressed flat buffer formats. (*appt compresses all
157        // assets into the apk by default)
158        // See https://elinux.org/Android_aapt for more detail.
159        "-0 .lite",
160        "-0 .tflite",
161    ],
162    lint: {
163        extra_check_modules: ["AdServicesTestLintChecker"],
164        baseline_filename: "lint-baseline-adextservices.xml",
165        test: false, // TODO(b/343741206): remove when checks will run on android_test
166    },
167}
168