• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-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("//build/test.gni")
15import("//foundation/ability/ability_base/ability_base.gni")
16
17######################################################################
18base_output_path = "ability_base/ability_base/base_test"
19
20######################################################################
21config("base_private_config") {
22  visibility = [ ":*" ]
23}
24
25ohos_unittest("base_object_test") {
26  module_out_path = base_output_path
27  sources = [ "base/base_object_test.cpp" ]
28
29  configs = [ ":base_private_config" ]
30
31  deps = []
32
33  external_deps = [
34    "ability_base:base",
35    "c_utils:utils",
36    "googletest:gtest_main",
37    "ipc:ipc_core",
38  ]
39}
40
41ohos_unittest("base_test") {
42  module_out_path = base_output_path
43  sources = [ "base/base_test.cpp" ]
44
45  configs = [ ":base_private_config" ]
46
47  deps = []
48
49  external_deps = [
50    "ability_base:base",
51    "c_utils:utils",
52    "googletest:gtest_main",
53  ]
54}
55
56ohos_unittest("bool_wrapper_test") {
57  module_out_path = base_output_path
58  sources = [ "base/bool_wrapper_test.cpp" ]
59
60  configs = [ ":base_private_config" ]
61
62  deps = []
63
64  external_deps = [
65    "ability_base:base",
66    "c_utils:utils",
67    "googletest:gtest_main",
68    "ipc:ipc_core",
69  ]
70}
71
72ohos_unittest("byte_wrapper_test") {
73  module_out_path = base_output_path
74  sources = [ "base/byte_wrapper_test.cpp" ]
75
76  configs = [ ":base_private_config" ]
77
78  deps = []
79
80  external_deps = [
81    "ability_base:base",
82    "c_utils:utils",
83    "googletest:gtest_main",
84    "ipc:ipc_core",
85  ]
86}
87
88ohos_unittest("double_wrapper_test") {
89  module_out_path = base_output_path
90  sources = [ "base/double_wrapper_test.cpp" ]
91
92  configs = [ ":base_private_config" ]
93
94  deps = []
95
96  external_deps = [
97    "ability_base:base",
98    "c_utils:utils",
99    "googletest:gtest_main",
100    "ipc:ipc_core",
101  ]
102}
103
104ohos_unittest("float_wrapper_test") {
105  module_out_path = base_output_path
106  sources = [ "base/float_wrapper_test.cpp" ]
107
108  configs = [ ":base_private_config" ]
109
110  deps = []
111
112  external_deps = [
113    "ability_base:base",
114    "c_utils:utils",
115    "googletest:gtest_main",
116    "ipc:ipc_core",
117  ]
118}
119
120ohos_unittest("int_wrapper_test") {
121  module_out_path = base_output_path
122  sources = [ "base/int_wrapper_test.cpp" ]
123
124  configs = [ ":base_private_config" ]
125
126  deps = []
127
128  external_deps = [
129    "ability_base:base",
130    "c_utils:utils",
131    "googletest:gtest_main",
132    "ipc:ipc_core",
133  ]
134}
135
136ohos_unittest("long_wrapper_test") {
137  module_out_path = base_output_path
138  sources = [ "base/long_wrapper_test.cpp" ]
139
140  configs = [ ":base_private_config" ]
141
142  deps = []
143
144  external_deps = [
145    "ability_base:base",
146    "c_utils:utils",
147    "googletest:gtest_main",
148    "ipc:ipc_core",
149  ]
150}
151
152######################################################################
153want_output_path = "ability_base/ability_base/want_test"
154
155######################################################################
156config("want_private_config") {
157  defines = [ "ABILITYBASE_LOG_TAG = \"WantUnitTest\"" ]
158}
159
160config("module_private_want_param_wrapper_config") {
161  defines = [ "ABILITYBASE_LOG_TAG = \"WantUnitTest\"" ]
162}
163
164ohos_unittest("operation_test") {
165  module_out_path = want_output_path
166  sources = [ "want/operation_test.cpp" ]
167
168  configs = [
169    ":want_private_config",
170    "${ability_base_path}:want_public_config",
171  ]
172
173  deps = []
174
175  external_deps = [
176    "ability_base:base",
177    "ability_base:want",
178    "ability_base:zuri",
179    "bundle_framework:appexecfwk_base",
180    "c_utils:utils",
181    "googletest:gtest_main",
182  ]
183}
184
185ohos_unittest("patterns_matcher_test") {
186  module_out_path = want_output_path
187  sources = [ "want/patterns_matcher_test.cpp" ]
188
189  configs = [
190    ":want_private_config",
191    "${ability_base_path}:want_public_config",
192  ]
193
194  deps = [ "${ability_base_path}:base" ]
195
196  external_deps = [
197    "ability_base:want",
198    "bundle_framework:appexecfwk_base",
199    "c_utils:utils",
200    "googletest:gtest_main",
201    "hilog:libhilog",
202  ]
203}
204
205ohos_unittest("skills_test") {
206  module_out_path = want_output_path
207  sources = [ "want/skills_test.cpp" ]
208
209  configs = [
210    ":want_private_config",
211    "${ability_base_path}:want_public_config",
212  ]
213
214  deps = []
215
216  external_deps = [
217    "ability_base:base",
218    "ability_base:want",
219    "ability_base:zuri",
220    "bundle_framework:appexecfwk_base",
221    "c_utils:utils",
222    "googletest:gtest_main",
223    "hilog:libhilog",
224    "ipc:ipc_core",
225  ]
226}
227
228ohos_unittest("want_params_test") {
229  module_out_path = want_output_path
230  sources = [ "want/want_params_test.cpp" ]
231
232  configs = [
233    ":want_private_config",
234    "${ability_base_path}:want_public_config",
235  ]
236
237  deps = [
238    "${ability_base_path}:base",
239    "${ability_base_path}:want",
240  ]
241
242  external_deps = [
243    "bundle_framework:appexecfwk_base",
244    "c_utils:utils",
245    "googletest:gtest_main",
246    "hilog:libhilog",
247    "ipc:ipc_core",
248  ]
249}
250
251ohos_unittest("want_params_wrapper_test") {
252  module_out_path = want_output_path
253  sources = [ "want/want_params_wrapper_test.cpp" ]
254
255  configs = [ ":module_private_want_param_wrapper_config" ]
256
257  deps = []
258
259  external_deps = [
260    "ability_base:base",
261    "ability_base:want",
262    "ability_base:zuri",
263    "bundle_framework:appexecfwk_base",
264    "c_utils:utils",
265    "googletest:gtest_main",
266    "hilog:libhilog",
267    "ipc:ipc_core",
268  ]
269}
270
271ohos_unittest("want_test") {
272  module_out_path = want_output_path
273  sources = [ "want/want_test.cpp" ]
274
275  configs = [
276    ":want_private_config",
277    "${ability_base_path}:want_public_config",
278  ]
279
280  deps = []
281
282  external_deps = [
283    "ability_base:base",
284    "ability_base:want",
285    "ability_base:zuri",
286    "bundle_framework:appexecfwk_base",
287    "c_utils:utils",
288    "googletest:gtest_main",
289    "hilog:libhilog",
290    "ipc:ipc_core",
291  ]
292}
293
294ohos_unittest("uri_test") {
295  module_out_path = want_output_path
296  sources = [ "want/uri_test.cpp" ]
297
298  configs = [
299    ":want_private_config",
300    "${ability_base_path}:want_public_config",
301  ]
302
303  deps = []
304
305  external_deps = [
306    "ability_base:base",
307    "ability_base:want",
308    "ability_base:zuri",
309    "bundle_framework:appexecfwk_base",
310    "c_utils:utils",
311    "googletest:gtest_main",
312    "hilog:libhilog",
313  ]
314}
315
316ohos_unittest("extra_params_test") {
317  module_out_path = want_output_path
318  sources = [ "want/extra_params_test.cpp" ]
319
320  configs = [
321    ":want_private_config",
322    "${ability_base_path}:want_public_config",
323  ]
324
325  deps = []
326
327  external_deps = [
328    "ability_base:base",
329    "ability_base:want",
330    "ability_base:zuri",
331    "bundle_framework:appexecfwk_base",
332    "c_utils:utils",
333    "googletest:gtest_main",
334  ]
335}
336
337ohos_unittest("array_wrapper_test") {
338  module_out_path = want_output_path
339  sources = [ "want/array_wrapper_test.cpp" ]
340
341  configs = [
342    ":want_private_config",
343    "${ability_base_path}:want_public_config",
344  ]
345
346  deps = []
347
348  external_deps = [
349    "ability_base:base",
350    "ability_base:want",
351    "ability_base:zuri",
352    "bundle_framework:appexecfwk_base",
353    "c_utils:utils",
354    "googletest:gtest_main",
355    "ipc:ipc_core",
356  ]
357}
358
359ohos_unittest("zchar_wrapper_test") {
360  module_out_path = base_output_path
361  sources = [ "base/zchar_wrapper_test.cpp" ]
362
363  configs = [
364    ":want_private_config",
365    "${ability_base_path}:want_public_config",
366  ]
367
368  deps = []
369
370  external_deps = [
371    "ability_base:base",
372    "ability_base:want",
373    "ability_base:zuri",
374    "bundle_framework:appexecfwk_base",
375    "c_utils:utils",
376    "googletest:gtest_main",
377    "ipc:ipc_core",
378  ]
379}
380
381ohos_unittest("short_wrapper_test") {
382  module_out_path = base_output_path
383  sources = [ "base/short_wrapper_test.cpp" ]
384
385  configs = [
386    ":want_private_config",
387    "${ability_base_path}:want_public_config",
388  ]
389
390  deps = []
391
392  external_deps = [
393    "ability_base:base",
394    "ability_base:want",
395    "ability_base:zuri",
396    "bundle_framework:appexecfwk_base",
397    "c_utils:utils",
398    "googletest:gtest_main",
399    "ipc:ipc_core",
400  ]
401}
402
403ohos_unittest("string_wrapper_test") {
404  module_out_path = base_output_path
405  sources = [ "base/string_wrapper_test.cpp" ]
406
407  configs = [
408    ":want_private_config",
409    "${ability_base_path}:want_public_config",
410  ]
411
412  deps = []
413
414  external_deps = [
415    "ability_base:base",
416    "ability_base:want",
417    "ability_base:zuri",
418    "bundle_framework:appexecfwk_base",
419    "c_utils:utils",
420    "googletest:gtest_main",
421    "ipc:ipc_core",
422  ]
423}
424
425ohos_unittest("user_object_wrapper_test") {
426  module_out_path = base_output_path
427  sources = [ "base/user_object_wrapper_test.cpp" ]
428
429  configs = [
430    ":want_private_config",
431    "${ability_base_path}:want_public_config",
432  ]
433
434  deps = []
435
436  external_deps = [
437    "ability_base:base",
438    "ability_base:want",
439    "ability_base:zuri",
440    "bundle_framework:appexecfwk_base",
441    "c_utils:utils",
442    "googletest:gtest_main",
443    "ipc:ipc_core",
444  ]
445}
446
447ohos_unittest("cwant_test") {
448  module_out_path = want_output_path
449  sources = [ "cwant/capi_want_test.cpp" ]
450
451  configs = []
452
453  include_dirs = [
454    "${ability_base_innerapi_path}/log/include",
455    "${ability_base_kits_native_path}",
456    "${ability_base_ndk_path}/common",
457    "${ability_base_ndk_path}/cwant/include",
458  ]
459
460  deps = []
461
462  external_deps = [
463    "ability_base:ability_base_want",
464    "ability_base:base",
465    "ability_base:want",
466    "c_utils:utils",
467    "hilog:libhilog",
468    "ipc:ipc_single",
469  ]
470}
471
472######################################################################
473extractor_output_path = "ability_base/ability_base/extractor_test"
474
475######################################################################
476config("extractor_private_config") {
477  visibility = [ ":*" ]
478  include_dirs =
479      [ "{ability_base_path}/interfaces/kits/native/extractor/include" ]
480
481  defines = [ "ABILITYBASE_LOG_TAG = \"ExtractorTest\"" ]
482}
483
484ohos_unittest("extractor_test") {
485  module_out_path = extractor_output_path
486  sources = [ "extractor/extractor_test.cpp" ]
487
488  configs = [ ":extractor_private_config" ]
489
490  deps = []
491
492  external_deps = [
493    "ability_base:extractortool",
494    "ability_base:extractresourcemanager",
495    "ability_base:string_utils",
496    "c_utils:utils",
497    "googletest:gtest_main",
498    "hilog:libhilog",
499    "resource_management:global_resmgr",
500    "zlib:libz",
501    "zlib:shared_libz",
502  ]
503}
504
505######################################################################
506viewdata_output_path = "ability_base/ability_base/view_data_test"
507
508######################################################################
509config("viewdata_private_config") {
510  visibility = [ ":*" ]
511  include_dirs =
512      [ "{ability_base_path}/interfaces/kits/native/view_data/include" ]
513
514  defines = [ "ABILITYBASE_LOG_TAG = \"ViewDataTest\"" ]
515}
516
517ohos_unittest("view_data_test") {
518  module_out_path = viewdata_output_path
519  sources = [ "viewdata/view_data_test.cpp" ]
520
521  configs = [ ":viewdata_private_config" ]
522
523  deps = []
524
525  external_deps = [
526    "ability_base:base",
527    "ability_base:session_info",
528    "ability_base:string_utils",
529    "ability_base:view_data",
530    "ability_base:want",
531    "ability_base:zuri",
532    "bundle_framework:appexecfwk_base",
533    "c_utils:utils",
534    "googletest:gtest_main",
535    "hilog:libhilog",
536    "ipc:ipc_core",
537    "json:nlohmann_json_static",
538    "zlib:libz",
539    "zlib:shared_libz",
540  ]
541}
542
543ohos_unittest("rect_test") {
544  module_out_path = viewdata_output_path
545  sources = [ "viewdata/rect_test.cpp" ]
546
547  configs = [ ":viewdata_private_config" ]
548
549  deps = []
550
551  external_deps = [
552    "ability_base:base",
553    "ability_base:session_info",
554    "ability_base:string_utils",
555    "ability_base:view_data",
556    "ability_base:want",
557    "ability_base:zuri",
558    "bundle_framework:appexecfwk_base",
559    "c_utils:utils",
560    "googletest:gtest_main",
561    "hilog:libhilog",
562    "ipc:ipc_core",
563    "json:nlohmann_json_static",
564    "zlib:libz",
565    "zlib:shared_libz",
566  ]
567}
568
569ohos_unittest("page_node_info_test") {
570  module_out_path = viewdata_output_path
571  sources = [ "viewdata/page_node_info_test.cpp" ]
572
573  configs = [ ":viewdata_private_config" ]
574
575  deps = []
576
577  external_deps = [
578    "ability_base:base",
579    "ability_base:session_info",
580    "ability_base:string_utils",
581    "ability_base:view_data",
582    "ability_base:want",
583    "ability_base:zuri",
584    "bundle_framework:appexecfwk_base",
585    "c_utils:utils",
586    "googletest:gtest_main",
587    "hilog:libhilog",
588    "ipc:ipc_core",
589    "json:nlohmann_json_static",
590    "zlib:libz",
591    "zlib:shared_libz",
592  ]
593}
594
595######################################################################
596base_configuration_output_path =
597    "ability_base/ability_base/base_configuration_test"
598
599######################################################################
600config("configuration_private_config") {
601  visibility = [ ":*" ]
602  include_dirs =
603      [ "${ability_base_path}/interfaces/kits/native/configuration/include" ]
604
605  defines = [ "ABILITYBASE_LOG_TAG = \"BaseConfigurationTest\"" ]
606}
607
608ohos_unittest("base_configuration_test") {
609  module_out_path = base_configuration_output_path
610
611  sources = [ "configuration/base_configuration_test.cpp" ]
612
613  configs = [ ":configuration_private_config" ]
614  deps = []
615
616  external_deps = [
617    "ability_base:base",
618    "ability_base:configuration",
619    "ability_base:session_info",
620    "ability_base:string_utils",
621    "ability_base:view_data",
622    "ability_base:want",
623    "ability_base:zuri",
624    "bundle_framework:appexecfwk_base",
625    "c_utils:utils",
626    "googletest:gtest_main",
627    "hilog:libhilog",
628    "ipc:ipc_core",
629    "json:nlohmann_json_static",
630    "zlib:libz",
631    "zlib:shared_libz",
632  ]
633}
634
635######################################################################
636
637group("unittest") {
638  testonly = true
639  deps = [
640    #":base_test",
641    ":array_wrapper_test",
642    ":base_configuration_test",
643    ":base_object_test",
644    ":bool_wrapper_test",
645    ":byte_wrapper_test",
646    ":cwant_test",
647    ":double_wrapper_test",
648    ":extra_params_test",
649    ":extractor_test",
650    ":float_wrapper_test",
651    ":int_wrapper_test",
652    ":long_wrapper_test",
653    ":operation_test",
654    ":page_node_info_test",
655    ":patterns_matcher_test",
656    ":rect_test",
657    ":short_wrapper_test",
658    ":skills_test",
659    ":string_wrapper_test",
660    ":uri_test",
661    ":user_object_wrapper_test",
662    ":view_data_test",
663    ":want_params_test",
664    ":want_params_wrapper_test",
665    ":want_test",
666    ":zchar_wrapper_test",
667  ]
668}
669