1# Copyright (C) 2025 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/test.gni") 15import("../../../../../config.gni") 16 17IPC_CORE_ROOT = "$IPC_ROOT_PATH/ipc/native" 18MODULE_OUTPUT_PATH = "ipc/ipc" 19 20template("ipc_dbinder_unittest") { 21 ohos_unittest(target_name) { 22 module_out_path = MODULE_OUTPUT_PATH 23 24 include_dirs = [ 25 "$IPC_ROOT_PATH/ipc/native/src/core/invoker/include", 26 "$IPC_ROOT_PATH/ipc/native/src/core/dbinder/include", 27 "$IPC_ROOT_PATH/ipc/native/src/core/framework/include", 28 "$IPC_ROOT_PATH/ipc/native/c/manager/include", 29 "$IPC_ROOT_PATH/utils/include", 30 "$IPC_ROOT_PATH/interfaces/innerkits/ipc_core/include", 31 "$IPC_ROOT_PATH/ipc/native/c/rpc/include", 32 "$IPC_ROOT_PATH/utils/include", 33 "$IPC_UNITTEST_ROOT_PATH/mock", 34 ] 35 36 if (defined(invoker.include_dirs)) { 37 include_dirs += invoker.include_dirs 38 } 39 40 configs = [ "$IPC_ROOT_PATH/config:ipc_util_config" ] 41 42 deps = [ 43 "$IPC_CORE_ROOT/src/core:ipc_common", 44 "$IPC_ROOT_PATH/interfaces/innerkits/ipc_single:ipc_single_test", 45 ] 46 47 defines = [ 48 "private = public", 49 "protected = public", 50 ] 51 52 if (defined(invoker.deps)) { 53 deps += invoker.deps 54 } 55 56 external_deps = [ 57 "c_utils:utils", 58 "googletest:gmock", 59 "hilog:libhilog", 60 "hitrace:libhitracechain", 61 "ipc:libdbinder", 62 "samgr:samgr_proxy", 63 ] 64 65 if (hiviewdfx_hisysevent_support) { 66 external_deps += [ "hisysevent:libhisysevent" ] 67 } 68 69 if (defined(invoker.external_deps)) { 70 external_deps += invoker.external_deps 71 } 72 73 sources = invoker.sources 74 ldflags = [ "-lpthread" ] 75 resource_config_file = "$IPC_ROOT_PATH/test/resource/ipc/ohos_test.xml" 76 } 77} 78 79ipc_dbinder_unittest("DBinderRemoteListenerTest") { 80 sources = [ "dbinder_remote_listener_unittest.cpp" ] 81} 82 83ipc_dbinder_unittest("DBinderServiceStubTest") { 84 sources = [ "dbinder_service_stub_unittest.cpp" ] 85} 86 87############################################################################### 88group("unittest") { 89 testonly = true 90 deps = [ 91 ":DBinderRemoteListenerTest", 92 ":DBinderServiceStubTest", 93 ] 94} 95############################################################################### 96