1# Copyright (c) 2022-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 = "${component_name}/unittest"
19
20ohos_unittest("reminder_unit_test") {
21  module_out_path = module_output_path
22  include_dirs = [
23    ".",
24    "include",
25    "/${services_path}/ans/include",
26    "${services_path}/ans/test/unittest/mock/include",
27  ]
28
29  defines = []
30
31  sources = [
32    "mock/blob.cpp",
33    "mock/distributed_kv_data_manager.cpp",
34    "mock/mock_access_token_helper.cpp",
35    "mock/mock_bundle_manager_helper.cpp",
36    "mock/mock_event_handler.cpp",
37    "mock/mock_ipc.cpp",
38    "mock/mock_single_kv_store.cpp",
39    "reminder_data_manager_test.cpp",
40  ]
41
42  deps = [
43    "${frameworks_module_ans_path}:ans_innerkits",
44    "${services_path}/ans:libans",
45    "//third_party/googletest:gtest_main",
46  ]
47
48  if (distributed_notification_supported) {
49    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
50    deps += [ "${services_path}/distributed:libans_distributed" ]
51    include_dirs += [ "${services_path}/distributed/include" ]
52  }
53
54  external_deps = [
55    "ability_base:want",
56    "ability_base:zuri",
57    "ability_runtime:ability_manager",
58    "ability_runtime:abilitykit_native",
59    "ability_runtime:app_manager",
60    "ability_runtime:wantagent_innerkits",
61    "access_token:libaccesstoken_sdk",
62    "bundle_framework:appexecfwk_base",
63    "bundle_framework:appexecfwk_core",
64    "c_utils:utils",
65    "common_event_service:cesfwk_innerkits",
66    "data_share:datashare_common",
67    "data_share:datashare_consumer",
68    "device_manager:devicemanagersdk",
69    "eventhandler:libeventhandler",
70    "ffrt:libffrt",
71    "hilog:libhilog",
72    "hitrace:hitrace_meter",
73    "hitrace:libhitracechain",
74    "image_framework:image_native",
75    "ipc:ipc_core",
76    "kv_store:distributeddata_inner",
77    "os_account:os_account_innerkits",
78    "relational_store:native_rdb",
79    "safwk:system_ability_fwk",
80    "samgr:samgr_proxy",
81    "time_service:time_client",
82  ]
83
84  if (device_usage) {
85    external_deps += [ "device_usage_statistics:usagestatsinner" ]
86    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
87  }
88
89  if (player_framework) {
90    external_deps += [ "player_framework:media_client" ]
91    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
92  }
93
94  cflags = []
95  if (hisysevent_usage) {
96    external_deps += [ "hisysevent:libhisysevent" ]
97    cflags += [ "-DHAS_HISYSEVENT_PART" ]
98  }
99
100  subsystem_name = "${subsystem_name}"
101  part_name = "${component_name}"
102}
103
104ohos_unittest("ans_unit_test") {
105  module_out_path = module_output_path
106  include_dirs = [
107    ".",
108    "include",
109    "/${services_path}/ans/include",
110    "${services_path}/ans/test/unittest/mock/include",
111    "${services_path}/../framworks/core/include",
112  ]
113
114  defines = []
115
116  sources = [
117    "${test_path}/mock/mock_tokenid_kit.cpp",
118    "mock/blob.cpp",
119    "mock/distributed_kv_data_manager.cpp",
120    "mock/mock_access_token_helper.cpp",
121    "mock/mock_accesstoken_kit.cpp",
122    "mock/mock_bundle_manager_helper.cpp",
123    "mock/mock_event_handler.cpp",
124    "mock/mock_ipc.cpp",
125    "mock/mock_push_callback_stub.cpp",
126    "mock/mock_single_kv_store.cpp",
127    "mock/mock_swing_callback_stub.cpp",
128    "notification_dialog_test/mock_os_account_manager_annex.cpp",
129    "notification_hisysevent_test.cpp",
130    "notification_local_live_view_subscriber_manager_test.cpp",
131    "notification_slot_filter_test.cpp",
132    "permission_filter_test.cpp",
133    "reminder_swing_decision_center_test.cpp",
134  ]
135
136  deps = [
137    "${frameworks_module_ans_path}:ans_innerkits",
138    "${services_path}/ans:libans",
139    "//third_party/googletest:gmock_main",
140    "//third_party/googletest:gtest_main",
141  ]
142
143  if (distributed_notification_supported) {
144    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
145    deps += [ "${services_path}/distributed:libans_distributed" ]
146    include_dirs += [ "${services_path}/distributed/include" ]
147  }
148
149  external_deps = [
150    "ability_base:want",
151    "ability_base:zuri",
152    "ability_runtime:abilitykit_native",
153    "ability_runtime:app_manager",
154    "ability_runtime:wantagent_innerkits",
155    "access_token:libaccesstoken_sdk",
156    "bundle_framework:appexecfwk_base",
157    "bundle_framework:appexecfwk_core",
158    "c_utils:utils",
159    "common_event_service:cesfwk_innerkits",
160    "device_manager:devicemanagersdk",
161    "eventhandler:libeventhandler",
162    "ffrt:libffrt",
163    "hilog:libhilog",
164    "hitrace:hitrace_meter",
165    "hitrace:libhitracechain",
166    "image_framework:image_native",
167    "ipc:ipc_core",
168    "kv_store:distributeddata_inner",
169    "os_account:os_account_innerkits",
170    "relational_store:native_rdb",
171    "safwk:system_ability_fwk",
172    "samgr:samgr_proxy",
173    "time_service:time_client",
174  ]
175
176  if (device_usage) {
177    external_deps += [ "device_usage_statistics:usagestatsinner" ]
178    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
179  }
180
181  if (player_framework) {
182    external_deps += [ "player_framework:media_client" ]
183    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
184  }
185
186  cflags = []
187  if (hisysevent_usage) {
188    external_deps += [ "hisysevent:libhisysevent" ]
189    cflags += [ "-DHAS_HISYSEVENT_PART" ]
190  }
191
192  subsystem_name = "${subsystem_name}"
193  part_name = "${component_name}"
194}
195
196ohos_unittest("notification_preferences_database_test") {
197  module_out_path = module_output_path
198  include_dirs = [
199    ".",
200    "include",
201    "/${services_path}/ans/include",
202    "${services_path}/ans/test/unittest/mock/include",
203    "${services_path}/../framworks/core/include",
204  ]
205
206  defines = []
207
208  sources = [
209    "${test_path}/mock/mock_tokenid_kit.cpp",
210    "mock/blob.cpp",
211    "mock/distributed_kv_data_manager.cpp",
212    "mock/mock_access_token_helper.cpp",
213    "mock/mock_accesstoken_kit.cpp",
214    "mock/mock_bundle_manager_helper.cpp",
215    "mock/mock_event_handler.cpp",
216    "mock/mock_ipc.cpp",
217    "mock/mock_push_callback_stub.cpp",
218    "mock/mock_single_kv_store.cpp",
219    "mock/mock_swing_callback_stub.cpp",
220    "notification_preferences_database_test.cpp",
221  ]
222
223  deps = [
224    "${frameworks_module_ans_path}:ans_innerkits",
225    "${services_path}/ans:libans",
226    "//third_party/googletest:gmock_main",
227    "//third_party/googletest:gtest_main",
228  ]
229
230  if (distributed_notification_supported) {
231    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
232    deps += [ "${services_path}/distributed:libans_distributed" ]
233    include_dirs += [ "${services_path}/distributed/include" ]
234  }
235
236  external_deps = [
237    "ability_base:want",
238    "ability_base:zuri",
239    "ability_runtime:abilitykit_native",
240    "ability_runtime:app_manager",
241    "ability_runtime:wantagent_innerkits",
242    "access_token:libaccesstoken_sdk",
243    "bundle_framework:appexecfwk_base",
244    "bundle_framework:appexecfwk_core",
245    "c_utils:utils",
246    "common_event_service:cesfwk_innerkits",
247    "device_manager:devicemanagersdk",
248    "eventhandler:libeventhandler",
249    "ffrt:libffrt",
250    "hilog:libhilog",
251    "hitrace:hitrace_meter",
252    "hitrace:libhitracechain",
253    "image_framework:image_native",
254    "ipc:ipc_core",
255    "kv_store:distributeddata_inner",
256    "os_account:os_account_innerkits",
257    "relational_store:native_rdb",
258    "safwk:system_ability_fwk",
259    "samgr:samgr_proxy",
260    "time_service:time_client",
261  ]
262
263  if (device_usage) {
264    external_deps += [ "device_usage_statistics:usagestatsinner" ]
265    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
266  }
267
268  if (player_framework) {
269    external_deps += [ "player_framework:media_client" ]
270    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
271  }
272
273  cflags = []
274  if (hisysevent_usage) {
275    external_deps += [ "hisysevent:libhisysevent" ]
276    cflags += [ "-DHAS_HISYSEVENT_PART" ]
277  }
278
279  subsystem_name = "${subsystem_name}"
280  part_name = "${component_name}"
281}
282
283ohos_unittest("notification_subscriber_manager_test") {
284  module_out_path = module_output_path
285  include_dirs = [
286    ".",
287    "include",
288    "/${services_path}/ans/include",
289    "${services_path}/ans/test/unittest/mock/include",
290    "${services_path}/../framworks/core/include",
291  ]
292
293  defines = []
294
295  sources = [
296    "${test_path}/mock/mock_tokenid_kit.cpp",
297    "bundle_manager_helper_test.cpp",
298    "mock/blob.cpp",
299    "mock/distributed_kv_data_manager.cpp",
300    "mock/mock_access_token_helper.cpp",
301    "mock/mock_accesstoken_kit.cpp",
302    "mock/mock_bundle_manager_helper.cpp",
303    "mock/mock_event_handler.cpp",
304    "mock/mock_ipc.cpp",
305    "mock/mock_push_callback_stub.cpp",
306    "mock/mock_single_kv_store.cpp",
307    "mock/mock_swing_callback_stub.cpp",
308    "notification_subscriber_manager_test.cpp",
309  ]
310
311  deps = [
312    "${frameworks_module_ans_path}:ans_innerkits",
313    "${services_path}/ans:libans",
314    "//third_party/googletest:gmock_main",
315    "//third_party/googletest:gtest_main",
316  ]
317
318  if (distributed_notification_supported) {
319    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
320    deps += [ "${services_path}/distributed:libans_distributed" ]
321    include_dirs += [ "${services_path}/distributed/include" ]
322  }
323
324  external_deps = [
325    "ability_base:want",
326    "ability_base:zuri",
327    "ability_runtime:abilitykit_native",
328    "ability_runtime:app_manager",
329    "ability_runtime:wantagent_innerkits",
330    "access_token:libaccesstoken_sdk",
331    "bundle_framework:appexecfwk_base",
332    "bundle_framework:appexecfwk_core",
333    "c_utils:utils",
334    "common_event_service:cesfwk_innerkits",
335    "device_manager:devicemanagersdk",
336    "eventhandler:libeventhandler",
337    "ffrt:libffrt",
338    "hilog:libhilog",
339    "hitrace:hitrace_meter",
340    "hitrace:libhitracechain",
341    "image_framework:image_native",
342    "ipc:ipc_core",
343    "kv_store:distributeddata_inner",
344    "os_account:os_account_innerkits",
345    "relational_store:native_rdb",
346    "safwk:system_ability_fwk",
347    "samgr:samgr_proxy",
348    "time_service:time_client",
349  ]
350
351  if (device_usage) {
352    external_deps += [ "device_usage_statistics:usagestatsinner" ]
353    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
354  }
355
356  if (player_framework) {
357    external_deps += [ "player_framework:media_client" ]
358    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
359  }
360
361  cflags = []
362  if (hisysevent_usage) {
363    external_deps += [ "hisysevent:libhisysevent" ]
364    cflags += [ "-DHAS_HISYSEVENT_PART" ]
365  }
366
367  subsystem_name = "${subsystem_name}"
368  part_name = "${component_name}"
369}
370
371ohos_unittest("notification_service_test") {
372  sanitize = {
373    integer_overflow = true
374    ubsan = true
375    boundary_sanitize = true
376    cfi = true
377    cfi_cross_dso = true
378    debug = false
379  }
380  module_out_path = module_output_path
381  include_dirs = [
382    ".",
383    "include",
384    "/${services_path}/ans/include",
385    "${services_path}/ans/test/unittest/mock/include",
386  ]
387
388  defines = []
389
390  sources = [
391    "${test_path}/mock/mock_tokenid_kit.cpp",
392    "advanced_notification_live_view_service_test.cpp",
393    "advanced_notification_service_test.cpp",
394    "advanced_notification_slot_service_test.cpp",
395    "advanced_notification_utils_test.cpp",
396    "mock/blob.cpp",
397    "mock/distributed_kv_data_manager.cpp",
398    "mock/mock_access_token_helper.cpp",
399    "mock/mock_accesstoken_kit.cpp",
400    "mock/mock_bundle_manager_helper.cpp",
401    "mock/mock_bundle_mgr.cpp",
402    "mock/mock_event_handler.cpp",
403    "mock/mock_ipc.cpp",
404    "mock/mock_push_callback_stub.cpp",
405    "mock/mock_single_kv_store.cpp",
406    "notification_dialog_test/mock_os_account_manager_annex.cpp",
407  ]
408
409  deps = [
410    "${frameworks_module_ans_path}:ans_innerkits",
411    "${services_path}/ans:libans",
412    "//third_party/googletest:gtest_main",
413  ]
414
415  if (distributed_notification_supported) {
416    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
417    deps += [ "${services_path}/distributed:libans_distributed" ]
418    include_dirs += [ "${services_path}/distributed/include" ]
419  }
420
421  external_deps = [
422    "ability_base:base",
423    "ability_base:want",
424    "ability_base:zuri",
425    "ability_runtime:abilitykit_native",
426    "ability_runtime:app_manager",
427    "ability_runtime:wantagent_innerkits",
428    "access_token:libaccesstoken_sdk",
429    "bundle_framework:appexecfwk_base",
430    "bundle_framework:appexecfwk_core",
431    "c_utils:utils",
432    "common_event_service:cesfwk_innerkits",
433    "device_manager:devicemanagersdk",
434    "eventhandler:libeventhandler",
435    "ffrt:libffrt",
436    "hilog:libhilog",
437    "hitrace:hitrace_meter",
438    "hitrace:libhitracechain",
439    "image_framework:image_native",
440    "ipc:ipc_core",
441    "kv_store:distributeddata_inner",
442    "os_account:os_account_innerkits",
443    "relational_store:native_rdb",
444    "safwk:system_ability_fwk",
445    "samgr:samgr_proxy",
446    "time_service:time_client",
447  ]
448
449  if (device_usage) {
450    external_deps += [ "device_usage_statistics:usagestatsinner" ]
451    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
452  }
453
454  if (player_framework) {
455    external_deps += [ "player_framework:media_client" ]
456    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
457  }
458
459  cflags = []
460  if (hisysevent_usage) {
461    external_deps += [ "hisysevent:libhisysevent" ]
462    cflags += [ "-DHAS_HISYSEVENT_PART" ]
463  }
464
465  subsystem_name = "${subsystem_name}"
466  part_name = "${component_name}"
467}
468
469ohos_unittest("notification_publish_service_test") {
470  sanitize = {
471    integer_overflow = true
472    ubsan = true
473    boundary_sanitize = true
474    cfi = true
475    cfi_cross_dso = true
476    debug = false
477  }
478  module_out_path = module_output_path
479  include_dirs = [
480    ".",
481    "include",
482    "/${services_path}/ans/include",
483    "${services_path}/ans/test/unittest/mock/include",
484  ]
485
486  defines = []
487
488  sources = [
489    "${test_path}/mock/mock_tokenid_kit.cpp",
490    "advanced_notification_publish_service_test.cpp",
491    "mock/blob.cpp",
492    "mock/distributed_kv_data_manager.cpp",
493    "mock/mock_access_token_helper.cpp",
494    "mock/mock_accesstoken_kit.cpp",
495    "mock/mock_bundle_manager_helper.cpp",
496    "mock/mock_bundle_mgr.cpp",
497    "mock/mock_event_handler.cpp",
498    "mock/mock_ipc.cpp",
499    "mock/mock_push_callback_stub.cpp",
500    "mock/mock_single_kv_store.cpp",
501    "notification_dialog_test/mock_os_account_manager_annex.cpp",
502  ]
503
504  deps = [
505    "${frameworks_module_ans_path}:ans_innerkits",
506    "${services_path}/ans:libans",
507    "//third_party/googletest:gtest_main",
508  ]
509
510  if (distributed_notification_supported) {
511    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
512    deps += [ "${services_path}/distributed:libans_distributed" ]
513    include_dirs += [ "${services_path}/distributed/include" ]
514  }
515
516  external_deps = [
517    "ability_base:base",
518    "ability_base:want",
519    "ability_base:zuri",
520    "ability_runtime:ability_manager",
521    "ability_runtime:abilitykit_native",
522    "ability_runtime:app_manager",
523    "ability_runtime:wantagent_innerkits",
524    "access_token:libaccesstoken_sdk",
525    "bundle_framework:appexecfwk_base",
526    "bundle_framework:appexecfwk_core",
527    "c_utils:utils",
528    "common_event_service:cesfwk_innerkits",
529    "device_manager:devicemanagersdk",
530    "eventhandler:libeventhandler",
531    "ffrt:libffrt",
532    "hilog:libhilog",
533    "hitrace:hitrace_meter",
534    "hitrace:libhitracechain",
535    "image_framework:image_native",
536    "ipc:ipc_core",
537    "kv_store:distributeddata_inner",
538    "os_account:os_account_innerkits",
539    "relational_store:native_rdb",
540    "safwk:system_ability_fwk",
541    "samgr:samgr_proxy",
542    "time_service:time_client",
543  ]
544
545  if (device_usage) {
546    external_deps += [ "device_usage_statistics:usagestatsinner" ]
547    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
548  }
549
550  if (player_framework) {
551    external_deps += [ "player_framework:media_client" ]
552    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
553  }
554
555  cflags = []
556  if (hisysevent_usage) {
557    external_deps += [ "hisysevent:libhisysevent" ]
558    cflags += [ "-DHAS_HISYSEVENT_PART" ]
559  }
560
561  subsystem_name = "${subsystem_name}"
562  part_name = "${component_name}"
563}
564
565ohos_unittest("notification_service_publish_test") {
566  sanitize = {
567    integer_overflow = true
568    ubsan = true
569    boundary_sanitize = true
570    cfi = true
571    cfi_cross_dso = true
572    debug = false
573  }
574  module_out_path = module_output_path
575  include_dirs = [
576    ".",
577    "include",
578    "/${services_path}/ans/include",
579    "${services_path}/ans/test/unittest/mock/include",
580  ]
581
582  defines = []
583
584  sources = [
585    "${test_path}/mock/mock_tokenid_kit.cpp",
586    "advanced_notification_service_test/advanced_notification_service_publish_test.cpp",
587    "mock/blob.cpp",
588    "mock/distributed_kv_data_manager.cpp",
589    "mock/mock_access_token_helper.cpp",
590    "mock/mock_accesstoken_kit.cpp",
591    "mock/mock_bundle_manager_helper.cpp",
592    "mock/mock_bundle_mgr.cpp",
593    "mock/mock_event_handler.cpp",
594    "mock/mock_ipc.cpp",
595    "mock/mock_push_callback_stub.cpp",
596    "mock/mock_single_kv_store.cpp",
597    "notification_dialog_test/mock_os_account_manager_annex.cpp",
598  ]
599
600  deps = [
601    "${frameworks_module_ans_path}:ans_innerkits",
602    "${services_path}/ans:libans",
603    "//third_party/googletest:gtest_main",
604  ]
605
606  if (distributed_notification_supported) {
607    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
608    deps += [ "${services_path}/distributed:libans_distributed" ]
609    include_dirs += [ "${services_path}/distributed/include" ]
610  }
611
612  external_deps = [
613    "ability_base:base",
614    "ability_base:want",
615    "ability_base:zuri",
616    "ability_runtime:abilitykit_native",
617    "ability_runtime:app_manager",
618    "ability_runtime:wantagent_innerkits",
619    "access_token:libaccesstoken_sdk",
620    "bundle_framework:appexecfwk_base",
621    "bundle_framework:appexecfwk_core",
622    "c_utils:utils",
623    "common_event_service:cesfwk_innerkits",
624    "device_manager:devicemanagersdk",
625    "eventhandler:libeventhandler",
626    "ffrt:libffrt",
627    "hilog:libhilog",
628    "hitrace:hitrace_meter",
629    "hitrace:libhitracechain",
630    "image_framework:image_native",
631    "ipc:ipc_core",
632    "kv_store:distributeddata_inner",
633    "os_account:os_account_innerkits",
634    "relational_store:native_rdb",
635    "safwk:system_ability_fwk",
636    "samgr:samgr_proxy",
637    "time_service:time_client",
638  ]
639
640  if (device_usage) {
641    external_deps += [ "device_usage_statistics:usagestatsinner" ]
642    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
643  }
644
645  if (player_framework) {
646    external_deps += [ "player_framework:media_client" ]
647    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
648  }
649
650  cflags = []
651  if (hisysevent_usage) {
652    external_deps += [ "hisysevent:libhisysevent" ]
653    cflags += [ "-DHAS_HISYSEVENT_PART" ]
654  }
655
656  subsystem_name = "${subsystem_name}"
657  part_name = "${component_name}"
658}
659
660ohos_unittest("notification_preferences_test") {
661  module_out_path = module_output_path
662  include_dirs = [
663    ".",
664    "include",
665    "/${services_path}/ans/include",
666    "${services_path}/ans/test/unittest/mock/include",
667  ]
668
669  defines = []
670
671  sources = [
672    "${test_path}/mock/mock_tokenid_kit.cpp",
673    "advanced_notification_service_ability_test.cpp",
674    "mock/blob.cpp",
675    "mock/distributed_kv_data_manager.cpp",
676    "mock/mock_access_token_helper.cpp",
677    "mock/mock_accesstoken_kit.cpp",
678    "mock/mock_bundle_manager_helper.cpp",
679    "mock/mock_event_handler.cpp",
680    "mock/mock_ipc.cpp",
681    "mock/mock_push_callback_stub.cpp",
682    "mock/mock_single_kv_store.cpp",
683    "notification_preferences_info_test.cpp",
684    "notification_preferences_test.cpp",
685  ]
686
687  deps = [
688    "${frameworks_module_ans_path}:ans_innerkits",
689    "${services_path}/ans:libans",
690    "//third_party/googletest:gtest_main",
691  ]
692
693  if (distributed_notification_supported) {
694    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
695    deps += [ "${services_path}/distributed:libans_distributed" ]
696    include_dirs += [ "${services_path}/distributed/include" ]
697  }
698
699  external_deps = [
700    "ability_base:want",
701    "ability_base:zuri",
702    "ability_runtime:abilitykit_native",
703    "ability_runtime:app_manager",
704    "ability_runtime:wantagent_innerkits",
705    "access_token:libaccesstoken_sdk",
706    "bundle_framework:appexecfwk_base",
707    "bundle_framework:appexecfwk_core",
708    "c_utils:utils",
709    "common_event_service:cesfwk_innerkits",
710    "data_share:datashare_common",
711    "data_share:datashare_consumer",
712    "device_manager:devicemanagersdk",
713    "eventhandler:libeventhandler",
714    "ffrt:libffrt",
715    "hilog:libhilog",
716    "hitrace:hitrace_meter",
717    "hitrace:libhitracechain",
718    "image_framework:image_native",
719    "ipc:ipc_core",
720    "kv_store:distributeddata_inner",
721    "os_account:os_account_innerkits",
722    "relational_store:native_rdb",
723    "safwk:system_ability_fwk",
724    "samgr:samgr_proxy",
725    "time_service:time_client",
726  ]
727
728  if (device_usage) {
729    external_deps += [ "device_usage_statistics:usagestatsinner" ]
730    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
731  }
732
733  if (player_framework) {
734    external_deps += [ "player_framework:media_client" ]
735    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
736  }
737
738  cflags = []
739  if (hisysevent_usage) {
740    external_deps += [ "hisysevent:libhisysevent" ]
741    cflags += [ "-DHAS_HISYSEVENT_PART" ]
742  }
743
744  subsystem_name = "${subsystem_name}"
745  part_name = "${component_name}"
746}
747
748ohos_unittest("access_token_helper_test") {
749  module_out_path = module_output_path
750  include_dirs = [
751    ".",
752    "include",
753    "/${services_path}/ans/include",
754    "${services_path}/ans/test/unittest/mock/include",
755  ]
756
757  sources = [
758    "${services_path}/ans/src/access_token_helper.cpp",
759    "${services_path}/ans/test/unittest/mock/mock_accesstoken_kit.cpp",
760    "${services_path}/ans/test/unittest/mock/mock_notification_analytics_util.cpp",
761    "${test_path}/mock/mock_tokenid_kit.cpp",
762    "access_token_helper_test/access_token_helper_test.cpp",
763  ]
764
765  deps = [ "${frameworks_module_ans_path}:ans_innerkits" ]
766
767  external_deps = [
768    "ability_base:want",
769    "ability_base:zuri",
770    "ability_runtime:abilitykit_native",
771    "ability_runtime:app_manager",
772    "ability_runtime:wantagent_innerkits",
773    "access_token:libaccesstoken_sdk",
774    "access_token:libtokenid_sdk",
775    "bundle_framework:appexecfwk_base",
776    "bundle_framework:appexecfwk_core",
777    "c_utils:utils",
778    "common_event_service:cesfwk_innerkits",
779    "eventhandler:libeventhandler",
780    "hilog:libhilog",
781    "hitrace:hitrace_meter",
782    "hitrace:libhitracechain",
783    "image_framework:image_native",
784    "init:libbegetutil",
785    "ipc:ipc_core",
786    "kv_store:distributeddata_inner",
787    "os_account:os_account_innerkits",
788    "relational_store:native_rdb",
789    "safwk:system_ability_fwk",
790    "samgr:samgr_proxy",
791    "time_service:time_client",
792  ]
793
794  if (player_framework) {
795    external_deps += [ "player_framework:media_client" ]
796    defines = [ "PLAYER_FRAMEWORK_ENABLE" ]
797  }
798  subsystem_name = "${subsystem_name}"
799  part_name = "${component_name}"
800}
801
802ohos_unittest("bundle_manager_helper_branch_test") {
803  module_out_path = module_output_path
804  include_dirs = [
805    ".",
806    "include",
807    "/${services_path}/ans/include",
808    "${services_path}/ans/test/unittest/mock/include",
809  ]
810
811  sources = [
812    "bundle_manager_helper_branch_test/bundle_manager_helper_branch_test.cpp",
813    "bundle_manager_helper_branch_test/mock_service_registry.cpp",
814  ]
815
816  deps = [
817    "${frameworks_module_ans_path}:ans_innerkits",
818    "${services_path}/ans:libans",
819    "//third_party/googletest:gtest_main",
820  ]
821
822  external_deps = [
823    "ability_base:want",
824    "ability_base:zuri",
825    "ability_runtime:abilitykit_native",
826    "ability_runtime:app_manager",
827    "ability_runtime:wantagent_innerkits",
828    "access_token:libaccesstoken_sdk",
829    "bundle_framework:appexecfwk_base",
830    "bundle_framework:appexecfwk_core",
831    "c_utils:utils",
832    "common_event_service:cesfwk_innerkits",
833    "eventhandler:libeventhandler",
834    "hilog:libhilog",
835    "hitrace:hitrace_meter",
836    "hitrace:libhitracechain",
837    "image_framework:image_native",
838    "ipc:ipc_core",
839    "kv_store:distributeddata_inner",
840    "os_account:os_account_innerkits",
841    "relational_store:native_rdb",
842    "safwk:system_ability_fwk",
843    "samgr:samgr_proxy",
844    "time_service:time_client",
845  ]
846
847  if (player_framework) {
848    external_deps += [ "player_framework:media_client" ]
849    defines = [ "PLAYER_FRAMEWORK_ENABLE" ]
850  }
851  subsystem_name = "${subsystem_name}"
852  part_name = "${component_name}"
853}
854
855ohos_unittest("notification_dialog_test") {
856  module_out_path = module_output_path
857  include_dirs = [
858    ".",
859    "include",
860    "/${services_path}/ans/include",
861    "${services_path}/ans/test/unittest/mock/include",
862  ]
863
864  sources = [
865    "notification_dialog_test/mock_os_account_manager_annex.cpp",
866    "notification_dialog_test/notification_dialog_test.cpp",
867  ]
868
869  deps = [
870    "${frameworks_module_ans_path}:ans_innerkits",
871    "${services_path}/ans:libans",
872    "//third_party/googletest:gtest_main",
873  ]
874
875  external_deps = [
876    "ability_base:want",
877    "ability_base:zuri",
878    "ability_runtime:abilitykit_native",
879    "ability_runtime:app_manager",
880    "ability_runtime:wantagent_innerkits",
881    "access_token:libaccesstoken_sdk",
882    "bundle_framework:appexecfwk_base",
883    "bundle_framework:appexecfwk_core",
884    "c_utils:utils",
885    "common_event_service:cesfwk_innerkits",
886    "eventhandler:libeventhandler",
887    "ffrt:libffrt",
888    "hilog:libhilog",
889    "hitrace:hitrace_meter",
890    "hitrace:libhitracechain",
891    "image_framework:image_native",
892    "ipc:ipc_core",
893    "kv_store:distributeddata_inner",
894    "os_account:os_account_innerkits",
895    "relational_store:native_rdb",
896    "safwk:system_ability_fwk",
897    "samgr:samgr_proxy",
898    "time_service:time_client",
899  ]
900
901  if (player_framework) {
902    external_deps += [ "player_framework:media_client" ]
903    defines = [ "PLAYER_FRAMEWORK_ENABLE" ]
904  }
905  subsystem_name = "${subsystem_name}"
906  part_name = "${component_name}"
907}
908
909ohos_unittest("notification_subscriber_manager_branch_test") {
910  module_out_path = module_output_path
911  include_dirs = [
912    ".",
913    "include",
914    "/${services_path}/ans/include",
915    "${services_path}/ans/test/unittest/mock/include",
916    "${ffrt_path}/interfaces/kits",
917  ]
918
919  defines = []
920
921  sources = [
922    "${test_path}/mock/mock_tokenid_kit.cpp",
923    "mock/mock_accesstoken_kit.cpp",
924    "mock/mock_bundle_manager_helper.cpp",
925    "mock/mock_ipc.cpp",
926    "notification_dialog_test/mock_os_account_manager_annex.cpp",
927    "notification_subscriber_manager_branch_test/mock_access_token_helper.cpp",
928    "notification_subscriber_manager_branch_test/mock_notification.cpp",
929    "notification_subscriber_manager_branch_test/mock_notification_preferences.cpp",
930    "notification_subscriber_manager_branch_test/notification_subscriber_manager_branch_test.cpp",
931  ]
932
933  deps = [
934    "${frameworks_module_ans_path}:ans_innerkits",
935    "${services_path}/ans:libans",
936    "//third_party/googletest:gtest_main",
937  ]
938
939  if (distributed_notification_supported) {
940    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
941    deps += [ "${services_path}/distributed:libans_distributed" ]
942    include_dirs += [ "${services_path}/distributed/include" ]
943  }
944
945  external_deps = [
946    "ability_base:want",
947    "ability_base:zuri",
948    "ability_runtime:abilitykit_native",
949    "ability_runtime:app_manager",
950    "ability_runtime:wantagent_innerkits",
951    "access_token:libaccesstoken_sdk",
952    "bundle_framework:appexecfwk_base",
953    "bundle_framework:appexecfwk_core",
954    "c_utils:utils",
955    "common_event_service:cesfwk_innerkits",
956    "eventhandler:libeventhandler",
957    "ffrt:libffrt",
958    "hilog:libhilog",
959    "hitrace:hitrace_meter",
960    "hitrace:libhitracechain",
961    "image_framework:image_native",
962    "ipc:ipc_core",
963    "kv_store:distributeddata_inner",
964    "os_account:os_account_innerkits",
965    "relational_store:native_rdb",
966    "safwk:system_ability_fwk",
967    "samgr:samgr_proxy",
968    "time_service:time_client",
969  ]
970
971  if (player_framework) {
972    external_deps += [ "player_framework:media_client" ]
973    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
974  }
975  subsystem_name = "${subsystem_name}"
976  part_name = "${component_name}"
977}
978
979ohos_unittest("advanced_notification_service_branch_test") {
980  module_out_path = module_output_path
981  include_dirs = [
982    ".",
983    "include",
984    "/${services_path}/ans/include",
985    "${services_path}/ans/test/unittest/mock/include",
986    "${ffrt_path}/interfaces/kits",
987  ]
988
989  defines = []
990
991  sources = [
992    "${test_path}/mock/mock_tokenid_kit.cpp",
993    "advanced_notification_service_branch_test.cpp",
994    "mock/blob.cpp",
995    "mock/distributed_kv_data_manager.cpp",
996    "mock/mock_accesstoken_kit.cpp",
997    "mock/mock_advanced_notification_service.cpp",
998    "mock/mock_bundle_manager_helper.cpp",
999    "mock/mock_bundle_mgr.cpp",
1000    "mock/mock_event_handler.cpp",
1001    "mock/mock_ipc.cpp",
1002    "mock/mock_single_kv_store.cpp",
1003    "notification_dialog_test/mock_os_account_manager_annex.cpp",
1004    "notification_subscriber_manager_branch_test/mock_access_token_helper.cpp",
1005  ]
1006
1007  deps = [
1008    "${frameworks_module_ans_path}:ans_innerkits",
1009    "${services_path}/ans:libans",
1010    "//third_party/googletest:gtest_main",
1011  ]
1012
1013  if (distributed_notification_supported) {
1014    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
1015    deps += [ "${services_path}/distributed:libans_distributed" ]
1016    include_dirs += [ "${services_path}/distributed/include" ]
1017  }
1018
1019  external_deps = [
1020    "ability_base:want",
1021    "ability_base:zuri",
1022    "ability_runtime:abilitykit_native",
1023    "ability_runtime:app_manager",
1024    "ability_runtime:wantagent_innerkits",
1025    "access_token:libaccesstoken_sdk",
1026    "bundle_framework:appexecfwk_base",
1027    "bundle_framework:appexecfwk_core",
1028    "c_utils:utils",
1029    "common_event_service:cesfwk_innerkits",
1030    "eventhandler:libeventhandler",
1031    "ffrt:libffrt",
1032    "hilog:libhilog",
1033    "hitrace:hitrace_meter",
1034    "hitrace:libhitracechain",
1035    "image_framework:image_native",
1036    "ipc:ipc_core",
1037    "kv_store:distributeddata_inner",
1038    "os_account:os_account_innerkits",
1039    "relational_store:native_rdb",
1040    "safwk:system_ability_fwk",
1041    "samgr:samgr_proxy",
1042    "time_service:time_client",
1043  ]
1044
1045  if (player_framework) {
1046    external_deps += [ "player_framework:media_client" ]
1047    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
1048  }
1049  subsystem_name = "${subsystem_name}"
1050  part_name = "${component_name}"
1051}
1052
1053ohos_unittest("notification_preferences_database_branch_test") {
1054  module_out_path = module_output_path
1055  include_dirs = [
1056    ".",
1057    "include",
1058    "/${services_path}/ans/include",
1059    "${services_path}/ans/test/unittest/mock/include",
1060    "${ffrt_path}/interfaces/kits",
1061  ]
1062
1063  sources = [
1064    "${services_path}/ans/src/bundle_manager_helper.cpp",
1065    "${services_path}/ans/src/common/notification_config_parse.cpp",
1066    "${services_path}/ans/src/notification_preferences_database.cpp",
1067    "${services_path}/ans/src/notification_preferences_info.cpp",
1068    "${services_path}/ans/src/os_account_manager_helper.cpp",
1069    "${services_path}/ans/test/unittest/mock/mock_notification_analytics_util.cpp",
1070    "notification_dialog_test/mock_os_account_manager_annex.cpp",
1071    "notification_preferences_database_branch_test/mock_notification_rdb_data_mgr.cpp",
1072    "notification_preferences_database_branch_test/notification_preferences_database_branch_test.cpp",
1073  ]
1074
1075  deps = [
1076    "${frameworks_module_ans_path}:ans_innerkits",
1077    "//third_party/googletest:gtest_main",
1078    "//third_party/libxml2:libxml2",
1079  ]
1080
1081  external_deps = [
1082    "ability_base:want",
1083    "ability_base:zuri",
1084    "ability_runtime:abilitykit_native",
1085    "ability_runtime:app_manager",
1086    "ability_runtime:wantagent_innerkits",
1087    "access_token:libaccesstoken_sdk",
1088    "bundle_framework:appexecfwk_base",
1089    "bundle_framework:appexecfwk_core",
1090    "c_utils:utils",
1091    "common_event_service:cesfwk_innerkits",
1092    "eventhandler:libeventhandler",
1093    "hilog:libhilog",
1094    "hitrace:hitrace_meter",
1095    "hitrace:libhitracechain",
1096    "image_framework:image_native",
1097    "ipc:ipc_core",
1098    "kv_store:distributeddata_inner",
1099    "os_account:os_account_innerkits",
1100    "relational_store:native_rdb",
1101    "safwk:system_ability_fwk",
1102    "samgr:samgr_proxy",
1103    "time_service:time_client",
1104  ]
1105
1106  if (player_framework) {
1107    external_deps += [ "player_framework:media_client" ]
1108    defines = [ "PLAYER_FRAMEWORK_ENABLE" ]
1109  }
1110  subsystem_name = "${subsystem_name}"
1111  part_name = "${component_name}"
1112}
1113
1114ohos_unittest("push_callback_stub_test") {
1115  module_out_path = module_output_path
1116  include_dirs = [
1117    ".",
1118    "include",
1119    "/${services_path}/ans/include",
1120  ]
1121
1122  sources = [ "push_callback_stub_test.cpp" ]
1123
1124  deps = [
1125    "${frameworks_module_ans_path}:ans_innerkits",
1126    "${services_path}/ans:libans",
1127    "//third_party/googletest:gtest_main",
1128  ]
1129
1130  external_deps = [
1131    "ability_base:want",
1132    "ability_base:zuri",
1133    "ability_runtime:abilitykit_native",
1134    "ability_runtime:app_manager",
1135    "ability_runtime:wantagent_innerkits",
1136    "access_token:libaccesstoken_sdk",
1137    "bundle_framework:appexecfwk_base",
1138    "bundle_framework:appexecfwk_core",
1139    "c_utils:utils",
1140    "common_event_service:cesfwk_innerkits",
1141    "eventhandler:libeventhandler",
1142    "hilog:libhilog",
1143    "hitrace:hitrace_meter",
1144    "hitrace:libhitracechain",
1145    "image_framework:image_native",
1146    "ipc:ipc_core",
1147    "kv_store:distributeddata_inner",
1148    "os_account:os_account_innerkits",
1149    "relational_store:native_rdb",
1150    "safwk:system_ability_fwk",
1151    "samgr:samgr_proxy",
1152    "time_service:time_client",
1153  ]
1154
1155  if (player_framework) {
1156    external_deps += [ "player_framework:media_client" ]
1157    defines = [ "PLAYER_FRAMEWORK_ENABLE" ]
1158  }
1159  subsystem_name = "${subsystem_name}"
1160  part_name = "${component_name}"
1161}
1162
1163ohos_unittest("notification_rdb_data_mgr_test") {
1164  module_out_path = module_output_path
1165  include_dirs = [
1166    ".",
1167    "include",
1168    "/${services_path}/ans/include",
1169    "${services_path}/ans/test/unittest/mock/include",
1170  ]
1171
1172  sources = [
1173    "notification_rdb_data_mgr_test/mock_abs_result_set.cpp",
1174    "notification_rdb_data_mgr_test/mock_abs_shared_result_set.cpp",
1175    "notification_rdb_data_mgr_test/mock_rdb_helper.cpp",
1176    "notification_rdb_data_mgr_test/notification_rdb_data_mgr_test.cpp",
1177  ]
1178
1179  deps = [
1180    "${frameworks_module_ans_path}:ans_innerkits",
1181    "${services_path}/ans:libans",
1182    "//third_party/googletest:gtest_main",
1183  ]
1184
1185  external_deps = [
1186    "ability_base:want",
1187    "ability_base:zuri",
1188    "ability_runtime:abilitykit_native",
1189    "ability_runtime:app_manager",
1190    "ability_runtime:wantagent_innerkits",
1191    "access_token:libaccesstoken_sdk",
1192    "bundle_framework:appexecfwk_base",
1193    "bundle_framework:appexecfwk_core",
1194    "c_utils:utils",
1195    "common_event_service:cesfwk_innerkits",
1196    "eventhandler:libeventhandler",
1197    "hilog:libhilog",
1198    "hitrace:hitrace_meter",
1199    "hitrace:libhitracechain",
1200    "image_framework:image_native",
1201    "ipc:ipc_core",
1202    "kv_store:distributeddata_inner",
1203    "os_account:os_account_innerkits",
1204    "relational_store:native_rdb",
1205    "safwk:system_ability_fwk",
1206    "samgr:samgr_proxy",
1207    "time_service:time_client",
1208  ]
1209
1210  if (player_framework) {
1211    external_deps += [ "player_framework:media_client" ]
1212    defines = [ "PLAYER_FRAMEWORK_ENABLE" ]
1213  }
1214  subsystem_name = "${subsystem_name}"
1215  part_name = "${component_name}"
1216}
1217
1218ohos_unittest("notification_config_parse_test") {
1219  module_out_path = module_output_path
1220  include_dirs = [
1221    ".",
1222    "include",
1223    "/${services_path}/ans/include",
1224    "${services_path}/ans/test/unittest/mock/include",
1225  ]
1226
1227  sources = [ "notification_config_parse_test.cpp" ]
1228
1229  deps = [
1230    "${frameworks_module_ans_path}:ans_innerkits",
1231    "${services_path}/ans:libans",
1232    "//third_party/googletest:gtest_main",
1233    "//third_party/libxml2:libxml2",
1234  ]
1235
1236  external_deps = [
1237    "ability_base:want",
1238    "ability_base:zuri",
1239    "ability_runtime:abilitykit_native",
1240    "ability_runtime:app_manager",
1241    "ability_runtime:wantagent_innerkits",
1242    "access_token:libaccesstoken_sdk",
1243    "bundle_framework:appexecfwk_base",
1244    "bundle_framework:appexecfwk_core",
1245    "c_utils:utils",
1246    "common_event_service:cesfwk_innerkits",
1247    "eventhandler:libeventhandler",
1248    "hilog:libhilog",
1249    "hitrace:hitrace_meter",
1250    "hitrace:libhitracechain",
1251    "image_framework:image_native",
1252    "ipc:ipc_core",
1253    "kv_store:distributeddata_inner",
1254    "os_account:os_account_innerkits",
1255    "relational_store:native_rdb",
1256    "safwk:system_ability_fwk",
1257    "samgr:samgr_proxy",
1258    "time_service:time_client",
1259  ]
1260
1261  if (player_framework) {
1262    external_deps += [ "player_framework:media_client" ]
1263    defines = [ "PLAYER_FRAMEWORK_ENABLE" ]
1264  }
1265}
1266
1267ohos_unittest("os_account_manager_helper_test") {
1268  module_out_path = module_output_path
1269  include_dirs = [
1270    ".",
1271    "include",
1272    "/${services_path}/ans/include",
1273    "${services_path}/ans/test/unittest/mock/include",
1274  ]
1275
1276  sources = [ "os_account_manager_helper_test.cpp" ]
1277
1278  deps = [
1279    "${frameworks_module_ans_path}:ans_innerkits",
1280    "${services_path}/ans:libans",
1281    "//third_party/googletest:gtest_main",
1282  ]
1283
1284  external_deps = [
1285    "ability_base:want",
1286    "ability_base:zuri",
1287    "ability_runtime:abilitykit_native",
1288    "ability_runtime:app_manager",
1289    "ability_runtime:wantagent_innerkits",
1290    "access_token:libaccesstoken_sdk",
1291    "bundle_framework:appexecfwk_base",
1292    "bundle_framework:appexecfwk_core",
1293    "c_utils:utils",
1294    "common_event_service:cesfwk_innerkits",
1295    "eventhandler:libeventhandler",
1296    "hilog:libhilog",
1297    "hitrace:hitrace_meter",
1298    "hitrace:libhitracechain",
1299    "image_framework:image_native",
1300    "ipc:ipc_core",
1301    "kv_store:distributeddata_inner",
1302    "os_account:os_account_innerkits",
1303    "relational_store:native_rdb",
1304    "safwk:system_ability_fwk",
1305    "samgr:samgr_proxy",
1306    "time_service:time_client",
1307  ]
1308
1309  if (player_framework) {
1310    external_deps += [ "player_framework:media_client" ]
1311    defines = [ "PLAYER_FRAMEWORK_ENABLE" ]
1312  }
1313  subsystem_name = "${subsystem_name}"
1314  part_name = "${component_name}"
1315}
1316
1317group("unittest") {
1318  testonly = true
1319  deps = [
1320    ":access_token_helper_test",
1321    ":advanced_notification_service_branch_test",
1322    ":ans_unit_test",
1323    ":bundle_manager_helper_branch_test",
1324    ":notification_config_parse_test",
1325    ":notification_dialog_test",
1326    ":notification_preferences_database_branch_test",
1327    ":notification_preferences_database_test",
1328    ":notification_preferences_test",
1329    ":notification_publish_service_test",
1330    ":notification_rdb_data_mgr_test",
1331    ":notification_service_publish_test",
1332    ":notification_service_test",
1333    ":notification_subscriber_manager_branch_test",
1334    ":notification_subscriber_manager_test",
1335    ":os_account_manager_helper_test",
1336    ":push_callback_stub_test",
1337    ":reminder_unit_test",
1338  ]
1339}
1340