// Copyright (C) 2023 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package { default_applicable_licenses: ["Android-Apache-2.0"], } filegroup { name: "adservices-test-utility-sources", srcs: [ "java/**/*.java", ], exclude_srcs: [ "java/com/android/adservices/mockito/*.java", ], path: "java", visibility: [ "//packages/modules/AdServices:__subpackages__", ], } // Java classes that are used by both device-side and host-side tests filegroup { name: "adservices-test-utility-sideless-sources", srcs: [ "side-less/**/*.java", ], path: "side-less", visibility: [ ":__pkg__", ], } android_library { name: "adservices-test-utility", sdk_version: "module_current", min_sdk_version: "30", srcs: [ ":adservices-test-utility-sideless-sources", ":adservices-test-utility-sources", ":adservices-service-core-phflags-sources", // TODO(b/345219434): should use java-defaults instead of manually including // the 2 sources below ":adservices-extended-mockito-rule-sources", ":adservices-shared-extended-mockito-rule-sources", ], libs: [ "error_prone_annotations", "framework-adservices-lib", "framework-annotations-lib", "framework-configinfrastructure", "junit", ], static_libs: [ "auto_value_annotations", // TODO(b/338132355): Clean up dependencies for adservices-test-utility. "adservices-service-core", "adservices-shared-mockito-expectations", // TODO(b/338132355): should not be needed if mocker is split "adservices-shared-testing", "androidx.test.runner", "compatibility-device-util-axt", "modules-utils-preconditions", "adservices-shared-util", // For checkState method uses varargs. "adservices-clients", // TODO(b/345219434): remove dependency below (and/or replace it by // modules-utils-extended-mockito-rule) and move it to test projects // instead (as it's only needed by tests that uses the static fixture) "modules-utils-testable-device-config", // TODO(b/345219434): should use java-defaults instead of manually including "adservices-shared-static-class-checker", ], apex_available: [ "com.android.adservices", "com.android.extservices", ], visibility: [ "//packages/modules/AdServices:__subpackages__", "//vendor:__subpackages__", // used by some integration tests ], lint: { extra_check_modules: ["AdServicesTestLintChecker"], }, plugins: ["auto_annotation_plugin"], } android_library { name: "adservices-test-mockito-expectations", sdk_version: "module_current", min_sdk_version: "30", srcs: [ "java/com/android/adservices/mockito/*MockitoExpectations.java", ":adservices-service-core-phflags-sources", ], libs: [ "framework-adservices-lib", "framework-annotations-lib", "framework-configinfrastructure", ], static_libs: [ "adservices-service-core", "adservices-shared-testing", "adservices-test-utility", "mockito-target-extended-minus-junit4", "truth", ], apex_available: [ "com.android.adservices", "com.android.extservices", ], lint: { extra_check_modules: ["AdServicesTestLintChecker"], }, } java_library_host { name: "adservices-host-side-test-utility", srcs: [ "host-side/**/*.java", ":adservices-service-core-flags-constants-sources", ":adservices-test-utility-sideless-sources", ], static_libs: [ "compatibility-host-util", "adservices-shared-hostside-testing", ], libs: [ "tradefed", "framework-annotations-lib", ], } // TODO(b/338132355): remove / split / create new lib for expectations filegroup { name: "adservices-extended-mockito-rule-sources", srcs: [ "java/com/android/adservices/mockito/AdServicesStaticMockitoMocker.java", "java/com/android/adservices/mockito/AdServicesExtendedMockitoMocker.java", ], path: "java", visibility: [ "//packages/modules/AdServices:__subpackages__", ], } java_defaults { name: "adservices-extended-mockito-defaults", srcs: [ ":adservices-extended-mockito-rule-sources", ], defaults: ["adservices-shared-extended-mockito-defaults"], static_libs: [ "adservices-service-core", "modules-utils-testable-device-config", // For TestableDeviceConfig ], visibility: [ "//packages/modules/AdServices:__subpackages__", ], }