1# Copyright (C) 2024 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. 13import("//build/test.gni") 14import("//foundation/filemanagement/dfs_service/distributedfile.gni") 15 16module_output_path = "dfs_service/dfs_service_daemon/distributedfiledaemon" 17 18config("module_private_config") { 19 visibility = [ ":*" ] 20 21 include_dirs = [ 22 "${distributedfile_path}/frameworks/native/distributed_file_inner/include", 23 "${distributedfile_path}/frameworks/native/distributed_file_inner/include/asset", 24 "${distributedfile_path}/test/mock", 25 "${services_path}/distributedfiledaemon/include", 26 "${services_path}/distributedfiledaemon/include/ipc", 27 "${services_path}/distributedfiledaemon/test/mock/include", 28 ] 29} 30 31ohos_unittest("asset_callback_manager_test") { 32 branch_protector_ret = "pac_ret" 33 sanitize = { 34 integer_overflow = true 35 cfi = true 36 cfi_cross_dso = true 37 debug = false 38 blocklist = "${distributedfile_path}/cfi_blocklist.txt" 39 } 40 41 module_out_path = module_output_path 42 43 sources = [ 44 "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp", 45 "${services_path}/distributedfiledaemon/src/ipc/asset_callback_manager.cpp", 46 "asset_callback_manager_test.cpp", 47 ] 48 49 configs = [ 50 ":module_private_config", 51 "${utils_path}:compiler_configs", 52 ] 53 54 deps = [ "${utils_path}:libdistributedfileutils" ] 55 56 external_deps = [ 57 "c_utils:utils", 58 "dsoftbus:softbus_client", 59 "googletest:gmock_main", 60 "googletest:gtest_main", 61 "hilog:libhilog", 62 "ipc:ipc_core", 63 "zlib:shared_libz", 64 ] 65 66 defines = [ 67 "private=public", 68 "LOG_TAG=\"distributedfile_daemon\"", 69 ] 70 71 use_exceptions = true 72} 73 74ohos_unittest("asset_recv_callback_proxy_test") { 75 branch_protector_ret = "pac_ret" 76 sanitize = { 77 integer_overflow = true 78 cfi = true 79 cfi_cross_dso = true 80 debug = false 81 blocklist = "${distributedfile_path}/cfi_blocklist.txt" 82 } 83 84 module_out_path = module_output_path 85 86 sources = [ 87 "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp", 88 "${distributedfile_path}/test/mock/message_parcel_mock.cpp", 89 "${services_path}/distributedfiledaemon/src/ipc/asset_recv_callback_proxy.cpp", 90 "asset_recv_callback_proxy_test.cpp", 91 ] 92 93 configs = [ 94 ":module_private_config", 95 "${utils_path}:compiler_configs", 96 ] 97 98 deps = [ "${utils_path}:libdistributedfileutils" ] 99 100 external_deps = [ 101 "access_token:libaccesstoken_sdk", 102 "c_utils:utils", 103 "googletest:gmock_main", 104 "googletest:gtest_main", 105 "hilog:libhilog", 106 "ipc:ipc_core", 107 "samgr:samgr_proxy", 108 ] 109} 110 111ohos_unittest("asset_send_callback_proxy_test") { 112 branch_protector_ret = "pac_ret" 113 sanitize = { 114 integer_overflow = true 115 cfi = true 116 cfi_cross_dso = true 117 debug = false 118 blocklist = "${distributedfile_path}/cfi_blocklist.txt" 119 } 120 121 module_out_path = module_output_path 122 123 sources = [ 124 "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp", 125 "${distributedfile_path}/test/mock/message_parcel_mock.cpp", 126 "${services_path}/distributedfiledaemon/src/ipc/asset_send_callback_proxy.cpp", 127 "asset_send_callback_proxy_test.cpp", 128 ] 129 130 configs = [ 131 ":module_private_config", 132 "${utils_path}:compiler_configs", 133 ] 134 135 deps = [ "${utils_path}:libdistributedfileutils" ] 136 137 external_deps = [ 138 "access_token:libaccesstoken_sdk", 139 "c_utils:utils", 140 "googletest:gmock_main", 141 "googletest:gtest_main", 142 "hilog:libhilog", 143 "ipc:ipc_core", 144 "samgr:samgr_proxy", 145 ] 146} 147 148group("unittest") { 149 testonly = true 150 deps = [ 151 ":asset_callback_manager_test", 152 ":asset_recv_callback_proxy_test", 153 ":asset_send_callback_proxy_test", 154 "daemon:daemon_test", 155 "daemon_execute:daemon_execute_test", 156 ] 157} 158