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 = "storage_distributed_file_manager/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 "//third_party/json/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 = [ 55 "${utils_path}:libdistributedfileutils", 56 "//third_party/googletest:gmock_main", 57 "//third_party/googletest:gtest_main", 58 ] 59 60 external_deps = [ 61 "c_utils:utils", 62 "dsoftbus:softbus_client", 63 "hilog:libhilog", 64 "ipc:ipc_core", 65 "zlib:shared_libz", 66 ] 67 68 defines = [ 69 "private=public", 70 "LOG_TAG=\"distributedfile_daemon\"", 71 ] 72 73 use_exceptions = true 74} 75 76ohos_unittest("asset_recv_callback_proxy_test") { 77 branch_protector_ret = "pac_ret" 78 sanitize = { 79 integer_overflow = true 80 cfi = true 81 cfi_cross_dso = true 82 debug = false 83 blocklist = "${distributedfile_path}/cfi_blocklist.txt" 84 } 85 86 module_out_path = module_output_path 87 88 sources = [ 89 "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp", 90 "${distributedfile_path}/test/mock/message_parcel_mock.cpp", 91 "${services_path}/distributedfiledaemon/src/ipc/asset_recv_callback_proxy.cpp", 92 "asset_recv_callback_proxy_test.cpp", 93 ] 94 95 configs = [ 96 ":module_private_config", 97 "${utils_path}:compiler_configs", 98 ] 99 100 deps = [ 101 "${utils_path}:libdistributedfileutils", 102 "//third_party/googletest:gmock_main", 103 "//third_party/googletest:gtest_main", 104 ] 105 106 external_deps = [ 107 "access_token:libaccesstoken_sdk", 108 "c_utils:utils", 109 "hilog:libhilog", 110 "ipc:ipc_core", 111 ] 112} 113 114ohos_unittest("asset_send_callback_proxy_test") { 115 branch_protector_ret = "pac_ret" 116 sanitize = { 117 integer_overflow = true 118 cfi = true 119 cfi_cross_dso = true 120 debug = false 121 blocklist = "${distributedfile_path}/cfi_blocklist.txt" 122 } 123 124 module_out_path = module_output_path 125 126 sources = [ 127 "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp", 128 "${distributedfile_path}/test/mock/message_parcel_mock.cpp", 129 "${services_path}/distributedfiledaemon/src/ipc/asset_send_callback_proxy.cpp", 130 "asset_send_callback_proxy_test.cpp", 131 ] 132 133 configs = [ 134 ":module_private_config", 135 "${utils_path}:compiler_configs", 136 ] 137 138 deps = [ 139 "${utils_path}:libdistributedfileutils", 140 "//third_party/googletest:gmock_main", 141 "//third_party/googletest:gtest_main", 142 ] 143 144 external_deps = [ 145 "access_token:libaccesstoken_sdk", 146 "c_utils:utils", 147 "hilog:libhilog", 148 "ipc:ipc_core", 149 ] 150} 151 152group("unittest") { 153 testonly = true 154 deps = [ 155 ":asset_callback_manager_test", 156 ":asset_recv_callback_proxy_test", 157 ":asset_send_callback_proxy_test", 158 ] 159} 160