• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-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.
13
14import("//base/notification/distributed_notification_service/notification.gni")
15import("//build/ohos.gni")
16import("//build/test.gni")
17
18module_output_path =
19    "${component_name}/distributed_notification_service/unittest"
20
21group("ans_unit_test") {
22  testonly = true
23  deps = []
24
25  if (distributed_notification_supported) {
26    deps += [
27      ":ans_distributed_unit_test",
28      ":distributed_database_branch_test",
29      ":distributed_database_callback_test",
30      ":distributed_device_callback_test",
31      ":distributed_flow_control_test",
32      ":distributed_preferences_branch_test",
33      ":distributed_preferences_database_test",
34      ":distributed_screen_status_manager_branch_test",
35      ":distributed_service_test",
36      ":distributed_subscriber_test",
37    ]
38  }
39}
40
41ohos_unittest("ans_distributed_unit_test") {
42  module_out_path = module_output_path
43  include_dirs = [ "/${services_path}/distributed/include" ]
44
45  sources = [
46    "${services_path}/distributed/src/distributed_database.cpp",
47    "${services_path}/distributed/src/distributed_database_callback.cpp",
48    "${services_path}/distributed/src/distributed_device_callback.cpp",
49    "${services_path}/distributed/src/distributed_flow_control.cpp",
50    "${services_path}/distributed/src/distributed_notification_manager.cpp",
51    "${services_path}/distributed/src/distributed_preferences.cpp",
52    "${services_path}/distributed/src/distributed_preferences_database.cpp",
53    "${services_path}/distributed/src/distributed_preferences_info.cpp",
54    "${services_path}/distributed/src/distributed_screen_status_manager.cpp",
55    "${services_path}/distributed/test/unittest/distributed_database_test.cpp",
56    "${services_path}/distributed/test/unittest/distributed_notification_manager_test.cpp",
57    "${services_path}/distributed/test/unittest/distributed_preferences_test.cpp",
58    "${services_path}/distributed/test/unittest/distributed_screen_status_manager_test.cpp",
59    "${services_path}/distributed/test/unittest/mock/mock_blob.cpp",
60    "${services_path}/distributed/test/unittest/mock/mock_change_notification.cpp",
61    "${services_path}/distributed/test/unittest/mock/mock_device_manager_impl.cpp",
62    "${services_path}/distributed/test/unittest/mock/mock_event_handler.cpp",
63    "${services_path}/distributed/test/unittest/mock/mock_single_kv_store.cpp",
64  ]
65
66  configs = [
67    "${services_path}/distributed/:ans_distributed_config",
68    "${frameworks_module_ans_path}:ans_innerkits_public_config",
69  ]
70
71  deps = [
72    "${frameworks_module_ans_path}:ans_innerkits",
73    "//third_party/googletest:gtest_main",
74  ]
75
76  external_deps = [
77    "ability_base:base",
78    "ability_base:want",
79    "ability_base:zuri",
80    "bundle_framework:appexecfwk_base",
81    "c_utils:utils",
82    "device_manager:devicemanagersdk",
83    "eventhandler:libeventhandler",
84    "ffrt:libffrt",
85    "hilog:libhilog",
86    "hitrace:hitrace_meter",
87    "hitrace:libhitracechain",
88    "image_framework:image_native",
89    "ipc:ipc_core",
90    "kv_store:distributeddata_inner",
91  ]
92
93  subsystem_name = "${subsystem_name}"
94  part_name = "${component_name}"
95}
96
97ohos_unittest("distributed_preferences_database_test") {
98  module_out_path = module_output_path
99  include_dirs = [
100    "/${services_path}/distributed/include",
101    "${services_path}/distributed/test/unittest/mock",
102  ]
103
104  sources = [
105    "distributed_preferences_database_test/distributed_preferences_database_test.cpp",
106    "distributed_preferences_database_test/mock_distributed_flow_control.cpp",
107    "distributed_preferences_database_test/mock_distributed_kv_data_manager.cpp",
108    "distributed_preferences_database_test/mock_single_kv_store.cpp",
109  ]
110
111  configs = [
112    "${services_path}/distributed/:ans_distributed_config",
113    "${frameworks_module_ans_path}:ans_innerkits_public_config",
114  ]
115
116  deps = [
117    "${frameworks_module_ans_path}:ans_innerkits",
118    "${services_path}/distributed:libans_distributed",
119    "//third_party/googletest:gtest_main",
120  ]
121
122  external_deps = [
123    "ability_base:base",
124    "ability_base:want",
125    "ability_base:zuri",
126    "bundle_framework:appexecfwk_base",
127    "c_utils:utils",
128    "device_manager:devicemanagersdk",
129    "eventhandler:libeventhandler",
130    "hilog:libhilog",
131    "hitrace:hitrace_meter",
132    "hitrace:libhitracechain",
133    "image_framework:image_native",
134    "ipc:ipc_core",
135    "kv_store:distributeddata_inner",
136  ]
137
138  subsystem_name = "${subsystem_name}"
139  part_name = "${component_name}"
140}
141
142ohos_unittest("distributed_screen_status_manager_branch_test") {
143  module_out_path = module_output_path
144  include_dirs = [
145    "/${services_path}/distributed/include",
146    "${services_path}/distributed/test/unittest/mock",
147  ]
148
149  sources = [
150    "distributed_database_branch_test/mock_device_manager_impl.cpp",
151    "distributed_screen_status_manager_branch_test/distributed_screen_status_manager_branch_test.cpp",
152    "distributed_screen_status_manager_branch_test/mock_distributed_flow_control.cpp",
153    "distributed_screen_status_manager_branch_test/mock_distributed_kv_data_manager.cpp",
154    "distributed_screen_status_manager_branch_test/mock_single_kv_store.cpp",
155  ]
156
157  configs = [
158    "${services_path}/distributed/:ans_distributed_config",
159    "${frameworks_module_ans_path}:ans_innerkits_public_config",
160  ]
161
162  deps = [
163    "${frameworks_module_ans_path}:ans_innerkits",
164    "${services_path}/distributed:libans_distributed",
165    "//third_party/googletest:gtest_main",
166  ]
167
168  external_deps = [
169    "ability_base:base",
170    "ability_base:want",
171    "ability_base:zuri",
172    "bundle_framework:appexecfwk_base",
173    "c_utils:utils",
174    "device_manager:devicemanagersdk",
175    "eventhandler:libeventhandler",
176    "hilog:libhilog",
177    "hitrace:hitrace_meter",
178    "hitrace:libhitracechain",
179    "image_framework:image_native",
180    "ipc:ipc_core",
181    "kv_store:distributeddata_inner",
182  ]
183
184  subsystem_name = "${subsystem_name}"
185  part_name = "${component_name}"
186}
187
188ohos_unittest("distributed_database_branch_test") {
189  module_out_path = module_output_path
190  include_dirs = [
191    "/${services_path}/distributed/include",
192    "${services_path}/distributed/test/unittest/mock",
193  ]
194
195  sources = [
196    "distributed_database_branch_test/distributed_database_branch_test.cpp",
197    "distributed_database_branch_test/mock_device_manager_impl.cpp",
198    "distributed_database_branch_test/mock_distributed_flow_control.cpp",
199    "distributed_database_branch_test/mock_distributed_kv_data_manager.cpp",
200    "distributed_database_branch_test/mock_single_kv_store.cpp",
201  ]
202
203  configs = [
204    "${services_path}/distributed/:ans_distributed_config",
205    "${frameworks_module_ans_path}:ans_innerkits_public_config",
206  ]
207
208  deps = [
209    "${frameworks_module_ans_path}:ans_innerkits",
210    "${services_path}/distributed:libans_distributed",
211    "//third_party/googletest:gtest_main",
212  ]
213
214  external_deps = [
215    "ability_base:base",
216    "ability_base:want",
217    "ability_base:zuri",
218    "bundle_framework:appexecfwk_base",
219    "c_utils:utils",
220    "device_manager:devicemanagersdk",
221    "eventhandler:libeventhandler",
222    "hilog:libhilog",
223    "hitrace:hitrace_meter",
224    "hitrace:libhitracechain",
225    "image_framework:image_native",
226    "ipc:ipc_core",
227    "kv_store:distributeddata_inner",
228  ]
229
230  subsystem_name = "${subsystem_name}"
231  part_name = "${component_name}"
232}
233
234ohos_unittest("distributed_preferences_branch_test") {
235  module_out_path = module_output_path
236  include_dirs = [ "/${services_path}/distributed/include" ]
237
238  sources = [
239    "distributed_preferences_branch_test/distributed_preferences_branch_test.cpp",
240    "distributed_preferences_branch_test/mock_distributed_preferences_database.cpp",
241  ]
242
243  configs = [
244    "${services_path}/distributed/:ans_distributed_config",
245    "${frameworks_module_ans_path}:ans_innerkits_public_config",
246  ]
247
248  deps = [
249    "${frameworks_module_ans_path}:ans_innerkits",
250    "${services_path}/distributed:libans_distributed",
251    "//third_party/googletest:gtest_main",
252  ]
253
254  external_deps = [
255    "ability_base:base",
256    "ability_base:want",
257    "ability_base:zuri",
258    "bundle_framework:appexecfwk_base",
259    "c_utils:utils",
260    "device_manager:devicemanagersdk",
261    "eventhandler:libeventhandler",
262    "hilog:libhilog",
263    "hitrace:hitrace_meter",
264    "hitrace:libhitracechain",
265    "image_framework:image_native",
266    "ipc:ipc_core",
267    "kv_store:distributeddata_inner",
268  ]
269
270  subsystem_name = "${subsystem_name}"
271  part_name = "${component_name}"
272}
273
274ohos_unittest("distributed_device_callback_test") {
275  module_out_path = module_output_path
276  include_dirs = [ "/${services_path}/distributed/include" ]
277
278  sources = [ "distributed_device_callback_test.cpp" ]
279
280  configs = [
281    "${services_path}/distributed/:ans_distributed_config",
282    "${frameworks_module_ans_path}:ans_innerkits_public_config",
283  ]
284
285  deps = [
286    "${frameworks_module_ans_path}:ans_innerkits",
287    "${services_path}/distributed:libans_distributed",
288    "//third_party/googletest:gtest_main",
289  ]
290
291  external_deps = [
292    "ability_base:base",
293    "ability_base:want",
294    "ability_base:zuri",
295    "bundle_framework:appexecfwk_base",
296    "c_utils:utils",
297    "device_manager:devicemanagersdk",
298    "eventhandler:libeventhandler",
299    "hilog:libhilog",
300    "hitrace:hitrace_meter",
301    "hitrace:libhitracechain",
302    "image_framework:image_native",
303    "ipc:ipc_core",
304    "kv_store:distributeddata_inner",
305  ]
306
307  subsystem_name = "${subsystem_name}"
308  part_name = "${component_name}"
309}
310
311ohos_unittest("distributed_database_callback_test") {
312  module_out_path = module_output_path
313  include_dirs = [ "/${services_path}/distributed/include" ]
314
315  sources = [ "distributed_database_callback_test.cpp" ]
316
317  configs = [
318    "${services_path}/distributed/:ans_distributed_config",
319    "${frameworks_module_ans_path}:ans_innerkits_public_config",
320  ]
321
322  deps = [
323    "${frameworks_module_ans_path}:ans_innerkits",
324    "${services_path}/distributed:libans_distributed",
325    "//third_party/googletest:gtest_main",
326  ]
327
328  external_deps = [
329    "ability_base:base",
330    "ability_base:want",
331    "ability_base:zuri",
332    "bundle_framework:appexecfwk_base",
333    "c_utils:utils",
334    "eventhandler:libeventhandler",
335    "hilog:libhilog",
336    "hitrace:hitrace_meter",
337    "hitrace:libhitracechain",
338    "image_framework:image_native",
339    "ipc:ipc_core",
340    "kv_store:distributeddata_inner",
341  ]
342
343  subsystem_name = "${subsystem_name}"
344  part_name = "${component_name}"
345}
346
347ohos_unittest("distributed_flow_control_test") {
348  module_out_path = module_output_path
349  include_dirs = [ "/${services_path}/distributed/include" ]
350
351  sources = [ "distributed_flow_control_test.cpp" ]
352
353  configs = [
354    "${services_path}/distributed/:ans_distributed_config",
355    "${frameworks_module_ans_path}:ans_innerkits_public_config",
356  ]
357
358  deps = [
359    "${frameworks_module_ans_path}:ans_innerkits",
360    "${services_path}/distributed:libans_distributed",
361    "//third_party/googletest:gtest_main",
362  ]
363
364  external_deps = [
365    "ability_base:base",
366    "ability_base:want",
367    "ability_base:zuri",
368    "bundle_framework:appexecfwk_base",
369    "c_utils:utils",
370    "eventhandler:libeventhandler",
371    "hilog:libhilog",
372    "hitrace:hitrace_meter",
373    "hitrace:libhitracechain",
374    "image_framework:image_native",
375    "ipc:ipc_core",
376    "kv_store:distributeddata_inner",
377  ]
378
379  subsystem_name = "${subsystem_name}"
380  part_name = "${component_name}"
381}
382
383ohos_unittest("distributed_notification_manager_branch_test") {
384  module_out_path = module_output_path
385  include_dirs = [ "/${services_path}/distributed/include" ]
386
387  sources = [
388    "distributed_notification_manager_branch_test/distributed_notification_manager_branch_test.cpp",
389    "distributed_notification_manager_branch_test/mock_distributed_database.cpp",
390  ]
391
392  configs = [
393    "${services_path}/distributed/:ans_distributed_config",
394    "${frameworks_module_ans_path}:ans_innerkits_public_config",
395  ]
396
397  deps = [
398    "${frameworks_module_ans_path}:ans_innerkits",
399    "${services_path}/distributed:libans_distributed",
400    "//third_party/googletest:gtest_main",
401  ]
402
403  external_deps = [
404    "ability_base:base",
405    "ability_base:want",
406    "ability_base:zuri",
407    "bundle_framework:appexecfwk_base",
408    "c_utils:utils",
409    "device_manager:devicemanagersdk",
410    "eventhandler:libeventhandler",
411    "ffrt:libffrt",
412    "hilog:libhilog",
413    "hitrace:hitrace_meter",
414    "hitrace:libhitracechain",
415    "image_framework:image_native",
416    "ipc:ipc_core",
417    "kv_store:distributeddata_inner",
418  ]
419
420  subsystem_name = "${subsystem_name}"
421  part_name = "${component_name}"
422}
423
424ohos_unittest("distributed_service_test") {
425  module_out_path = module_output_path
426  include_dirs = [
427    "/${services_path}/distributed/include",
428    "/${services_path}/distributed/include/soft_bus",
429    "/${services_path}/distributed/include/tlv_box",
430    "/${services_path}/distributed/include/helper",
431    "/${services_path}/ans/include",
432  ]
433
434  sources = [
435    "/${frameworks_path}/ans/src/notification_helper.cpp",
436    "/${frameworks_path}/ans/src/notification_subscribe_info.cpp",
437    "/${services_path}/ans/src/common/notification_config_parse.cpp",
438    "/${services_path}/distributed/src/helper/ability_manager_helper.cpp",
439    "/${services_path}/distributed/src/helper/bundle_resource_helper.cpp",
440    "/${services_path}/distributed/src/helper/distributed_operation_connection.cpp",
441    "/${services_path}/distributed/src/helper/distributed_preference.cpp",
442    "/${services_path}/distributed/src/helper/distributed_rdb_helper.cpp",
443    "/${services_path}/distributed/src/soft_bus/distributed_client.cpp",
444    "/${services_path}/distributed/src/soft_bus/distributed_cmd_service.cpp",
445    "/${services_path}/distributed/src/soft_bus/distributed_liveview_all_scenarios_extension_wrapper.cpp",
446    "/${services_path}/distributed/src/soft_bus/distributed_local_config.cpp",
447    "/${services_path}/distributed/src/soft_bus/distributed_observer_service.cpp",
448    "/${services_path}/distributed/src/soft_bus/distributed_operation_service.cpp",
449    "/${services_path}/distributed/src/soft_bus/distributed_publish_service.cpp",
450    "/${services_path}/distributed/src/soft_bus/distributed_server.cpp",
451    "/${services_path}/distributed/src/soft_bus/distributed_service.cpp",
452    "/${services_path}/distributed/src/soft_bus/distributed_service_uitls.cpp",
453    "/${services_path}/distributed/src/soft_bus/distributed_socket.cpp",
454    "/${services_path}/distributed/src/soft_bus/distributed_subscribe_service.cpp",
455    "/${services_path}/distributed/src/soft_bus/distributed_subscriber.cpp",
456    "/${services_path}/distributed/src/tlv_box/batch_remove_box.cpp",
457    "/${services_path}/distributed/src/tlv_box/box_base.cpp",
458    "/${services_path}/distributed/src/tlv_box/bundle_icon_box.cpp",
459    "/${services_path}/distributed/src/tlv_box/match_box.cpp",
460    "/${services_path}/distributed/src/tlv_box/notification_sync_box.cpp",
461    "/${services_path}/distributed/src/tlv_box/remove_box.cpp",
462    "/${services_path}/distributed/src/tlv_box/request_box.cpp",
463    "/${services_path}/distributed/src/tlv_box/response_box.cpp",
464    "/${services_path}/distributed/src/tlv_box/state_box.cpp",
465    "/${services_path}/distributed/src/tlv_box/tlv_box.cpp",
466    "distributed_service_test.cpp",
467  ]
468
469  configs = [
470    "${services_path}/distributed/:ans_distributed_config",
471    "${frameworks_module_ans_path}:ans_innerkits_public_config",
472  ]
473
474  deps = [
475    "${frameworks_module_ans_path}:ans_innerkits",
476    "${services_path}/distributed:libans_distributed",
477  ]
478
479  external_deps = [
480    "ability_base:base",
481    "ability_base:want",
482    "ability_base:zuri",
483    "ability_runtime:ability_manager",
484    "ability_runtime:runtime",
485    "ability_runtime:uri_permission_mgr",
486    "bundle_framework:appexecfwk_base",
487    "bundle_framework:appexecfwk_core",
488    "c_utils:utils",
489    "device_manager:devicemanagersdk",
490    "dsoftbus:softbus_client",
491    "eventhandler:libeventhandler",
492    "ffrt:libffrt",
493    "googletest:gmock_main",
494    "googletest:gtest_main",
495    "hilog:libhilog",
496    "hitrace:hitrace_meter",
497    "hitrace:libhitracechain",
498    "image_framework:image_native",
499    "ipc:ipc_core",
500    "kv_store:distributeddata_inner",
501    "os_account:os_account_innerkits",
502    "power_manager:powermgr_client",
503    "relational_store:native_rdb",
504    "relational_store:native_rdb",
505    "samgr:samgr_proxy",
506    "screenlock_mgr:screenlock_client",
507    "time_service:time_client",
508    "zlib:libz",
509  ]
510
511  subsystem_name = "${subsystem_name}"
512  part_name = "${component_name}"
513}
514ohos_unittest("distributed_subscriber_test") {
515  module_out_path = module_output_path
516  include_dirs = [
517    "/${services_path}/distributed/include",
518    "/${services_path}/distributed/include/soft_bus",
519    "/${services_path}/distributed/include/tlv_box",
520    "/${services_path}/distributed/include/helper",
521    "/${services_path}/ans/include",
522    "/${interfaces_path}/inner_api",
523  ]
524
525  sources = [
526    "/${frameworks_path}/ans/src/notification_helper.cpp",
527    "/${frameworks_path}/ans/src/notification_subscribe_info.cpp",
528    "/${services_path}/ans/src/common/notification_config_parse.cpp",
529    "/${services_path}/distributed/src/helper/ability_manager_helper.cpp",
530    "/${services_path}/distributed/src/helper/bundle_resource_helper.cpp",
531    "/${services_path}/distributed/src/helper/distributed_operation_connection.cpp",
532    "/${services_path}/distributed/src/helper/distributed_preference.cpp",
533    "/${services_path}/distributed/src/helper/distributed_rdb_helper.cpp",
534    "/${services_path}/distributed/src/soft_bus/distributed_client.cpp",
535    "/${services_path}/distributed/src/soft_bus/distributed_cmd_service.cpp",
536    "/${services_path}/distributed/src/soft_bus/distributed_liveview_all_scenarios_extension_wrapper.cpp",
537    "/${services_path}/distributed/src/soft_bus/distributed_local_config.cpp",
538    "/${services_path}/distributed/src/soft_bus/distributed_observer_service.cpp",
539    "/${services_path}/distributed/src/soft_bus/distributed_operation_service.cpp",
540    "/${services_path}/distributed/src/soft_bus/distributed_publish_service.cpp",
541    "/${services_path}/distributed/src/soft_bus/distributed_server.cpp",
542    "/${services_path}/distributed/src/soft_bus/distributed_service.cpp",
543    "/${services_path}/distributed/src/soft_bus/distributed_service_uitls.cpp",
544    "/${services_path}/distributed/src/soft_bus/distributed_socket.cpp",
545    "/${services_path}/distributed/src/soft_bus/distributed_subscribe_service.cpp",
546    "/${services_path}/distributed/src/soft_bus/distributed_subscriber.cpp",
547    "/${services_path}/distributed/src/tlv_box/batch_remove_box.cpp",
548    "/${services_path}/distributed/src/tlv_box/box_base.cpp",
549    "/${services_path}/distributed/src/tlv_box/bundle_icon_box.cpp",
550    "/${services_path}/distributed/src/tlv_box/match_box.cpp",
551    "/${services_path}/distributed/src/tlv_box/notification_sync_box.cpp",
552    "/${services_path}/distributed/src/tlv_box/remove_box.cpp",
553    "/${services_path}/distributed/src/tlv_box/request_box.cpp",
554    "/${services_path}/distributed/src/tlv_box/response_box.cpp",
555    "/${services_path}/distributed/src/tlv_box/state_box.cpp",
556    "/${services_path}/distributed/src/tlv_box/tlv_box.cpp",
557    "distributed_subscriber_test.cpp",
558  ]
559
560  configs = [
561    "${services_path}/distributed/:ans_distributed_config",
562    "${frameworks_module_ans_path}:ans_innerkits_public_config",
563  ]
564
565  deps = [
566    "${frameworks_module_ans_path}:ans_innerkits",
567    "${services_path}/distributed:libans_distributed",
568  ]
569
570  external_deps = [
571    "ability_base:base",
572    "ability_base:want",
573    "ability_base:zuri",
574    "ability_runtime:ability_manager",
575    "ability_runtime:runtime",
576    "ability_runtime:uri_permission_mgr",
577    "bundle_framework:appexecfwk_base",
578    "bundle_framework:appexecfwk_core",
579    "c_utils:utils",
580    "device_manager:devicemanagersdk",
581    "dsoftbus:softbus_client",
582    "eventhandler:libeventhandler",
583    "ffrt:libffrt",
584    "googletest:gmock_main",
585    "googletest:gtest_main",
586    "hilog:libhilog",
587    "hitrace:hitrace_meter",
588    "hitrace:libhitracechain",
589    "image_framework:image_native",
590    "ipc:ipc_core",
591    "kv_store:distributeddata_inner",
592    "os_account:os_account_innerkits",
593    "power_manager:powermgr_client",
594    "relational_store:native_rdb",
595    "relational_store:native_rdb",
596    "samgr:samgr_proxy",
597    "screenlock_mgr:screenlock_client",
598    "time_service:time_client",
599    "zlib:libz",
600  ]
601
602  subsystem_name = "${subsystem_name}"
603  part_name = "${component_name}"
604}
605