1cb7eb8c9Sopenharmony_ci# Copyright (C) 2024 Huawei Device Co., Ltd.
2cb7eb8c9Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3cb7eb8c9Sopenharmony_ci# you may not use this file except in compliance with the License.
4cb7eb8c9Sopenharmony_ci# You may obtain a copy of the License at
5cb7eb8c9Sopenharmony_ci#
6cb7eb8c9Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7cb7eb8c9Sopenharmony_ci#
8cb7eb8c9Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9cb7eb8c9Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10cb7eb8c9Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11cb7eb8c9Sopenharmony_ci# See the License for the specific language governing permissions and
12cb7eb8c9Sopenharmony_ci# limitations under the License.
13cb7eb8c9Sopenharmony_ciimport("//build/test.gni")
14cb7eb8c9Sopenharmony_ciimport("//foundation/filemanagement/dfs_service/distributedfile.gni")
15cb7eb8c9Sopenharmony_ci
16cb7eb8c9Sopenharmony_cimodule_output_path = "storage_distributed_file_manager/distributedfiledaemon"
17cb7eb8c9Sopenharmony_ci
18cb7eb8c9Sopenharmony_ciconfig("module_private_config") {
19cb7eb8c9Sopenharmony_ci  visibility = [ ":*" ]
20cb7eb8c9Sopenharmony_ci
21cb7eb8c9Sopenharmony_ci  include_dirs = [
22cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
23cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/frameworks/native/distributed_file_inner/include/asset",
24cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/mock",
25cb7eb8c9Sopenharmony_ci    "${services_path}/distributedfiledaemon/include",
26cb7eb8c9Sopenharmony_ci    "${services_path}/distributedfiledaemon/include/ipc",
27cb7eb8c9Sopenharmony_ci    "//third_party/json/include",
28cb7eb8c9Sopenharmony_ci  ]
29cb7eb8c9Sopenharmony_ci}
30cb7eb8c9Sopenharmony_ci
31cb7eb8c9Sopenharmony_ciohos_unittest("asset_callback_manager_test") {
32cb7eb8c9Sopenharmony_ci  branch_protector_ret = "pac_ret"
33cb7eb8c9Sopenharmony_ci  sanitize = {
34cb7eb8c9Sopenharmony_ci    integer_overflow = true
35cb7eb8c9Sopenharmony_ci    cfi = true
36cb7eb8c9Sopenharmony_ci    cfi_cross_dso = true
37cb7eb8c9Sopenharmony_ci    debug = false
38cb7eb8c9Sopenharmony_ci    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
39cb7eb8c9Sopenharmony_ci  }
40cb7eb8c9Sopenharmony_ci
41cb7eb8c9Sopenharmony_ci  module_out_path = module_output_path
42cb7eb8c9Sopenharmony_ci
43cb7eb8c9Sopenharmony_ci  sources = [
44cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp",
45cb7eb8c9Sopenharmony_ci    "${services_path}/distributedfiledaemon/src/ipc/asset_callback_manager.cpp",
46cb7eb8c9Sopenharmony_ci    "asset_callback_manager_test.cpp",
47cb7eb8c9Sopenharmony_ci  ]
48cb7eb8c9Sopenharmony_ci
49cb7eb8c9Sopenharmony_ci  configs = [
50cb7eb8c9Sopenharmony_ci    ":module_private_config",
51cb7eb8c9Sopenharmony_ci    "${utils_path}:compiler_configs",
52cb7eb8c9Sopenharmony_ci  ]
53cb7eb8c9Sopenharmony_ci
54cb7eb8c9Sopenharmony_ci  deps = [
55cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfileutils",
56cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gmock_main",
57cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gtest_main",
58cb7eb8c9Sopenharmony_ci  ]
59cb7eb8c9Sopenharmony_ci
60cb7eb8c9Sopenharmony_ci  external_deps = [
61cb7eb8c9Sopenharmony_ci    "c_utils:utils",
62cb7eb8c9Sopenharmony_ci    "dsoftbus:softbus_client",
63cb7eb8c9Sopenharmony_ci    "hilog:libhilog",
64cb7eb8c9Sopenharmony_ci    "ipc:ipc_core",
65cb7eb8c9Sopenharmony_ci    "zlib:shared_libz",
66cb7eb8c9Sopenharmony_ci  ]
67cb7eb8c9Sopenharmony_ci
68cb7eb8c9Sopenharmony_ci  defines = [
69cb7eb8c9Sopenharmony_ci    "private=public",
70cb7eb8c9Sopenharmony_ci    "LOG_TAG=\"distributedfile_daemon\"",
71cb7eb8c9Sopenharmony_ci  ]
72cb7eb8c9Sopenharmony_ci
73cb7eb8c9Sopenharmony_ci  use_exceptions = true
74cb7eb8c9Sopenharmony_ci}
75cb7eb8c9Sopenharmony_ci
76cb7eb8c9Sopenharmony_ciohos_unittest("asset_recv_callback_proxy_test") {
77cb7eb8c9Sopenharmony_ci  branch_protector_ret = "pac_ret"
78cb7eb8c9Sopenharmony_ci  sanitize = {
79cb7eb8c9Sopenharmony_ci    integer_overflow = true
80cb7eb8c9Sopenharmony_ci    cfi = true
81cb7eb8c9Sopenharmony_ci    cfi_cross_dso = true
82cb7eb8c9Sopenharmony_ci    debug = false
83cb7eb8c9Sopenharmony_ci    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
84cb7eb8c9Sopenharmony_ci  }
85cb7eb8c9Sopenharmony_ci
86cb7eb8c9Sopenharmony_ci  module_out_path = module_output_path
87cb7eb8c9Sopenharmony_ci
88cb7eb8c9Sopenharmony_ci  sources = [
89cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp",
90cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/mock/message_parcel_mock.cpp",
91cb7eb8c9Sopenharmony_ci    "${services_path}/distributedfiledaemon/src/ipc/asset_recv_callback_proxy.cpp",
92cb7eb8c9Sopenharmony_ci    "asset_recv_callback_proxy_test.cpp",
93cb7eb8c9Sopenharmony_ci  ]
94cb7eb8c9Sopenharmony_ci
95cb7eb8c9Sopenharmony_ci  configs = [
96cb7eb8c9Sopenharmony_ci    ":module_private_config",
97cb7eb8c9Sopenharmony_ci    "${utils_path}:compiler_configs",
98cb7eb8c9Sopenharmony_ci  ]
99cb7eb8c9Sopenharmony_ci
100cb7eb8c9Sopenharmony_ci  deps = [
101cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfileutils",
102cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gmock_main",
103cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gtest_main",
104cb7eb8c9Sopenharmony_ci  ]
105cb7eb8c9Sopenharmony_ci
106cb7eb8c9Sopenharmony_ci  external_deps = [
107cb7eb8c9Sopenharmony_ci    "access_token:libaccesstoken_sdk",
108cb7eb8c9Sopenharmony_ci    "c_utils:utils",
109cb7eb8c9Sopenharmony_ci    "hilog:libhilog",
110cb7eb8c9Sopenharmony_ci    "ipc:ipc_core",
111cb7eb8c9Sopenharmony_ci  ]
112cb7eb8c9Sopenharmony_ci}
113cb7eb8c9Sopenharmony_ci
114cb7eb8c9Sopenharmony_ciohos_unittest("asset_send_callback_proxy_test") {
115cb7eb8c9Sopenharmony_ci  branch_protector_ret = "pac_ret"
116cb7eb8c9Sopenharmony_ci  sanitize = {
117cb7eb8c9Sopenharmony_ci    integer_overflow = true
118cb7eb8c9Sopenharmony_ci    cfi = true
119cb7eb8c9Sopenharmony_ci    cfi_cross_dso = true
120cb7eb8c9Sopenharmony_ci    debug = false
121cb7eb8c9Sopenharmony_ci    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
122cb7eb8c9Sopenharmony_ci  }
123cb7eb8c9Sopenharmony_ci
124cb7eb8c9Sopenharmony_ci  module_out_path = module_output_path
125cb7eb8c9Sopenharmony_ci
126cb7eb8c9Sopenharmony_ci  sources = [
127cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp",
128cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/mock/message_parcel_mock.cpp",
129cb7eb8c9Sopenharmony_ci    "${services_path}/distributedfiledaemon/src/ipc/asset_send_callback_proxy.cpp",
130cb7eb8c9Sopenharmony_ci    "asset_send_callback_proxy_test.cpp",
131cb7eb8c9Sopenharmony_ci  ]
132cb7eb8c9Sopenharmony_ci
133cb7eb8c9Sopenharmony_ci  configs = [
134cb7eb8c9Sopenharmony_ci    ":module_private_config",
135cb7eb8c9Sopenharmony_ci    "${utils_path}:compiler_configs",
136cb7eb8c9Sopenharmony_ci  ]
137cb7eb8c9Sopenharmony_ci
138cb7eb8c9Sopenharmony_ci  deps = [
139cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfileutils",
140cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gmock_main",
141cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gtest_main",
142cb7eb8c9Sopenharmony_ci  ]
143cb7eb8c9Sopenharmony_ci
144cb7eb8c9Sopenharmony_ci  external_deps = [
145cb7eb8c9Sopenharmony_ci    "access_token:libaccesstoken_sdk",
146cb7eb8c9Sopenharmony_ci    "c_utils:utils",
147cb7eb8c9Sopenharmony_ci    "hilog:libhilog",
148cb7eb8c9Sopenharmony_ci    "ipc:ipc_core",
149cb7eb8c9Sopenharmony_ci  ]
150cb7eb8c9Sopenharmony_ci}
151cb7eb8c9Sopenharmony_ci
152cb7eb8c9Sopenharmony_cigroup("unittest") {
153cb7eb8c9Sopenharmony_ci  testonly = true
154cb7eb8c9Sopenharmony_ci  deps = [
155cb7eb8c9Sopenharmony_ci    ":asset_callback_manager_test",
156cb7eb8c9Sopenharmony_ci    ":asset_recv_callback_proxy_test",
157cb7eb8c9Sopenharmony_ci    ":asset_send_callback_proxy_test",
158cb7eb8c9Sopenharmony_ci  ]
159cb7eb8c9Sopenharmony_ci}
160