• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//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
21ohos_unittest("reminder_unit_test") {
22  module_out_path = module_output_path
23  include_dirs = [
24    ".",
25    "include",
26    "/${services_path}/ans/include",
27    "/${services_path}/reminder/include",
28    "${services_path}/reminder/test/unittest/mock/include",
29  ]
30
31  defines = []
32
33  sources = [
34    "mock/mock_ipc.cpp",
35    "reminder_data_manager_test.cpp",
36  ]
37
38  deps = [
39    "${frameworks_module_ans_path}:ans_innerkits",
40    "${frameworks_module_reminder_path}:reminder_innerkits",
41    "${services_path}/reminder:libreminder_static",
42  ]
43
44  if (distributed_notification_supported) {
45    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
46    deps += [ "${services_path}/distributed:libans_distributed" ]
47    include_dirs += [ "${services_path}/distributed/include" ]
48  }
49
50  external_deps = [
51    "ability_base:want",
52    "ability_base:zuri",
53    "ability_runtime:ability_manager",
54    "ability_runtime:abilitykit_native",
55    "ability_runtime:app_manager",
56    "ability_runtime:wantagent_innerkits",
57    "access_token:libaccesstoken_sdk",
58    "bundle_framework:appexecfwk_base",
59    "bundle_framework:appexecfwk_core",
60    "c_utils:utils",
61    "common_event_service:cesfwk_innerkits",
62    "data_share:datashare_common",
63    "data_share:datashare_consumer",
64    "device_manager:devicemanagersdk",
65    "eventhandler:libeventhandler",
66    "ffrt:libffrt",
67    "hilog:libhilog",
68    "hitrace:hitrace_meter",
69    "hitrace:libhitracechain",
70    "image_framework:image_native",
71    "ipc:ipc_core",
72    "kv_store:distributeddata_inner",
73    "os_account:os_account_innerkits",
74    "relational_store:native_rdb",
75    "safwk:system_ability_fwk",
76    "samgr:samgr_proxy",
77    "time_service:time_client",
78  ]
79
80  if (device_usage) {
81    external_deps += [ "device_usage_statistics:usagestatsinner" ]
82    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
83  }
84
85  if (player_framework) {
86    external_deps += [ "player_framework:media_client" ]
87    external_deps += [ "audio_framework:audio_client" ]
88    external_deps += [ "player_framework:system_sound_client" ]
89    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
90  }
91
92  cflags = [
93    "-Dprivate=public",
94    "-Dprotected=public",
95  ]
96  if (hisysevent_usage) {
97    external_deps += [ "hisysevent:libhisysevent" ]
98    cflags += [ "-DHAS_HISYSEVENT_PART" ]
99  }
100
101  sanitize = {
102    integer_overflow = true
103    ubsan = true
104    boundary_sanitize = true
105    cfi = true
106    cfi_cross_dso = true
107    debug = false
108  }
109
110  subsystem_name = "${subsystem_name}"
111  part_name = "${component_name}"
112}
113
114ohos_unittest("reminder_agent_service_test") {
115  sanitize = {
116    integer_overflow = true
117    ubsan = true
118    boundary_sanitize = true
119    cfi = true
120    cfi_cross_dso = true
121    debug = false
122  }
123  module_out_path = module_output_path
124  include_dirs = [
125    ".",
126    "include",
127    "/${services_path}/reminder/include",
128    "${services_path}/reminder/test/unittest/mock/include",
129  ]
130
131  defines = []
132
133  sources = [
134    "${services_path}/reminder/src/reminder_agent_service.cpp",
135    "mock/mock_accesstoken_kit.cpp",
136    "mock/mock_notification_helper.cpp",
137    "mock/mock_os_account_manager.cpp",
138    "mock/mock_reminder_bundle_manager_helper.cpp",
139    "mock/mock_reminder_data_manager.cpp",
140    "reminder_agent_service_test.cpp",
141  ]
142
143  deps = [
144    "${frameworks_module_ans_path}:ans_innerkits",
145    "${frameworks_module_reminder_path}:reminder_innerkits",
146  ]
147
148  external_deps = [
149    "ability_base:zuri",
150    "ability_runtime:abilitykit_native",
151    "access_token:libaccesstoken_sdk",
152    "c_utils:utils",
153    "data_share:datashare_common",
154    "ffrt:libffrt",
155    "hilog:libhilog",
156    "hitrace:hitrace_meter",
157    "ipc:ipc_core",
158    "os_account:os_account_innerkits",
159    "relational_store:native_rdb",
160    "samgr:samgr_proxy",
161    "time_service:time_client",
162  ]
163
164  cflags = [
165    "-Dprivate=public",
166    "-Dprotected=public",
167  ]
168
169  subsystem_name = "${subsystem_name}"
170  part_name = "${component_name}"
171}
172
173ohos_unittest("reminder_bundle_manager_helper_test") {
174  sanitize = {
175    integer_overflow = true
176    ubsan = true
177    boundary_sanitize = true
178    cfi = true
179    cfi_cross_dso = true
180    debug = false
181  }
182
183  module_out_path = module_output_path
184  include_dirs = [
185    ".",
186    "include",
187    "/${services_path}/reminder/include",
188    "${services_path}/reminder/test/unittest/mock/include",
189  ]
190
191  sources = [
192    "mock/mock_service_registry.cpp",
193    "reminder_bundle_manager_helper_test.cpp",
194  ]
195
196  deps = [
197    "${frameworks_module_reminder_path}:reminder_innerkits",
198    "${services_path}/reminder:libreminder_static",
199  ]
200
201  external_deps = [
202    "ability_base:want",
203    "ability_base:zuri",
204    "ability_runtime:abilitykit_native",
205    "ability_runtime:app_manager",
206    "ability_runtime:wantagent_innerkits",
207    "access_token:libaccesstoken_sdk",
208    "bundle_framework:appexecfwk_base",
209    "bundle_framework:appexecfwk_core",
210    "c_utils:utils",
211    "common_event_service:cesfwk_innerkits",
212    "eventhandler:libeventhandler",
213    "hilog:libhilog",
214    "hitrace:hitrace_meter",
215    "hitrace:libhitracechain",
216    "image_framework:image_native",
217    "ipc:ipc_core",
218    "kv_store:distributeddata_inner",
219    "os_account:os_account_innerkits",
220    "relational_store:native_rdb",
221    "safwk:system_ability_fwk",
222    "samgr:samgr_proxy",
223    "time_service:time_client",
224  ]
225
226  cflags = [
227    "-Dprivate=public",
228    "-Dprotected=public",
229  ]
230  subsystem_name = "${subsystem_name}"
231  part_name = "${component_name}"
232}
233
234ohos_unittest("reminder_service_test") {
235  sanitize = {
236    integer_overflow = true
237    ubsan = true
238    boundary_sanitize = true
239    cfi = true
240    cfi_cross_dso = true
241    debug = false
242  }
243  module_out_path = module_output_path
244  include_dirs = [
245    ".",
246    "include",
247    "/${services_path}/reminder/include",
248    "${services_path}/reminder/test/unittest/mock/include",
249  ]
250
251  defines = []
252
253  sources = [ "reminder_store_test.cpp" ]
254
255  deps = [
256    "${frameworks_module_reminder_path}:reminder_innerkits",
257    "${services_path}/reminder:libreminder_static",
258  ]
259
260  if (distributed_notification_supported) {
261    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
262    deps += [ "${services_path}/distributed:libans_distributed" ]
263    include_dirs += [ "${services_path}/distributed/include" ]
264  }
265
266  external_deps = [
267    "ability_base:base",
268    "ability_base:want",
269    "ability_base:zuri",
270    "ability_runtime:abilitykit_native",
271    "ability_runtime:app_manager",
272    "ability_runtime:wantagent_innerkits",
273    "access_token:libaccesstoken_sdk",
274    "bundle_framework:appexecfwk_base",
275    "bundle_framework:appexecfwk_core",
276    "c_utils:utils",
277    "common_event_service:cesfwk_innerkits",
278    "device_manager:devicemanagersdk",
279    "eventhandler:libeventhandler",
280    "ffrt:libffrt",
281    "hilog:libhilog",
282    "hitrace:hitrace_meter",
283    "hitrace:libhitracechain",
284    "image_framework:image_native",
285    "ipc:ipc_core",
286    "kv_store:distributeddata_inner",
287    "os_account:os_account_innerkits",
288    "relational_store:native_rdb",
289    "safwk:system_ability_fwk",
290    "samgr:samgr_proxy",
291    "time_service:time_client",
292  ]
293
294  if (device_usage) {
295    external_deps += [ "device_usage_statistics:usagestatsinner" ]
296    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
297  }
298
299  if (player_framework) {
300    external_deps += [ "player_framework:media_client" ]
301    external_deps += [ "audio_framework:audio_client" ]
302    external_deps += [ "player_framework:system_sound_client" ]
303    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
304  }
305
306  cflags = [
307    "-Dprivate=public",
308    "-Dprotected=public",
309  ]
310  if (hisysevent_usage) {
311    external_deps += [ "hisysevent:libhisysevent" ]
312    cflags += [ "-DHAS_HISYSEVENT_PART" ]
313  }
314
315  subsystem_name = "${subsystem_name}"
316  part_name = "${component_name}"
317}
318
319ohos_unittest("reminder_agent_service_ability_test") {
320  sanitize = {
321    integer_overflow = true
322    ubsan = true
323    boundary_sanitize = true
324    cfi = true
325    cfi_cross_dso = true
326    debug = false
327  }
328  module_out_path = module_output_path
329  include_dirs = [
330    ".",
331    "include",
332    "/${services_path}/reminder/include",
333    "${services_path}/reminder/test/unittest/mock/include",
334  ]
335
336  defines = []
337
338  sources = [ "reminder_agent_service_ability_test.cpp" ]
339
340  deps = [
341    "${frameworks_module_reminder_path}:reminder_innerkits",
342    "${services_path}/reminder:libreminder_static",
343  ]
344
345  if (distributed_notification_supported) {
346    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
347    deps += [ "${services_path}/distributed:libans_distributed" ]
348    include_dirs += [ "${services_path}/distributed/include" ]
349  }
350
351  external_deps = [
352    "ability_base:base",
353    "ability_base:want",
354    "ability_base:zuri",
355    "ability_runtime:abilitykit_native",
356    "ability_runtime:app_manager",
357    "ability_runtime:wantagent_innerkits",
358    "access_token:libaccesstoken_sdk",
359    "bundle_framework:appexecfwk_base",
360    "bundle_framework:appexecfwk_core",
361    "c_utils:utils",
362    "common_event_service:cesfwk_innerkits",
363    "data_share:datashare_common",
364    "data_share:datashare_consumer",
365    "device_manager:devicemanagersdk",
366    "eventhandler:libeventhandler",
367    "ffrt:libffrt",
368    "hilog:libhilog",
369    "hitrace:hitrace_meter",
370    "hitrace:libhitracechain",
371    "image_framework:image_native",
372    "ipc:ipc_core",
373    "kv_store:distributeddata_inner",
374    "os_account:os_account_innerkits",
375    "relational_store:native_rdb",
376    "safwk:system_ability_fwk",
377    "samgr:samgr_proxy",
378    "time_service:time_client",
379  ]
380
381  if (device_usage) {
382    external_deps += [ "device_usage_statistics:usagestatsinner" ]
383    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
384  }
385
386  if (player_framework) {
387    external_deps += [ "player_framework:media_client" ]
388    external_deps += [ "audio_framework:audio_client" ]
389    external_deps += [ "player_framework:system_sound_client" ]
390    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
391  }
392
393  cflags = [
394    "-Dprivate=public",
395    "-Dprotected=public",
396  ]
397  if (hisysevent_usage) {
398    external_deps += [ "hisysevent:libhisysevent" ]
399    cflags += [ "-DHAS_HISYSEVENT_PART" ]
400  }
401
402  subsystem_name = "${subsystem_name}"
403  part_name = "${component_name}"
404}
405
406group("unittest") {
407  testonly = true
408  deps = [
409    ":reminder_agent_service_ability_test",
410    ":reminder_agent_service_test",
411    ":reminder_bundle_manager_helper_test",
412    ":reminder_service_test",
413    ":reminder_unit_test",
414  ]
415}
416