• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2022 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
18java_defaults {
19    name: "AdServices-ServiceCoreUnitTest-Defaults",
20    defaults: ["adservices-extended-mockito-defaults"],
21    // Currently this test module is failing, which results in low test coverage
22    // The reason is the target test coverage system runs on is different as what this test
23    // configures. Add below line to address the issue.
24    // See b/233124651 for details.
25    compile_multilib: "both",
26    min_sdk_version: "Tiramisu",
27    sdk_version: "module_current",
28    plugins: [
29        "auto_value_plugin",
30        "auto_annotation_plugin",
31    ],
32    static_libs: [
33        "androidx.concurrent_concurrent-futures",
34        "androidx.test.rules",
35        "compatibility-device-util-axt",
36        "truth",
37        "gson",
38        "adservices-assets",
39        "adservices-service-core-schema",
40        "adservices-shared-testing",
41        "adservices-test-utility",
42        "androidx.room_room-runtime",
43        "androidx.room_room-testing",
44        "adservices-test-fixtures",
45        "mobile_data_downloader_lib",
46        "tflite_support_classifiers_java",
47        "opencensus-java-api",
48        "opencensus-java-contrib-grpc-metrics",
49        "adservices_flags_lib", // Used by FlagsConstantsTest
50        // Tests may run on the platforms that don't have ODP module installed.
51        // Without static_lib dependency, the framework code from ODP won't be
52        // packaged with the test APK and throw NoClassDefFoundError.
53        "framework-ondevicepersonalization.impl",
54    ],
55    libs: [
56        "android.test.base.stubs.system",
57        "android.test.mock.stubs",
58        "framework-adservices.impl",
59        "framework-annotations-lib",
60        "framework-configinfrastructure.stubs.module_lib",
61        "framework-sdksandbox.impl",
62        "auto_value_annotations",
63    ],
64    test_suites: [
65        "general-tests",
66        "mts-adservices",
67    ],
68    instrumentation_for: "AdServicesApk",
69    jni_libs: [
70        "libhpke_jni",
71        "libacttest_jni",
72        "libtflite_support_classifiers_native",
73    ],
74    aaptflags: [
75        // avoid compression on lite and tflite files as the Interpreter
76        // can not load compressed flat buffer formats. (*appt compresses all
77        // assets into the apk by default)
78        // See https://elinux.org/Android_aapt for more detail.
79        "-0 .lite",
80        "-0 .tflite",
81    ],
82    lint: {
83        extra_check_modules: ["AdServicesTestLintChecker"],
84        test: true,
85    },
86}
87
88android_test {
89    name: "AdServicesServiceCoreUnitTests",
90    srcs: [
91        "src/**/*.java",
92        ":adservices-shared-device-side-flags-meta-testing-sources",
93    ],
94    exclude_srcs: [
95        // The tests below are interacting with the JsSandbox singleton and should
96        // be run in a separate process
97        "src/com/android/adservices/service/js/JSScriptEngineTest.java",
98        "src/com/android/adservices/service/js/JavaScriptSandboxProviderTest.java",
99        // Exclude Mobile Data Download Test. This test need network connection and download files.
100        // This will run in a separate test suite.
101        "src/com/android/adservices/download/MobileDataDownloadTest.java",
102    ],
103    defaults: ["AdServices-ServiceCoreUnitTest-Defaults"],
104}
105
106android_test {
107    name: "AdServicesJsEngineUnitTests",
108    srcs: [
109        "src/com/android/adservices/service/js/JSScriptEngineTest.java",
110        "src/com/android/adservices/service/js/JavaScriptSandboxProviderTest.java",
111    ],
112    defaults: ["modules-utils-testable-device-config-defaults"],
113    sdk_version: "module_current",
114    compile_multilib: "both",
115    min_sdk_version: "Tiramisu",
116    static_libs: [
117        "androidx.concurrent_concurrent-futures",
118        "androidx.test.rules",
119        "compatibility-device-util-axt",
120        "mockito-target-extended-minus-junit4",
121        "truth",
122        "adservices-assets",
123        "adservices-test-fixtures",
124    ],
125    libs: [
126        "android.test.base.stubs.system",
127        "android.test.mock.stubs",
128        "framework-adservices.impl",
129        "framework-annotations-lib",
130        "framework-statsd.stubs.module_lib",
131    ],
132    test_suites: [
133        "general-tests",
134        "mts-adservices",
135    ],
136    test_config: "AndroidTest.JsScriptEngine.xml",
137    instrumentation_for: "AdServicesApk",
138    lint: {
139        extra_check_modules: ["AdServicesTestLintChecker"],
140    },
141}
142
143android_test {
144    // To avoid flakiness and timeouts related to network calls, this test uses
145    // local file downloader.
146    name: "AdServicesMddIntegrationTests",
147    srcs: [
148        "src/com/android/adservices/download/MobileDataDownloadTest.java",
149    ],
150    asset_dirs: [
151        "assets/mobiledatadownload",
152    ],
153    defaults: ["AdServices-ServiceCoreUnitTest-Defaults"],
154    sdk_version: "module_current",
155    compile_multilib: "both",
156    min_sdk_version: "Tiramisu",
157    static_libs: [
158        "androidx.concurrent_concurrent-futures",
159        "androidx.test.rules",
160        "compatibility-device-util-axt",
161        "mockito-target-extended-minus-junit4",
162        "truth",
163        "adservices-assets",
164        "adservices-test-fixtures",
165        "mobile_data_downloader_lib",
166        "mdd-robolectric-library",
167    ],
168    libs: [
169        "android.test.base.stubs.system",
170        "android.test.mock.stubs",
171        "framework-adservices.impl",
172        "framework-annotations-lib",
173    ],
174    test_suites: [
175        "general-tests",
176        "mts-adservices",
177    ],
178    test_config: "AndroidTestMDD.xml",
179    instrumentation_for: "AdServicesApk",
180    lint: {
181        extra_check_modules: ["AdServicesTestLintChecker"],
182        baseline_filename: "lint-baseline-adservices-mdd.xml",
183    },
184}
185
186java_defaults {
187    name: "AdExtServices-ServiceCoreUnitTest-Defaults",
188    defaults: ["adservices-extended-mockito-defaults"],
189    sdk_version: "module_current",
190    // Currently this test module is failing, which results in low test coverage
191    // The reason is the target test coverage system runs on is different as what this test
192    // configures. Add below line to address the issue.
193    // See b/233124651 for details.
194    compile_multilib: "both",
195    min_sdk_version: "31",
196    max_sdk_version: "32",
197    static_libs: [
198        "adservices-assets",
199        "adservices-service-core-schema",
200        "adservices-shared-testing",
201        "adservices-test-fixtures",
202        "adservices-test-utility",
203        "androidx.concurrent_concurrent-futures",
204        "androidx.room_room-runtime",
205        "androidx.room_room-testing",
206        "androidx.test.rules",
207        "compatibility-device-util-axt",
208        "mobile_data_downloader_lib",
209        "opencensus-java-api",
210        "opencensus-java-contrib-grpc-metrics",
211        "tflite_support_classifiers_java",
212        "truth",
213        "gson",
214        "adservices_flags_lib", // Used by FlagsConstantsTest
215        // Tests may run on the platforms that don't have ODP module installed.
216        // Without static_lib dependency, the framework code from ODP won't be
217        // packaged with the test APK and throw NoClassDefFoundError.
218        "framework-ondevicepersonalization.impl",
219    ],
220    libs: [
221        "android.ext.adservices",
222        "android.test.base.stubs.system",
223        "android.test.mock.stubs",
224        "framework-annotations-lib",
225        "framework-configinfrastructure.stubs.module_lib",
226        "framework-sdksandbox.impl",
227    ],
228    test_suites: [
229        "general-tests",
230        "mts-extservices",
231    ],
232    instrumentation_for: "ExtServices-sminus",
233    jni_libs: [
234        "libhpke_jni",
235        "libacttest_jni",
236        "libtflite_support_classifiers_native",
237    ],
238    aaptflags: [
239        // avoid compression on lite and tflite files as the Interpreter
240        // can not load compressed flat buffer formats. (*appt compresses all
241        // assets into the apk by default)
242        // See https://elinux.org/Android_aapt for more detail.
243        "-0 .lite",
244        "-0 .tflite",
245    ],
246    lint: {
247        extra_check_modules: ["AdServicesTestLintChecker"],
248        // TODO(b/358643466): Readd when existing issues are fixed
249        // test: false, // TODO(b/343741206): remove when checks will run on android_test
250    },
251}
252
253android_test {
254    name: "AdExtServicesServiceCoreUnitTests",
255    defaults: ["AdExtServices-ServiceCoreUnitTest-Defaults"],
256    srcs: [
257        "src/**/*.java",
258        ":adservices-shared-device-side-flags-meta-testing-sources",
259    ],
260    exclude_srcs: [
261        // The tests below are interacting with the JsSandbox singleton and should
262        // be run in a separate process
263        "src/com/android/adservices/service/js/JSScriptEngineTest.java",
264        "src/com/android/adservices/service/js/JavaScriptSandboxProviderTest.java",
265        // Exclude Mobile Data Download Test. This test need network connection and download files.
266        // This will run in a separate test suite.
267        "src/com/android/adservices/download/MobileDataDownloadTest.java",
268    ],
269    test_config: "AndroidTest.ExtServices.xml",
270}
271
272android_test {
273    name: "AdExtServicesJsEngineUnitTests",
274    srcs: [
275        "src/com/android/adservices/service/js/JSScriptEngineTest.java",
276        "src/com/android/adservices/service/js/JavaScriptSandboxProviderTest.java",
277    ],
278    defaults: ["modules-utils-testable-device-config-defaults"],
279    sdk_version: "module_current",
280    compile_multilib: "both",
281    min_sdk_version: "31",
282    max_sdk_version: "32",
283    static_libs: [
284        "adservices-assets",
285        "adservices-test-fixtures",
286        "androidx.concurrent_concurrent-futures",
287        "androidx.test.rules",
288        "compatibility-device-util-axt",
289        "mockito-target-extended-minus-junit4",
290        "truth",
291    ],
292    libs: [
293        "android.ext.adservices",
294        "android.test.base.stubs.system",
295        "android.test.mock.stubs",
296        "framework-annotations-lib",
297        "framework-statsd.stubs.module_lib",
298    ],
299    test_suites: [
300        "general-tests",
301        "mts-extservices",
302    ],
303    test_config: "AndroidTest.JsScriptEngine.ExtServices.xml",
304    instrumentation_for: "ExtServices-sminus",
305    lint: {
306        extra_check_modules: ["AdServicesTestLintChecker"],
307    },
308}
309
310android_test {
311    // To avoid flakiness and timeouts related to network calls, this test uses
312    // local file downloader.
313    name: "AdExtServicesMddIntegrationTests",
314    srcs: [
315        "src/com/android/adservices/download/MobileDataDownloadTest.java",
316    ],
317    asset_dirs: [
318        "assets/mobiledatadownload",
319    ],
320    defaults: ["AdServices-ServiceCoreUnitTest-Defaults"],
321    sdk_version: "module_current",
322    compile_multilib: "both",
323    min_sdk_version: "31",
324    max_sdk_version: "32",
325    static_libs: [
326        "adservices-assets",
327        "adservices-test-fixtures",
328        "androidx.concurrent_concurrent-futures",
329        "androidx.test.rules",
330        "compatibility-device-util-axt",
331        "mobile_data_downloader_lib",
332        "mdd-robolectric-library",
333        "mockito-target-extended-minus-junit4",
334        "truth",
335    ],
336    libs: [
337        "android.ext.adservices",
338        "android.test.base.stubs.system",
339        "android.test.mock.stubs",
340        "framework-adservices.impl",
341        "framework-annotations-lib",
342    ],
343    test_suites: [
344        "general-tests",
345        "mts-extservices",
346    ],
347    test_config: "AndroidTestMDD.ExtServices.xml",
348    instrumentation_for: "ExtServices-sminus",
349    lint: {
350        extra_check_modules: ["AdServicesTestLintChecker"],
351        baseline_filename: "lint-baseline-adextservices-mdd.xml",
352    },
353}
354
355cc_library_shared {
356    name: "libacttest_jni",
357    min_sdk_version: "31",
358    sdk_version: "current",
359    stl: "libc++_static",
360    cflags: [
361        "-Werror",
362        "-Wno-unused-parameter",
363        "-Wno-unused-but-set-variable",
364    ],
365    srcs: [
366        "src/jni/cpp/act_util_jni.cpp",
367    ],
368    include_dirs: [
369        "packages/modules/AdServices/adservices/service-core/jni/include",
370        "packages/modules/AdServices/adservices/tests/unittest/service-core/src/jni/cpp",
371    ],
372    header_libs: ["jni_headers"],
373    shared_libs: ["liblog"],
374    static_libs: [
375        "libact",
376        "libcrypto_static",
377    ],
378    apex_available: [
379        "com.android.adservices",
380        "com.android.extservices",
381    ],
382    visibility: [
383        "//packages/modules/AdServices:__subpackages__",
384        "//packages/modules/ExtServices:__subpackages__",
385    ],
386}
387