• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2023-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("battery_status_listener_test") {
18  branch_protector_ret = "pac_ret"
19  sanitize = {
20    ubsan = true
21    boundary_sanitize = true
22    cfi = true
23    cfi_cross_dso = true
24    debug = true
25    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
26  }
27  module_out_path = "filemanagement/dfs_service"
28  sources = [
29    "${distributedfile_path}/services/cloudsyncservice/src/sync_rule/battery_status_listener.cpp",
30    "battery_status_listener_test.cpp",
31  ]
32
33  include_dirs = [
34    "${services_path}/cloudsyncservice/include",
35    "${services_path}/cloudsyncservice/include/sync_rule",
36    "${innerkits_native_path}/cloudsync_kit_inner",
37    "${distributedfile_path}/adapter/cloud_adapter_example/include",
38    "${services_path}/cloudsyncservice/include/sync_rule",
39    "${utils_path}/log/include",
40    "${image_framework_path}/mock/native/include/log",
41    "${media_library_path}/interfaces/inner_api/media_library_helper/include",
42    "${media_library_path}/frameworks/utils/include",
43  ]
44
45  deps = [
46    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
47    "${services_path}/cloudsyncservice:cloudsync_sa_static",
48    "${utils_path}:libdistributedfileutils",
49    "//third_party/googletest:gmock_main",
50    "//third_party/googletest:gtest_main",
51  ]
52
53  external_deps = [
54    "ability_base:want",
55    "c_utils:utils",
56    "common_event_service:cesfwk_innerkits",
57    "hilog:libhilog",
58    "hisysevent:libhisysevent",
59    "init:libbegetutil",
60    "ipc:ipc_core",
61    "netmanager_base:net_conn_manager_if",
62    "relational_store:native_rdb",
63    "safwk:system_ability_fwk",
64    "samgr:samgr_proxy",
65  ]
66
67  defines = [
68    "private=public",
69    "LOG_DOMAIN=0xD004310",
70    "LOG_TAG=\"CLOUD_SYNC_TEST\"",
71  ]
72  if (cloudsync_service_resource_schedule) {
73    external_deps += [ "resource_schedule_service:ressched_client" ]
74    defines += [ "CLOUDSYNC_SERVICE_RESOURCE_SCHEDULE" ]
75  }
76  use_exceptions = true
77}
78
79ohos_unittest("net_conn_callback_observer_test") {
80  module_out_path = "filemanagement/dfs_service"
81  sources = [
82    "${distributedfile_path}/services/cloudsyncservice/src/sync_rule/net_conn_callback_observer.cpp",
83    "net_conn_callback_observer_test.cpp",
84  ]
85
86  include_dirs = [
87    "${services_path}/cloudsyncservice/include",
88    "${services_path}/cloudsyncservice/include/sync_rule",
89    "${utils_path}/log/include",
90    "${image_framework_path}/mock/native/include/log",
91    "${innerkits_native_path}/cloudsync_kit_inner",
92    "${distributedfile_path}/adapter/cloud_adapter_example/include",
93  ]
94
95  deps = [
96    "${services_path}/cloudsyncservice:cloudsync_sa_static",
97    "${utils_path}:libdistributedfiledentry",
98    "${utils_path}:libdistributedfileutils",
99    "//third_party/googletest:gmock_main",
100    "//third_party/googletest:gtest_main",
101  ]
102
103  external_deps = [
104    "ability_base:want",
105    "c_utils:utils",
106    "common_event_service:cesfwk_innerkits",
107    "hilog:libhilog",
108    "hisysevent:libhisysevent",
109    "init:libbegetutil",
110    "ipc:ipc_core",
111    "netmanager_base:net_conn_manager_if",
112    "relational_store:native_rdb",
113    "safwk:system_ability_fwk",
114    "samgr:samgr_proxy",
115  ]
116
117  defines = [ "private=public" ]
118
119  use_exceptions = true
120}
121
122ohos_unittest("network_status_test") {
123  module_out_path = "filemanagement/dfs_service"
124  sources = [
125    "${distributedfile_path}/frameworks/native/cloud_file_kit_inner/src/data_sync_manager.cpp",
126    "${distributedfile_path}/frameworks/native/cloud_file_kit_inner/src/sync_rule/net_conn_callback_observer.cpp",
127    "${distributedfile_path}/frameworks/native/cloud_file_kit_inner/src/sync_rule/network_status.cpp",
128    "${distributedfile_path}/test/mock/net_conn_client_mock.cpp",
129    "${distributedfile_path}/test/unittests/cloudsync_sa/mock/network_set_manager_mock.cpp",
130    "network_status_test.cpp",
131  ]
132
133  include_dirs = [
134    "${distributedfile_path}/interfaces/inner_api/native/cloud_file_kit_inner",
135    "${distributedfile_path}/test/mock/",
136    "${innerkits_native_path}/cloud_file_kit_inner",
137    "${services_path}/cloudsyncservice/include",
138    "${services_path}/cloudsyncservice/include/sync_rule",
139    "${utils_path}/log/include",
140    "${image_framework_path}/mock/native/include/log",
141    "${innerkits_native_path}/cloudsync_kit_inner",
142    "${distributedfile_path}/adapter/cloud_adapter_example/include",
143    "${media_library_path}/interfaces/inner_api/media_library_helper/include",
144    "${media_library_path}/frameworks/utils/include",
145  ]
146
147  deps = [
148    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
149    "${utils_path}:libdistributedfileutils",
150    "//third_party/googletest:gmock_main",
151    "//third_party/googletest:gtest_main",
152  ]
153
154  external_deps = [
155    "access_token:libaccesstoken_sdk",
156    "access_token:libtokenid_sdk",
157    "c_utils:utils",
158    "common_event_service:cesfwk_innerkits",
159    "data_share:datashare_consumer",
160    "dfs_service:cloudsync_kit_inner",
161    "hilog:libhilog",
162    "hisysevent:libhisysevent",
163    "init:libbegetutil",
164    "ipc:ipc_core",
165    "netmanager_base:net_conn_manager_if",
166    "relational_store:native_rdb",
167    "samgr:samgr_proxy",
168  ]
169
170  defines = [ "private=public" ]
171  if (cloudsync_service_resource_schedule) {
172    external_deps += [ "resource_schedule_service:ressched_client" ]
173    defines += [ "CLOUDSYNC_SERVICE_RESOURCE_SCHEDULE" ]
174  }
175  use_exceptions = true
176}
177
178ohos_unittest("cloud_status_test") {
179  module_out_path = "filemanagement/dfs_service"
180  sources = [
181    "${distributedfile_path}/frameworks/native/cloud_file_kit_inner/src/sync_rule/cloud_status.cpp",
182    "${distributedfile_path}/test/mock/cloud_file_kit_mock.cpp",
183    "${distributedfile_path}/utils/log/src/dfs_error.cpp",
184    "cloud_status_test.cpp",
185  ]
186
187  include_dirs = [
188    "${distributedfile_path}/interfaces/inner_api/native/cloud_file_kit_inner",
189    "${services_path}/cloudsyncservice/include",
190    "${media_library_path}/frameworks/utils/include",
191    "${distributedfile_path}/adapter/cloud_adapter_example/include",
192    "${distributedfile_path}/test/mock",
193  ]
194
195  deps = [
196    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
197    "${innerkits_native_path}/cloudsync_kit_inner:cloudsync_kit_inner",
198    "${services_path}/cloudsyncservice:cloudsync_sa_static",
199    "${utils_path}:libdistributedfileutils",
200    "//third_party/googletest:gmock_main",
201    "//third_party/googletest:gtest_main",
202  ]
203
204  external_deps = [
205    "c_utils:utils",
206    "hilog:libhilog",
207    "hisysevent:libhisysevent",
208  ]
209
210  defines = [ "private=public" ]
211
212  use_exceptions = true
213}
214
215ohos_unittest("battery_status_test") {
216  branch_protector_ret = "pac_ret"
217  sanitize = {
218    ubsan = true
219    boundary_sanitize = true
220    cfi = true
221    cfi_cross_dso = true
222    debug = true
223    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
224  }
225  module_out_path = "filemanagement/dfs_service"
226  sources = [
227    "${distributedfile_path}/frameworks/native/cloud_file_kit_inner/src/sync_rule/battery_status.cpp",
228    "${distributedfile_path}/test/mock/battersrvclient_mock.cpp",
229    "battery_status_test.cpp",
230  ]
231
232  include_dirs = [
233    "${services_path}/cloudsyncservice/include",
234    "${services_path}/cloudsyncservice/include/sync_rule",
235    "${innerkits_native_path}/cloudsync_kit_inner",
236    "${distributedfile_path}/adapter/cloud_adapter_example/include",
237    "${distributedfile_path}/interfaces/inner_api/native/cloud_file_kit_inner",
238    "${utils_path}/log/include",
239    "${image_framework_path}/mock/native/include/log",
240    "${media_library_path}/interfaces/inner_api/media_library_helper/include",
241    "${media_library_path}/frameworks/utils/include",
242    "${distributedfile_path}/test/mock",
243  ]
244
245  deps = [
246    "${services_path}/cloudsyncservice:cloudsync_sa_static",
247    "${utils_path}:libdistributedfileutils",
248    "//third_party/googletest:gmock_main",
249    "//third_party/googletest:gtest_main",
250  ]
251
252  external_deps = [
253    "ability_base:want",
254    "c_utils:utils",
255    "common_event_service:cesfwk_innerkits",
256    "hilog:libhilog",
257    "hisysevent:libhisysevent",
258    "init:libbegetutil",
259    "ipc:ipc_core",
260    "netmanager_base:net_conn_manager_if",
261    "power_manager:powermgr_client",
262    "relational_store:native_rdb",
263    "safwk:system_ability_fwk",
264    "samgr:samgr_proxy",
265  ]
266
267  defines = [
268    "private=public",
269    "LOG_DOMAIN=0xD004310",
270    "LOG_TAG=\"CLOUD_SYNC_TEST\"",
271  ]
272
273  if (cloudsync_service_power) {
274    external_deps += [ "battery_manager:batterysrv_client" ]
275
276    defines += [ "SUPPORT_POWER" ]
277  }
278
279  use_exceptions = true
280}
281
282ohos_unittest("network_set_manager_test") {
283  branch_protector_ret = "pac_ret"
284  sanitize = {
285    ubsan = true
286    boundary_sanitize = true
287    cfi = true
288    cfi_cross_dso = true
289    debug = true
290    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
291  }
292
293  module_out_path = "filemanagement/dfs_service"
294  sources = [
295    "${distributedfile_path}/test/unittests/cloudsync_sa/mock/datashare_helper.cpp",
296    "network_set_manager_test.cpp",
297  ]
298
299  include_dirs = [
300    "${distributedfile_path}/interfaces/inner_api/native/cloud_file_kit_inner",
301    "${distributedfile_path}/test/unittests/cloudsync_sa/mock",
302    "${innerkits_native_path}/cloud_file_kit_inner",
303    "${innerkits_native_path}/cloudsync_kit_inner",
304    "${services_path}/cloudsyncservice/include",
305    "${services_path}/cloudsyncservice/include/sync_rule",
306    "${utils_path}/log/include",
307    "${image_framework_path}/mock/native/include/log",
308    "${distributedfile_path}/adapter/cloud_adapter_example/include",
309    "${media_library_path}/interfaces/inner_api/media_library_helper/include",
310    "${media_library_path}/frameworks/utils/include",
311  ]
312
313  deps = [
314    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
315    "${utils_path}:libdistributedfileutils",
316    "//third_party/googletest:gmock_main",
317    "//third_party/googletest:gtest_main",
318  ]
319
320  external_deps = [
321    "ability_base:zuri",
322    "ability_runtime:dataobs_manager",
323    "access_token:libtokenid_sdk",
324    "c_utils:utils",
325    "hilog:libhilog",
326    "hisysevent:libhisysevent",
327    "init:libbegetutil",
328    "ipc:ipc_core",
329    "ipc:ipc_single",
330    "safwk:system_ability_fwk",
331  ]
332
333  defines = [ "private=public" ]
334
335  use_exceptions = true
336}
337
338ohos_unittest("system_load_test") {
339  module_out_path = "filemanagement/dfs_service"
340  sources = [
341    "${distributedfile_path}/frameworks/native/cloud_file_kit_inner/src/sync_rule/system_load.cpp",
342    "system_load_test.cpp",
343  ]
344
345  include_dirs = [
346    "${distributedfile_path}/interfaces/inner_api/native/cloud_file_kit_inner",
347    "${innerkits_native_path}/cloud_file_kit_inner",
348    "${services_path}/cloudsyncservice/include",
349    "${services_path}/cloudsyncservice/include/sync_rule",
350    "${utils_path}/log/include",
351    "${image_framework_path}/mock/native/include/log",
352    "${innerkits_native_path}/cloudsync_kit_inner",
353    "${distributedfile_path}/adapter/cloud_adapter_example/include",
354    "${media_library_path}/interfaces/inner_api/media_library_helper/include",
355    "${media_library_path}/frameworks/utils/include",
356  ]
357
358  deps = [
359    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
360    "${utils_path}:libdistributedfileutils",
361    "//third_party/googletest:gmock_main",
362    "//third_party/googletest:gtest_main",
363  ]
364
365  external_deps = [
366    "access_token:libaccesstoken_sdk",
367    "access_token:libtokenid_sdk",
368    "c_utils:utils",
369    "common_event_service:cesfwk_innerkits",
370    "data_share:datashare_consumer",
371    "dfs_service:cloudsync_kit_inner",
372    "ffrt:libffrt",
373    "hilog:libhilog",
374    "hisysevent:libhisysevent",
375    "init:libbegetutil",
376    "ipc:ipc_core",
377    "netmanager_base:net_conn_manager_if",
378    "relational_store:native_rdb",
379    "resource_schedule_service:ressched_client",
380    "samgr:samgr_proxy",
381  ]
382
383  defines = [ "private=public" ]
384
385  use_exceptions = true
386}
387
388ohos_unittest("screen_status_listener_test") {
389  branch_protector_ret = "pac_ret"
390  sanitize = {
391    ubsan = true
392    boundary_sanitize = true
393    cfi = true
394    cfi_cross_dso = true
395    debug = true
396    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
397  }
398  module_out_path = "filemanagement/dfs_service"
399  sources = [
400    "${distributedfile_path}/services/cloudsyncservice/src/sync_rule/screen_status_listener.cpp",
401    "screen_status_listener_test.cpp",
402  ]
403
404  include_dirs = [
405    "${services_path}/cloudsyncservice/include",
406    "${services_path}/cloudsyncservice/include/sync_rule",
407    "${innerkits_native_path}/cloudsync_kit_inner",
408    "${distributedfile_path}/adapter/cloud_adapter_example/include",
409    "${utils_path}/log/include",
410  ]
411
412  deps = [
413    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
414    "${services_path}/cloudsyncservice:cloudsync_sa_static",
415    "${utils_path}:libdistributedfileutils",
416  ]
417
418  external_deps = [
419    "ability_base:want",
420    "c_utils:utils",
421    "common_event_service:cesfwk_innerkits",
422    "googletest:gmock",
423    "googletest:gtest",
424    "hilog:libhilog",
425    "hisysevent:libhisysevent",
426    "init:libbegetutil",
427    "ipc:ipc_core",
428    "netmanager_base:net_conn_manager_if",
429    "relational_store:native_rdb",
430    "safwk:system_ability_fwk",
431    "samgr:samgr_proxy",
432  ]
433
434  defines = [
435    "private=public",
436    "LOG_DOMAIN=0xD004310",
437    "LOG_TAG=\"CLOUD_SYNC_TEST\"",
438  ]
439  if (cloudsync_service_resource_schedule) {
440    external_deps += [ "resource_schedule_service:ressched_client" ]
441    defines += [ "CLOUDSYNC_SERVICE_RESOURCE_SCHEDULE" ]
442  }
443  use_exceptions = true
444}
445
446ohos_unittest("user_status_listener_test") {
447  branch_protector_ret = "pac_ret"
448  sanitize = {
449    ubsan = true
450    boundary_sanitize = true
451    cfi = true
452    cfi_cross_dso = true
453    debug = true
454    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
455  }
456  module_out_path = "filemanagement/dfs_service"
457  sources = [
458    "${distributedfile_path}/services/cloudsyncservice/src/sync_rule/user_status_listener.cpp",
459    "user_status_listener_test.cpp",
460  ]
461
462  include_dirs = [
463    "${services_path}/cloudsyncservice/include",
464    "${services_path}/cloudsyncservice/include/sync_rule",
465    "${services_path}/cloudsyncservice/include/transport/softbus",
466    "${innerkits_native_path}/cloudsync_kit_inner",
467    "${distributedfile_path}/adapter/cloud_adapter_example/include",
468    "${utils_path}/log/include",
469  ]
470
471  deps = [
472    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
473    "${services_path}/cloudsyncservice:cloudsync_sa_static",
474    "${utils_path}:libdistributedfileutils",
475  ]
476
477  external_deps = [
478    "ability_base:want",
479    "c_utils:utils",
480    "common_event_service:cesfwk_innerkits",
481    "dsoftbus:softbus_client",
482    "ffrt:libffrt",
483    "googletest:gmock",
484    "googletest:gtest",
485    "hilog:libhilog",
486    "hisysevent:libhisysevent",
487    "init:libbegetutil",
488    "ipc:ipc_core",
489    "netmanager_base:net_conn_manager_if",
490    "relational_store:native_rdb",
491    "safwk:system_ability_fwk",
492    "samgr:samgr_proxy",
493  ]
494
495  defines = [
496    "private=public",
497    "LOG_DOMAIN=0xD004310",
498    "LOG_TAG=\"CLOUD_SYNC_TEST\"",
499  ]
500  if (cloudsync_service_resource_schedule) {
501    external_deps += [ "resource_schedule_service:ressched_client" ]
502    defines += [ "CLOUDSYNC_SERVICE_RESOURCE_SCHEDULE" ]
503  }
504  use_exceptions = true
505}
506
507group("cloudsync_sa_sync_rule_test") {
508  testonly = true
509  deps = [
510    ":battery_status_listener_test",
511    ":battery_status_test",
512    ":cloud_status_test",
513    ":network_set_manager_test",
514    ":network_status_test",
515    ":screen_status_listener_test",
516    ":system_load_test",
517    ":user_status_listener_test",
518  ]
519}
520