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