1# Copyright (c) 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.
13import("//build/test.gni")
14import("//foundation/distributeddatamgr/udmf/udmf.gni")
15
16module_output_path = "udmf/innerkitsImpl"
17
18###############################################################################
19config("module_private_config") {
20  include_dirs = [
21    "${udmf_interfaces_path}/innerkits/client",
22    "${udmf_interfaces_path}/innerkits/common",
23    "${udmf_interfaces_path}/innerkits/data",
24    "${udmf_interfaces_path}/innerkits/convert",
25    "${udmf_interfaces_path}/ndk/data",
26    "${udmf_framework_path}/common",
27    "${udmf_framework_path}/innerkits/service",
28    "${udmf_framework_path}/innerkitsimpl/client/",
29    "${udmf_framework_path}/innerkitsimpl/test/unittest/mock/include",
30    "${udmf_framework_path}/ndkimpl/data",
31    "${kv_store_path}/frameworks/common",
32  ]
33}
34
35common_deps = [
36  "${udmf_interfaces_path}/innerkits:udmf_client",
37  "${udmf_interfaces_path}/innerkits:utd_client",
38  "${udmf_interfaces_path}/ndk:libudmf",
39]
40
41common_external_deps = [
42  "ability_base:base",
43  "ability_base:want",
44  "access_token:libaccesstoken_sdk",
45  "access_token:libnativetoken",
46  "access_token:libtoken_setproc",
47  "bundle_framework:appexecfwk_core",
48  "c_utils:utils",
49  "ffmpeg:libohosffmpeg",
50  "hilog:libhilog",
51  "hisysevent:libhisysevent",
52  "hitrace:hitrace_meter",
53  "hitrace:libhitracechain",
54  "image_framework:image",
55  "image_framework:image",
56  "image_framework:image_native",
57  "image_framework:pixelmap",
58  "ipc:ipc_core",
59  "kv_store:distributeddata_inner",
60  "kv_store:distributeddata_mgr",
61  "libexif:libexif",
62  "samgr:samgr_proxy",
63]
64
65ohos_unittest("UdmfClientTest") {
66  module_out_path = module_output_path
67
68  sources = [
69    "${udmf_framework_path}/common/graph.cpp",
70    "${udmf_framework_path}/innerkitsimpl/client/async_obtain_data.cpp",
71    "${udmf_framework_path}/innerkitsimpl/convert/udmf_conversion.cpp",
72    "${udmf_framework_path}/innerkitsimpl/service/udmf_service_proxy.cpp",
73    "udmf_client_test.cpp",
74  ]
75
76  configs = [ ":module_private_config" ]
77
78  deps = common_deps
79
80  external_deps = common_external_deps
81
82  defines = [
83    "private=public",
84    "protected=public",
85  ]
86}
87
88ohos_unittest("UdmfClientSystemHapTest") {
89  module_out_path = module_output_path
90
91  sources = [ "udmf_client_system_hap_test.cpp" ]
92
93  configs = [ ":module_private_config" ]
94
95  deps = common_deps
96
97  external_deps = common_external_deps
98}
99
100ohos_unittest("UtdClientTest") {
101  module_out_path = module_output_path
102
103  sources = [
104    "${udmf_framework_path}/common/graph.cpp",
105    "${udmf_framework_path}/common/utd_graph.cpp",
106    "custom_utd_json_parser_test.cpp",
107    "custom_utd_store_test.cpp",
108    "graph_test.cpp",
109    "utd_client_test.cpp",
110  ]
111
112  configs = [ ":module_private_config" ]
113
114  deps = [ "${udmf_interfaces_path}/innerkits:utd_client" ]
115
116  external_deps = common_external_deps
117
118  defines = [
119    "private=public",
120    "protected=public",
121  ]
122}
123
124ohos_unittest("NdkDataConversionTest") {
125  module_out_path = module_output_path
126
127  sources = [ "ndk_data_conversion_test.cpp" ]
128
129  configs = [ ":module_private_config" ]
130
131  deps = common_deps
132
133  external_deps = common_external_deps
134}
135
136ohos_unittest("ApplicationDefineRecordTest") {
137  module_out_path = module_output_path
138
139  sources = [ "application_defined_record_test.cpp" ]
140
141  deps = common_deps
142
143  external_deps = common_external_deps
144
145  defines = [
146    "private=public",
147    "protected=public",
148  ]
149}
150
151ohos_unittest("AudioTest") {
152  module_out_path = module_output_path
153
154  sources = [ "audio_test.cpp" ]
155
156  deps = common_deps
157
158  external_deps = common_external_deps
159
160  defines = [
161    "private=public",
162    "protected=public",
163  ]
164}
165
166ohos_unittest("FileDataTest") {
167  module_out_path = module_output_path
168
169  sources = [ "file_test.cpp" ]
170
171  configs = [ ":module_private_config" ]
172
173  deps = common_deps
174
175  external_deps = common_external_deps
176
177  defines = [
178    "private=public",
179    "protected=public",
180  ]
181}
182
183ohos_unittest("FlexibleTypeTest") {
184  module_out_path = module_output_path
185
186  sources = [ "flexible_type_test.cpp" ]
187
188  deps = common_deps
189
190  external_deps = common_external_deps
191
192  defines = [
193    "private=public",
194    "protected=public",
195  ]
196}
197
198ohos_unittest("FolderTest") {
199  module_out_path = module_output_path
200
201  sources = [ "folder_test.cpp" ]
202
203  deps = common_deps
204
205  external_deps = common_external_deps
206
207  defines = [
208    "private=public",
209    "protected=public",
210  ]
211}
212
213ohos_unittest("HtmlTest") {
214  module_out_path = module_output_path
215
216  sources = [ "html_test.cpp" ]
217
218  deps = common_deps
219
220  external_deps = common_external_deps
221
222  defines = [
223    "private=public",
224    "protected=public",
225  ]
226}
227
228ohos_unittest("ImageTest") {
229  module_out_path = module_output_path
230
231  sources = [ "image_test.cpp" ]
232
233  deps = common_deps
234
235  external_deps = common_external_deps
236
237  defines = [
238    "private=public",
239    "protected=public",
240  ]
241}
242
243ohos_unittest("LinkTest") {
244  module_out_path = module_output_path
245
246  sources = [ "link_test.cpp" ]
247
248  deps = common_deps
249
250  external_deps = common_external_deps
251
252  defines = [
253    "private=public",
254    "protected=public",
255  ]
256}
257
258ohos_unittest("PlainTextTest") {
259  module_out_path = module_output_path
260
261  sources = [ "plain_text_test.cpp" ]
262
263  deps = common_deps
264
265  external_deps = common_external_deps
266
267  defines = [
268    "private=public",
269    "protected=public",
270  ]
271}
272
273ohos_unittest("SystemDefinedAppitemTest") {
274  module_out_path = module_output_path
275
276  sources = [ "system_defined_appitem_test.cpp" ]
277
278  deps = common_deps
279
280  external_deps = common_external_deps
281
282  defines = [
283    "private=public",
284    "protected=public",
285  ]
286}
287
288ohos_unittest("SystemDefinedFormTest") {
289  module_out_path = module_output_path
290
291  sources = [ "system_defined_form_test.cpp" ]
292
293  deps = common_deps
294
295  external_deps = common_external_deps
296
297  defines = [
298    "private=public",
299    "protected=public",
300  ]
301}
302
303ohos_unittest("SystemDefinedPixelMapTest") {
304  module_out_path = module_output_path
305
306  sources = [ "system_defined_pixelmap_test.cpp" ]
307
308  deps = common_deps
309
310  external_deps = common_external_deps
311
312  defines = [
313    "private=public",
314    "protected=public",
315  ]
316}
317
318ohos_unittest("SystemDefinedRecordTest") {
319  module_out_path = module_output_path
320
321  sources = [ "system_defined_record_test.cpp" ]
322
323  deps = common_deps
324
325  external_deps = common_external_deps
326
327  defines = [
328    "private=public",
329    "protected=public",
330  ]
331}
332
333ohos_unittest("TextTest") {
334  module_out_path = module_output_path
335
336  sources = [ "text_test.cpp" ]
337
338  deps = common_deps
339
340  external_deps = common_external_deps
341
342  defines = [
343    "private=public",
344    "protected=public",
345  ]
346}
347
348ohos_unittest("UnifiedDataTest") {
349  module_out_path = module_output_path
350
351  sources = [ "unified_data_test.cpp" ]
352
353  deps = common_deps
354
355  external_deps = common_external_deps
356
357  defines = [
358    "private=public",
359    "protected=public",
360  ]
361}
362
363ohos_unittest("UnifiedDataHelperTest") {
364  module_out_path = module_output_path
365
366  sources = [ "unified_data_helper_test.cpp" ]
367
368  deps = common_deps
369
370  external_deps = common_external_deps
371
372  defines = [
373    "private=public",
374    "protected=public",
375  ]
376}
377
378ohos_unittest("UnifiedRecordTest") {
379  module_out_path = module_output_path
380
381  sources = [ "unified_record_test.cpp" ]
382
383  deps = common_deps
384
385  external_deps = common_external_deps
386
387  defines = [
388    "private=public",
389    "protected=public",
390  ]
391}
392
393ohos_unittest("VideoTest") {
394  module_out_path = module_output_path
395
396  sources = [ "video_test.cpp" ]
397
398  deps = common_deps
399
400  external_deps = common_external_deps
401
402  defines = [
403    "private=public",
404    "protected=public",
405  ]
406}
407
408ohos_unittest("UnifiedMetaTest") {
409  module_out_path = module_output_path
410
411  sources = [ "unified_meta_test.cpp" ]
412
413  deps = common_deps
414
415  external_deps = common_external_deps
416
417  defines = [
418    "private=public",
419    "protected=public",
420  ]
421}
422
423ohos_unittest("UdmfClientAbnormalTest") {
424  module_out_path = module_output_path
425
426  sources = [
427    "${udmf_framework_path}/common/endian_converter.cpp",
428    "${udmf_framework_path}/common/tlv_util.cpp",
429    "${udmf_framework_path}/common/udmf_radar_reporter.cpp",
430    "${udmf_framework_path}/common/udmf_types_util.cpp",
431    "${udmf_framework_path}/common/udmf_utils.cpp",
432    "${udmf_framework_path}/innerkitsimpl/client/async_obtain_data.cpp",
433    "${udmf_framework_path}/innerkitsimpl/client/udmf_client.cpp",
434    "${udmf_framework_path}/innerkitsimpl/common/unified_key.cpp",
435    "${udmf_framework_path}/innerkitsimpl/common/unified_meta.cpp",
436    "${udmf_framework_path}/innerkitsimpl/convert/udmf_conversion.cpp",
437    "${udmf_framework_path}/innerkitsimpl/data/application_defined_record.cpp",
438    "${udmf_framework_path}/innerkitsimpl/data/audio.cpp",
439    "${udmf_framework_path}/innerkitsimpl/data/file.cpp",
440    "${udmf_framework_path}/innerkitsimpl/data/folder.cpp",
441    "${udmf_framework_path}/innerkitsimpl/data/html.cpp",
442    "${udmf_framework_path}/innerkitsimpl/data/image.cpp",
443    "${udmf_framework_path}/innerkitsimpl/data/link.cpp",
444    "${udmf_framework_path}/innerkitsimpl/data/plain_text.cpp",
445    "${udmf_framework_path}/innerkitsimpl/data/system_defined_appitem.cpp",
446    "${udmf_framework_path}/innerkitsimpl/data/system_defined_form.cpp",
447    "${udmf_framework_path}/innerkitsimpl/data/system_defined_record.cpp",
448    "${udmf_framework_path}/innerkitsimpl/data/text.cpp",
449    "${udmf_framework_path}/innerkitsimpl/data/unified_data.cpp",
450    "${udmf_framework_path}/innerkitsimpl/data/unified_record.cpp",
451    "${udmf_framework_path}/innerkitsimpl/data/video.cpp",
452    "${udmf_framework_path}/innerkitsimpl/service/udmf_service_proxy.cpp",
453    "${udmf_framework_path}/innerkitsimpl/test/unittest/mock/system_defined_pixelmap_mock.cpp",
454    "${udmf_framework_path}/innerkitsimpl/test/unittest/mock/tlv_object_mock.cpp",
455    "${udmf_framework_path}/innerkitsimpl/test/unittest/mock/udmf_service_client_mock.cpp",
456    "udmf_client_abnormal_test.cpp",
457  ]
458
459  configs = [ ":module_private_config" ]
460
461  deps = [
462    "${udmf_interfaces_path}/innerkits:utd_client",
463    "//third_party/googletest:gmock_main",
464    "//third_party/googletest:gtest_main",
465  ]
466
467  external_deps = common_external_deps
468
469  defines = [
470    "private=public",
471    "protected=public",
472  ]
473}
474
475###############################################################################
476group("unittest") {
477  testonly = true
478
479  deps = [
480    ":ApplicationDefineRecordTest",
481    ":AudioTest",
482    ":FileDataTest",
483    ":FlexibleTypeTest",
484    ":FolderTest",
485    ":HtmlTest",
486    ":ImageTest",
487    ":LinkTest",
488    ":NdkDataConversionTest",
489    ":PlainTextTest",
490    ":SystemDefinedAppitemTest",
491    ":SystemDefinedFormTest",
492    ":SystemDefinedPixelMapTest",
493    ":SystemDefinedRecordTest",
494    ":TextTest",
495    ":UdmfClientAbnormalTest",
496    ":UdmfClientSystemHapTest",
497    ":UdmfClientTest",
498    ":UnifiedDataHelperTest",
499    ":UnifiedDataTest",
500    ":UnifiedMetaTest",
501    ":UnifiedRecordTest",
502    ":UtdClientTest",
503    ":VideoTest",
504  ]
505}
506###############################################################################
507