1# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//base/notification/distributed_notification_service/notification.gni")
15import("//build/ohos.gni")
16import("//build/test.gni")
17
18group("ans_unit_test") {
19  testonly = true
20  deps = []
21
22  if (distributed_notification_supported) {
23    deps += [
24      ":ans_distributed_unit_test",
25      ":distributed_database_branch_test",
26      ":distributed_database_callback_test",
27      ":distributed_device_callback_test",
28      ":distributed_flow_control_test",
29      ":distributed_preferences_branch_test",
30      ":distributed_preferences_database_test",
31      ":distributed_screen_status_manager_branch_test",
32    ]
33  }
34}
35
36ohos_unittest("ans_distributed_unit_test") {
37  module_out_path = "${component_name}/unittest"
38  include_dirs = [
39    "/${services_path}/distributed/include",
40    "${ffrt_path}/interfaces/kits",
41  ]
42
43  sources = [
44    "${services_path}/distributed/src/distributed_database.cpp",
45    "${services_path}/distributed/src/distributed_database_callback.cpp",
46    "${services_path}/distributed/src/distributed_device_callback.cpp",
47    "${services_path}/distributed/src/distributed_flow_control.cpp",
48    "${services_path}/distributed/src/distributed_notification_manager.cpp",
49    "${services_path}/distributed/src/distributed_preferences.cpp",
50    "${services_path}/distributed/src/distributed_preferences_database.cpp",
51    "${services_path}/distributed/src/distributed_preferences_info.cpp",
52    "${services_path}/distributed/src/distributed_screen_status_manager.cpp",
53    "${services_path}/distributed/test/unittest/distributed_database_test.cpp",
54    "${services_path}/distributed/test/unittest/distributed_notification_manager_test.cpp",
55    "${services_path}/distributed/test/unittest/distributed_preferences_test.cpp",
56    "${services_path}/distributed/test/unittest/distributed_screen_status_manager_test.cpp",
57    "${services_path}/distributed/test/unittest/mock/mock_blob.cpp",
58    "${services_path}/distributed/test/unittest/mock/mock_change_notification.cpp",
59    "${services_path}/distributed/test/unittest/mock/mock_device_manager_impl.cpp",
60    "${services_path}/distributed/test/unittest/mock/mock_event_handler.cpp",
61    "${services_path}/distributed/test/unittest/mock/mock_single_kv_store.cpp",
62  ]
63
64  configs = [
65    "${services_path}/distributed/:ans_distributed_config",
66    "${frameworks_module_ans_path}:ans_innerkits_public_config",
67  ]
68
69  deps = [
70    "${frameworks_module_ans_path}:ans_innerkits",
71    "//third_party/googletest:gtest_main",
72  ]
73
74  external_deps = [
75    "ability_base:base",
76    "ability_base:want",
77    "ability_base:zuri",
78    "bundle_framework:appexecfwk_base",
79    "c_utils:utils",
80    "device_manager:devicemanagersdk",
81    "eventhandler:libeventhandler",
82    "ffrt:libffrt",
83    "hilog:libhilog",
84    "hitrace:hitrace_meter",
85    "hitrace:libhitracechain",
86    "image_framework:image_native",
87    "ipc:ipc_core",
88    "kv_store:distributeddata_inner",
89  ]
90
91  subsystem_name = "${subsystem_name}"
92  part_name = "${component_name}"
93}
94
95ohos_unittest("distributed_preferences_database_test") {
96  module_out_path = "${component_name}/unittest"
97  include_dirs = [
98    "/${services_path}/distributed/include",
99    "${services_path}/distributed/test/unittest/mock",
100  ]
101
102  sources = [
103    "distributed_preferences_database_test/distributed_preferences_database_test.cpp",
104    "distributed_preferences_database_test/mock_distributed_flow_control.cpp",
105    "distributed_preferences_database_test/mock_distributed_kv_data_manager.cpp",
106    "distributed_preferences_database_test/mock_single_kv_store.cpp",
107  ]
108
109  configs = [
110    "${services_path}/distributed/:ans_distributed_config",
111    "${frameworks_module_ans_path}:ans_innerkits_public_config",
112  ]
113
114  deps = [
115    "${frameworks_module_ans_path}:ans_innerkits",
116    "${services_path}/distributed:libans_distributed",
117    "//third_party/googletest:gtest_main",
118  ]
119
120  external_deps = [
121    "ability_base:base",
122    "ability_base:want",
123    "ability_base:zuri",
124    "bundle_framework:appexecfwk_base",
125    "c_utils:utils",
126    "device_manager:devicemanagersdk",
127    "eventhandler:libeventhandler",
128    "hilog:libhilog",
129    "hitrace:hitrace_meter",
130    "hitrace:libhitracechain",
131    "image_framework:image_native",
132    "ipc:ipc_core",
133    "kv_store:distributeddata_inner",
134  ]
135
136  subsystem_name = "${subsystem_name}"
137  part_name = "${component_name}"
138}
139
140ohos_unittest("distributed_screen_status_manager_branch_test") {
141  module_out_path = "${component_name}/unittest"
142  include_dirs = [
143    "/${services_path}/distributed/include",
144    "${services_path}/distributed/test/unittest/mock",
145  ]
146
147  sources = [
148    "distributed_database_branch_test/mock_device_manager_impl.cpp",
149    "distributed_screen_status_manager_branch_test/distributed_screen_status_manager_branch_test.cpp",
150    "distributed_screen_status_manager_branch_test/mock_distributed_flow_control.cpp",
151    "distributed_screen_status_manager_branch_test/mock_distributed_kv_data_manager.cpp",
152    "distributed_screen_status_manager_branch_test/mock_single_kv_store.cpp",
153  ]
154
155  configs = [
156    "${services_path}/distributed/:ans_distributed_config",
157    "${frameworks_module_ans_path}:ans_innerkits_public_config",
158  ]
159
160  deps = [
161    "${frameworks_module_ans_path}:ans_innerkits",
162    "${services_path}/distributed:libans_distributed",
163    "//third_party/googletest:gtest_main",
164  ]
165
166  external_deps = [
167    "ability_base:base",
168    "ability_base:want",
169    "ability_base:zuri",
170    "bundle_framework:appexecfwk_base",
171    "c_utils:utils",
172    "device_manager:devicemanagersdk",
173    "eventhandler:libeventhandler",
174    "hilog:libhilog",
175    "hitrace:hitrace_meter",
176    "hitrace:libhitracechain",
177    "image_framework:image_native",
178    "ipc:ipc_core",
179    "kv_store:distributeddata_inner",
180  ]
181
182  subsystem_name = "${subsystem_name}"
183  part_name = "${component_name}"
184}
185
186ohos_unittest("distributed_database_branch_test") {
187  module_out_path = "${component_name}/unittest"
188  include_dirs = [
189    "/${services_path}/distributed/include",
190    "${services_path}/distributed/test/unittest/mock",
191  ]
192
193  sources = [
194    "distributed_database_branch_test/distributed_database_branch_test.cpp",
195    "distributed_database_branch_test/mock_device_manager_impl.cpp",
196    "distributed_database_branch_test/mock_distributed_flow_control.cpp",
197    "distributed_database_branch_test/mock_distributed_kv_data_manager.cpp",
198    "distributed_database_branch_test/mock_single_kv_store.cpp",
199  ]
200
201  configs = [
202    "${services_path}/distributed/:ans_distributed_config",
203    "${frameworks_module_ans_path}:ans_innerkits_public_config",
204  ]
205
206  deps = [
207    "${frameworks_module_ans_path}:ans_innerkits",
208    "${services_path}/distributed:libans_distributed",
209    "//third_party/googletest:gtest_main",
210  ]
211
212  external_deps = [
213    "ability_base:base",
214    "ability_base:want",
215    "ability_base:zuri",
216    "bundle_framework:appexecfwk_base",
217    "c_utils:utils",
218    "device_manager:devicemanagersdk",
219    "eventhandler:libeventhandler",
220    "hilog:libhilog",
221    "hitrace:hitrace_meter",
222    "hitrace:libhitracechain",
223    "image_framework:image_native",
224    "ipc:ipc_core",
225    "kv_store:distributeddata_inner",
226  ]
227
228  subsystem_name = "${subsystem_name}"
229  part_name = "${component_name}"
230}
231
232ohos_unittest("distributed_preferences_branch_test") {
233  module_out_path = "${component_name}/unittest"
234  include_dirs = [ "/${services_path}/distributed/include" ]
235
236  sources = [
237    "distributed_preferences_branch_test/distributed_preferences_branch_test.cpp",
238    "distributed_preferences_branch_test/mock_distributed_preferences_database.cpp",
239  ]
240
241  configs = [
242    "${services_path}/distributed/:ans_distributed_config",
243    "${frameworks_module_ans_path}:ans_innerkits_public_config",
244  ]
245
246  deps = [
247    "${frameworks_module_ans_path}:ans_innerkits",
248    "${services_path}/distributed:libans_distributed",
249    "//third_party/googletest:gtest_main",
250  ]
251
252  external_deps = [
253    "ability_base:base",
254    "ability_base:want",
255    "ability_base:zuri",
256    "bundle_framework:appexecfwk_base",
257    "c_utils:utils",
258    "device_manager:devicemanagersdk",
259    "eventhandler:libeventhandler",
260    "hilog:libhilog",
261    "hitrace:hitrace_meter",
262    "hitrace:libhitracechain",
263    "image_framework:image_native",
264    "ipc:ipc_core",
265    "kv_store:distributeddata_inner",
266  ]
267
268  subsystem_name = "${subsystem_name}"
269  part_name = "${component_name}"
270}
271
272ohos_unittest("distributed_device_callback_test") {
273  module_out_path = "${component_name}/unittest"
274  include_dirs = [ "/${services_path}/distributed/include" ]
275
276  sources = [ "distributed_device_callback_test.cpp" ]
277
278  configs = [
279    "${services_path}/distributed/:ans_distributed_config",
280    "${frameworks_module_ans_path}:ans_innerkits_public_config",
281  ]
282
283  deps = [
284    "${frameworks_module_ans_path}:ans_innerkits",
285    "${services_path}/distributed:libans_distributed",
286    "//third_party/googletest:gtest_main",
287  ]
288
289  external_deps = [
290    "ability_base:base",
291    "ability_base:want",
292    "ability_base:zuri",
293    "bundle_framework:appexecfwk_base",
294    "c_utils:utils",
295    "device_manager:devicemanagersdk",
296    "eventhandler:libeventhandler",
297    "hilog:libhilog",
298    "hitrace:hitrace_meter",
299    "hitrace:libhitracechain",
300    "image_framework:image_native",
301    "ipc:ipc_core",
302    "kv_store:distributeddata_inner",
303  ]
304
305  subsystem_name = "${subsystem_name}"
306  part_name = "${component_name}"
307}
308
309ohos_unittest("distributed_database_callback_test") {
310  module_out_path = "${component_name}/unittest"
311  include_dirs = [ "/${services_path}/distributed/include" ]
312
313  sources = [ "distributed_database_callback_test.cpp" ]
314
315  configs = [
316    "${services_path}/distributed/:ans_distributed_config",
317    "${frameworks_module_ans_path}:ans_innerkits_public_config",
318  ]
319
320  deps = [
321    "${frameworks_module_ans_path}:ans_innerkits",
322    "${services_path}/distributed:libans_distributed",
323    "//third_party/googletest:gtest_main",
324  ]
325
326  external_deps = [
327    "ability_base:base",
328    "ability_base:want",
329    "ability_base:zuri",
330    "bundle_framework:appexecfwk_base",
331    "c_utils:utils",
332    "eventhandler:libeventhandler",
333    "hilog:libhilog",
334    "hitrace:hitrace_meter",
335    "hitrace:libhitracechain",
336    "image_framework:image_native",
337    "ipc:ipc_core",
338    "kv_store:distributeddata_inner",
339  ]
340
341  subsystem_name = "${subsystem_name}"
342  part_name = "${component_name}"
343}
344
345ohos_unittest("distributed_flow_control_test") {
346  module_out_path = "${component_name}/unittest"
347  include_dirs = [ "/${services_path}/distributed/include" ]
348
349  sources = [ "distributed_flow_control_test.cpp" ]
350
351  configs = [
352    "${services_path}/distributed/:ans_distributed_config",
353    "${frameworks_module_ans_path}:ans_innerkits_public_config",
354  ]
355
356  deps = [
357    "${frameworks_module_ans_path}:ans_innerkits",
358    "${services_path}/distributed:libans_distributed",
359    "//third_party/googletest:gtest_main",
360  ]
361
362  external_deps = [
363    "ability_base:base",
364    "ability_base:want",
365    "ability_base:zuri",
366    "bundle_framework:appexecfwk_base",
367    "c_utils:utils",
368    "eventhandler:libeventhandler",
369    "hilog:libhilog",
370    "hitrace:hitrace_meter",
371    "hitrace:libhitracechain",
372    "image_framework:image_native",
373    "ipc:ipc_core",
374    "kv_store:distributeddata_inner",
375  ]
376
377  subsystem_name = "${subsystem_name}"
378  part_name = "${component_name}"
379}
380
381ohos_unittest("distributed_notification_manager_branch_test") {
382  module_out_path = "${component_name}/unittest"
383  include_dirs = [
384    "/${services_path}/distributed/include",
385    "${ffrt_path}/interfaces/kits",
386  ]
387
388  sources = [
389    "distributed_notification_manager_branch_test/distributed_notification_manager_branch_test.cpp",
390    "distributed_notification_manager_branch_test/mock_distributed_database.cpp",
391  ]
392
393  configs = [
394    "${services_path}/distributed/:ans_distributed_config",
395    "${frameworks_module_ans_path}:ans_innerkits_public_config",
396  ]
397
398  deps = [
399    "${frameworks_module_ans_path}:ans_innerkits",
400    "${services_path}/distributed:libans_distributed",
401    "//third_party/googletest:gtest_main",
402  ]
403
404  external_deps = [
405    "ability_base:base",
406    "ability_base:want",
407    "ability_base:zuri",
408    "bundle_framework:appexecfwk_base",
409    "c_utils:utils",
410    "device_manager:devicemanagersdk",
411    "eventhandler:libeventhandler",
412    "ffrt:libffrt",
413    "hilog:libhilog",
414    "hitrace:hitrace_meter",
415    "hitrace:libhitracechain",
416    "image_framework:image_native",
417    "ipc:ipc_core",
418    "kv_store:distributeddata_inner",
419  ]
420
421  subsystem_name = "${subsystem_name}"
422  part_name = "${component_name}"
423}
424