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.
13
14import("//build/test.gni")
15import("//foundation/filemanagement/dfs_service/distributedfile.gni")
16
17ohos_unittest("distributed_file_daemon_proxy_test") {
18  branch_protector_ret = "pac_ret"
19  sanitize = {
20    integer_overflow = true
21    cfi = true
22    cfi_cross_dso = true
23    debug = false
24    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
25  }
26
27  module_out_path = "filemanagement/dfs_service"
28
29  sources = [
30    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/distributed_file_daemon_proxy.cpp",
31    "${distributedfile_path}/test/mock/message_parcel_mock.cpp",
32    "distributed_file_daemon_proxy_test.cpp",
33  ]
34
35  include_dirs = [
36    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
37    "${distributedfile_path}/test/mock",
38    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
39    "include",
40    "${services_path}/distributedfiledaemon/include/",
41    "${services_path}/distributedfiledaemon/include/ipc",
42  ]
43
44  deps = [
45    "${utils_path}:libdistributedfileutils",
46    "//third_party/googletest:gmock_main",
47    "//third_party/googletest:gtest_main",
48  ]
49
50  external_deps = [
51    "c_utils:utils",
52    "device_manager:devicemanagersdk",
53    "hilog:libhilog",
54    "ipc:ipc_core",
55  ]
56
57  defines = [
58    "private=public",
59    "LOG_TAG=\"distributedfile_daemon\"",
60  ]
61
62  use_exceptions = true
63  part_name = "dfs_service"
64  subsystem_name = "filemanagement"
65}
66
67ohos_unittest("file_trans_listener_stub_test") {
68  branch_protector_ret = "pac_ret"
69  sanitize = {
70    integer_overflow = true
71    cfi = true
72    cfi_cross_dso = true
73    debug = false
74    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
75  }
76
77  module_out_path = "filemanagement/dfs_service"
78
79  sources = [
80    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/file_trans_listener_stub.cpp",
81    "${distributedfile_path}/test/mock/message_parcel_mock.cpp",
82    "file_trans_listener_stub_test.cpp",
83  ]
84
85  include_dirs = [
86    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
87    "${distributedfile_path}/test/mock",
88  ]
89
90  deps = [
91    "${utils_path}:libdistributedfileutils",
92    "//third_party/googletest:gmock_main",
93    "//third_party/googletest:gtest_main",
94  ]
95
96  external_deps = [
97    "c_utils:utils",
98    "device_manager:devicemanagersdk",
99    "hilog:libhilog",
100    "ipc:ipc_core",
101  ]
102
103  defines = [
104    "private=public",
105    "LOG_TAG=\"distributedfile_daemon\"",
106  ]
107
108  use_exceptions = true
109  part_name = "dfs_service"
110  subsystem_name = "filemanagement"
111}
112
113ohos_unittest("asset_recv_callback_stub_test") {
114  branch_protector_ret = "pac_ret"
115  sanitize = {
116    integer_overflow = true
117    cfi = true
118    cfi_cross_dso = true
119    debug = false
120    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
121  }
122
123  module_out_path = "filemanagement/dfs_service"
124
125  sources = [
126    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp",
127    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_recv_callback_stub.cpp",
128    "asset/asset_recv_callback_stub_test.cpp",
129  ]
130
131  include_dirs = [
132    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
133    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
134    "include",
135    "${services_path}/distributedfiledaemon/include/",
136    "${services_path}/distributedfiledaemon/include/ipc",
137  ]
138
139  deps = [
140    "${utils_path}:libdistributedfileutils",
141    "//third_party/googletest:gmock_main",
142    "//third_party/googletest:gtest_main",
143  ]
144
145  external_deps = [
146    "c_utils:utils",
147    "device_manager:devicemanagersdk",
148    "hilog:libhilog",
149    "ipc:ipc_core",
150  ]
151
152  defines = [
153    "private=public",
154    "LOG_TAG=\"distributedfile_daemon\"",
155  ]
156
157  use_exceptions = true
158  part_name = "dfs_service"
159  subsystem_name = "filemanagement"
160}
161
162ohos_unittest("asset_send_callback_stub_test") {
163  branch_protector_ret = "pac_ret"
164  sanitize = {
165    integer_overflow = true
166    cfi = true
167    cfi_cross_dso = true
168    debug = false
169    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
170  }
171
172  module_out_path = "filemanagement/dfs_service"
173
174  sources = [
175    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp",
176    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_send_callback_stub.cpp",
177    "asset/asset_send_callback_stub_test.cpp",
178  ]
179
180  include_dirs = [
181    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
182    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
183    "include",
184    "${services_path}/distributedfiledaemon/include/",
185    "${services_path}/distributedfiledaemon/include/ipc",
186  ]
187
188  deps = [
189    "${utils_path}:libdistributedfileutils",
190    "//third_party/googletest:gmock_main",
191    "//third_party/googletest:gtest_main",
192  ]
193
194  external_deps = [
195    "c_utils:utils",
196    "device_manager:devicemanagersdk",
197    "hilog:libhilog",
198    "ipc:ipc_core",
199  ]
200
201  defines = [
202    "private=public",
203    "LOG_TAG=\"distributedfile_daemon\"",
204  ]
205
206  use_exceptions = true
207  part_name = "dfs_service"
208  subsystem_name = "filemanagement"
209}
210
211group("distributed_file_inner") {
212  testonly = true
213
214  deps = [
215    ":asset_recv_callback_stub_test",
216    ":asset_send_callback_stub_test",
217    ":distributed_file_daemon_proxy_test",
218    ":file_trans_listener_stub_test",
219  ]
220}
221