1# Copyright (C) 2023 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
16ohos_unittest("cloud_sync_callback_client_test") {
17  module_out_path = "filemanagement/dfs_service"
18
19  sources = [ "cloud_sync_callback_client_test.cpp" ]
20
21  include_dirs = [
22    "${services_path}/cloudsyncservice/include/ipc",
23    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
24    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
25    "${distributedfile_path}/utils/log/include",
26  ]
27
28  deps = [
29    "//third_party/googletest:gmock_main",
30    "//third_party/googletest:gtest_main",
31  ]
32
33  external_deps = [
34    "c_utils:utils",
35    "dfs_service:cloudsync_kit_inner",
36    "hilog:libhilog",
37    "ipc:ipc_single",
38  ]
39
40  defines = [ "private=public" ]
41
42  use_exceptions = true
43}
44
45ohos_unittest("cloud_sync_callback_stub_test") {
46  module_out_path = "filemanagement/dfs_service"
47
48  sources = [ "cloud_sync_callback_stub_test.cpp" ]
49
50  include_dirs = [
51    "${services_path}/cloudsyncservice/include/ipc",
52    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
53    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
54    "${distributedfile_path}/utils/log/include",
55  ]
56
57  deps = [
58    "//third_party/googletest:gmock_main",
59    "//third_party/googletest:gtest_main",
60  ]
61
62  external_deps = [
63    "c_utils:utils",
64    "dfs_service:cloudsync_kit_inner",
65    "hilog:libhilog",
66    "ipc:ipc_single",
67  ]
68
69  defines = [ "private=public" ]
70
71  use_exceptions = true
72}
73
74ohos_unittest("cloud_sync_manager_impl_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 = "filemanagement/dfs_service"
85
86  sources = [
87    "${distributedfile_path}/test/mock/ipc/cloud_sync_service_proxy_mock.cpp",
88    "cloud_sync_manager_impl_test.cpp",
89  ]
90
91  include_dirs = [
92    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
93    "${services_path}/cloudsyncservice/include/ipc",
94    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
95    "${distributedfile_path}/test/mock/ipc",
96    "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner",
97    "${distributedfile_path}/utils/log/include",
98  ]
99
100  deps = [
101    "${services_path}/cloudsyncservice:cloudsync_sa_static",
102    "//third_party/googletest:gmock_main",
103    "//third_party/googletest:gtest_main",
104  ]
105
106  external_deps = [
107    "c_utils:utils",
108    "dfs_service:cloudsync_kit_inner",
109    "hilog:libhilog",
110    "ipc:ipc_single",
111  ]
112
113  defines = [ "private=public" ]
114
115  use_exceptions = true
116}
117
118ohos_unittest("cloud_sync_manager_impl_unnomal_test") {
119  module_out_path = "filemanagement/dfs_service"
120
121  sources = [
122    "${distributedfile_path}/test/mock/ipc/cloud_sync_service_proxy_unnomal_mock.cpp",
123    "cloud_sync_manager_impl_unnomal_test.cpp",
124  ]
125
126  include_dirs = [
127    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
128    "${services_path}/cloudsyncservice/include/ipc",
129    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
130    "${distributedfile_path}/test/mock/ipc",
131    "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner",
132    "${distributedfile_path}/utils/log/include",
133  ]
134
135  deps = [
136    "${services_path}/cloudsyncservice:cloudsync_sa_static",
137    "//third_party/googletest:gmock_main",
138    "//third_party/googletest:gtest_main",
139  ]
140
141  external_deps = [
142    "c_utils:utils",
143    "dfs_service:cloudsync_kit_inner",
144    "hilog:libhilog",
145    "ipc:ipc_single",
146  ]
147
148  defines = [ "private=public" ]
149
150  use_exceptions = true
151}
152
153ohos_unittest("cloud_sync_manager_test") {
154  module_out_path = "filemanagement/dfs_service"
155
156  sources = [ "cloud_sync_manager_test.cpp" ]
157
158  include_dirs = [
159    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
160    "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner",
161  ]
162
163  deps = [
164    "${utils_path}:libdistributedfileutils",
165    "//third_party/googletest:gmock_main",
166    "//third_party/googletest:gtest_main",
167  ]
168
169  external_deps = [
170    "c_utils:utils",
171    "dfs_service:cloudsync_kit_inner",
172    "hilog:libhilog",
173    "ipc:ipc_single",
174  ]
175
176  defines = [ "private=public" ]
177
178  use_exceptions = true
179}
180
181ohos_unittest("cloud_sync_service_proxy_test") {
182  module_out_path = "filemanagement/dfs_service"
183
184  sources = [ "cloud_sync_service_proxy_test.cpp" ]
185
186  include_dirs = [
187    "${services_path}/cloudsyncservice/include/ipc",
188    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
189    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
190    "${distributedfile_path}/utils/log/include",
191  ]
192
193  deps = [
194    "//third_party/googletest:gmock_main",
195    "//third_party/googletest:gtest_main",
196  ]
197
198  external_deps = [
199    "c_utils:utils",
200    "dfs_service:cloudsync_kit_inner",
201    "hilog:libhilog",
202    "ipc:ipc_single",
203  ]
204
205  defines = [ "private=public" ]
206
207  use_exceptions = true
208}
209
210ohos_unittest("cloud_download_callback_client_test") {
211  module_out_path = "filemanagement/dfs_service"
212
213  sources = [ "cloud_download_callback_client_test.cpp" ]
214
215  include_dirs = [
216    "${services_path}/cloudsyncservice/include/ipc",
217    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
218    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
219    "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner",
220    "${distributedfile_path}/utils/log/include",
221  ]
222
223  deps = [
224    "//third_party/googletest:gmock_main",
225    "//third_party/googletest:gtest_main",
226  ]
227
228  external_deps = [
229    "c_utils:utils",
230    "dfs_service:cloudsync_kit_inner",
231    "hilog:libhilog",
232    "ipc:ipc_single",
233  ]
234
235  defines = [
236    "private=public",
237    "LOG_DOMAIN=0xD004307",
238    "LOG_TAG=\"CLOUDSYNC_TEST\"",
239  ]
240
241  use_exceptions = true
242}
243
244ohos_unittest("cloud_download_callback_stub_test") {
245  module_out_path = "filemanagement/dfs_service"
246
247  sources = [
248    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_download_callback_stub.cpp",
249    "../../../mock/cloud_download_uri_manager_hook.cpp",
250    "cloud_download_callback_stub_test.cpp",
251  ]
252
253  include_dirs = [
254    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
255    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
256    "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner",
257    "${distributedfile_path}/utils/log/include",
258  ]
259
260  deps = [
261    "//third_party/googletest:gmock_main",
262    "//third_party/googletest:gtest_main",
263  ]
264
265  external_deps = [
266    "c_utils:utils",
267    "dfs_service:cloudsync_kit_inner",
268    "hilog:libhilog",
269    "ipc:ipc_single",
270  ]
271
272  defines = [
273    "private=public",
274    "protected=public",
275    "LOG_DOMAIN=0xD004307",
276    "LOG_TAG=\"CLOUDSYNC_TEST\"",
277  ]
278
279  use_exceptions = true
280}
281
282ohos_unittest("cloud_download_uri_manager_test") {
283  module_out_path = "filemanagement/dfs_service"
284
285  sources = [
286    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_download_uri_manager.cpp",
287    "cloud_download_uri_manager_test.cpp",
288  ]
289
290  include_dirs = [
291    "${services_path}/cloudsyncservice/include/ipc",
292    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
293    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
294  ]
295
296  deps = [
297    "${utils_path}:libdistributedfileutils",
298    "//third_party/googletest:gmock_main",
299    "//third_party/googletest:gtest_main",
300  ]
301
302  external_deps = [
303    "c_utils:utils",
304    "dfs_service:cloudsync_kit_inner",
305    "hilog:libhilog",
306    "ipc:ipc_single",
307  ]
308
309  defines = [ "private=public" ]
310
311  use_exceptions = true
312}
313
314ohos_unittest("cloud_sync_common_test") {
315  module_out_path = "filemanagement/dfs_service"
316
317  sources = [
318    "cloud_sync_common_test.cpp",
319    "file_hook/parcel.cpp",
320  ]
321
322  include_dirs = [
323    "${services_path}/cloudsyncservice/include/ipc",
324    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
325    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
326  ]
327
328  deps = [
329    "${utils_path}:libdistributedfileutils",
330    "//third_party/googletest:gmock_main",
331    "//third_party/googletest:gtest_main",
332  ]
333
334  external_deps = [
335    "c_utils:utils",
336    "dfs_service:cloudsync_kit_inner",
337    "ipc:ipc_single",
338  ]
339
340  defines = [ "private=public" ]
341
342  use_exceptions = true
343}
344
345ohos_unittest("cloud_sync_asset_manager_impl_test") {
346  module_out_path = "filemanagement/dfs_service"
347
348  sources = [
349    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_asset_manager_impl.cpp",
350    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_client.cpp",
351    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_stub.cpp",
352    "cloud_sync_asset_manager_impl_test.cpp",
353  ]
354
355  include_dirs = [
356    "${services_path}/cloudsyncservice/include/ipc",
357    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
358    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
359    "${distributedfile_path}/utils/log/include",
360  ]
361
362  deps = [
363    "//third_party/googletest:gmock_main",
364    "//third_party/googletest:gtest_main",
365  ]
366
367  external_deps = [
368    "c_utils:utils",
369    "dfs_service:cloudsync_kit_inner",
370    "hilog:libhilog",
371    "ipc:ipc_single",
372  ]
373
374  defines = [ "private=public" ]
375
376  use_exceptions = true
377}
378
379ohos_unittest("cloud_sync_asset_manager_impl_unnomal_test") {
380  module_out_path = "filemanagement/dfs_service"
381
382  sources = [
383    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_asset_manager_impl.cpp",
384    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_client.cpp",
385    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_stub.cpp",
386    "${distributedfile_path}/test/mock/ipc/cloud_sync_service_proxy_unnomal_mock.cpp",
387    "cloud_sync_asset_manager_impl_unnomal_test.cpp",
388  ]
389
390  include_dirs = [
391    "${services_path}/cloudsyncservice/include/ipc",
392    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
393    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
394  ]
395
396  deps = [
397    "${utils_path}:libdistributedfileutils",
398    "//third_party/googletest:gmock_main",
399    "//third_party/googletest:gtest_main",
400  ]
401
402  external_deps = [
403    "c_utils:utils",
404    "dfs_service:cloudsync_asset_kit_inner",
405    "hilog:libhilog",
406    "ipc:ipc_single",
407  ]
408
409  defines = [ "private=public" ]
410
411  use_exceptions = true
412}
413
414ohos_unittest("cloud_sync_asset_manager_test") {
415  module_out_path = "filemanagement/dfs_service"
416
417  sources = [ "cloud_sync_asset_manager_test.cpp" ]
418
419  include_dirs = [
420    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
421    "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner",
422  ]
423
424  deps = [
425    "${utils_path}:libdistributedfileutils",
426    "//third_party/googletest:gmock_main",
427    "//third_party/googletest:gtest_main",
428  ]
429
430  external_deps = [
431    "c_utils:utils",
432    "dfs_service:cloudsync_asset_kit_inner",
433    "hilog:libhilog",
434    "ipc:ipc_single",
435  ]
436
437  defines = [ "private=public" ]
438
439  use_exceptions = true
440}
441
442ohos_unittest("download_asset_callback_client_test") {
443  module_out_path = "filemanagement/dfs_service"
444
445  sources = [ "download_asset_callback_client_test.cpp" ]
446
447  include_dirs = [
448    "${services_path}/cloudsyncservice/include/ipc",
449    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
450    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
451    "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner",
452  ]
453
454  deps = [
455    "${utils_path}:libdistributedfileutils",
456    "//third_party/googletest:gmock_main",
457    "//third_party/googletest:gtest_main",
458  ]
459
460  external_deps = [
461    "c_utils:utils",
462    "dfs_service:cloudsync_kit_inner",
463    "hilog:libhilog",
464    "ipc:ipc_single",
465  ]
466
467  defines = [
468    "private=public",
469    "LOG_DOMAIN=0xD004307",
470    "LOG_TAG=\"CLOUDSYNC_TEST\"",
471  ]
472
473  use_exceptions = true
474}
475
476ohos_unittest("download_asset_callback_stub_test") {
477  module_out_path = "filemanagement/dfs_service"
478
479  sources = [
480    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_stub.cpp",
481    "../../../mock/cloud_download_uri_manager_hook.cpp",
482    "download_asset_callback_stub_test.cpp",
483  ]
484
485  include_dirs = [
486    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
487    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
488    "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner",
489  ]
490
491  deps = [
492    "${utils_path}:libdistributedfileutils",
493    "//third_party/googletest:gmock_main",
494    "//third_party/googletest:gtest_main",
495  ]
496
497  external_deps = [
498    "c_utils:utils",
499    "dfs_service:cloudsync_kit_inner",
500    "hilog:libhilog",
501    "ipc:ipc_single",
502  ]
503
504  defines = [
505    "private=public",
506    "protected=public",
507    "LOG_DOMAIN=0xD004307",
508    "LOG_TAG=\"CLOUDSYNC_TEST\"",
509  ]
510
511  use_exceptions = true
512}
513
514group("cloudsync_impl_test") {
515  testonly = true
516
517  deps = [
518    ":cloud_download_callback_client_test",
519    ":cloud_download_callback_stub_test",
520    ":cloud_download_uri_manager_test",
521    ":cloud_sync_asset_manager_impl_test",
522    ":cloud_sync_asset_manager_impl_unnomal_test",
523    ":cloud_sync_asset_manager_test",
524    ":cloud_sync_callback_client_test",
525    ":cloud_sync_callback_stub_test",
526    ":cloud_sync_common_test",
527    ":cloud_sync_manager_impl_test",
528    ":cloud_sync_manager_impl_unnomal_test",
529    ":cloud_sync_manager_test",
530    ":cloud_sync_service_proxy_test",
531    ":download_asset_callback_client_test",
532    ":download_asset_callback_stub_test",
533  ]
534}
535