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  ]
32}
33
34common_deps = [
35  "${udmf_interfaces_path}/innerkits:udmf_client",
36  "${udmf_interfaces_path}/innerkits:utd_client",
37]
38
39common_external_deps = [
40  "ability_base:want",
41  "access_token:libaccesstoken_sdk",
42  "access_token:libnativetoken",
43  "access_token:libtoken_setproc",
44  "bundle_framework:appexecfwk_core",
45  "c_utils:utils",
46  "hilog:libhilog",
47  "image_framework:image",
48  "image_framework:image",
49  "image_framework:image_native",
50  "image_framework:pixelmap",
51  "ipc:ipc_core",
52  "kv_store:distributeddata_inner",
53  "samgr:samgr_proxy",
54]
55
56ohos_unittest("UdmfClientTest") {
57  module_out_path = module_output_path
58
59  sources = [
60    "${udmf_framework_path}/common/graph.cpp",
61    "udmf_client_test.cpp",
62  ]
63
64  configs = [ ":module_private_config" ]
65
66  deps = common_deps
67
68  external_deps = common_external_deps
69}
70
71ohos_unittest("UdmfClientSystemHapTest") {
72  module_out_path = module_output_path
73
74  sources = [ "udmf_client_system_hap_test.cpp" ]
75
76  configs = [ ":module_private_config" ]
77
78  deps = common_deps
79
80  external_deps = common_external_deps
81}
82
83ohos_unittest("UdmfClientHapPermissionTest") {
84  module_out_path = module_output_path
85
86  sources = [ "udmf_client_hap_permission_test.cpp" ]
87
88  include_dirs = [
89    "${udmf_interfaces_path}/innerkits/client",
90    "${udmf_interfaces_path}/innerkits/common",
91    "${udmf_interfaces_path}/innerkits/data",
92    "${udmf_interfaces_path}/innerkits/convert",
93    "${udmf_framework_path}/common",
94    "${udmf_framework_path}/innerkits/service",
95    "${udmf_framework_path}/innerkitsimpl/client/",
96    "${udmf_framework_path}/innerkitsimpl/test/unittest/mock/include",
97  ]
98
99  deps = common_deps
100
101  external_deps = common_external_deps
102}
103
104ohos_unittest("UtdClientTest") {
105  module_out_path = module_output_path
106
107  sources = [
108    "${udmf_framework_path}/common/graph.cpp",
109    "custom_utd_json_parser_test.cpp",
110    "custom_utd_store_test.cpp",
111    "graph_test.cpp",
112    "utd_client_test.cpp",
113  ]
114
115  configs = [ ":module_private_config" ]
116
117  deps = [ "${udmf_interfaces_path}/innerkits:utd_client" ]
118
119  external_deps = common_external_deps
120}
121
122ohos_unittest("NdkDataConversionTest") {
123  module_out_path = module_output_path
124
125  sources = [
126    "${udmf_framework_path}/ndkimpl/data/udmf.cpp",
127    "${udmf_framework_path}/ndkimpl/data/uds.cpp",
128    "ndk_data_conversion_test.cpp",
129  ]
130
131  configs = [ ":module_private_config" ]
132
133  deps = common_deps
134
135  external_deps = common_external_deps
136}
137
138ohos_unittest("ApplicationDefineRecordTest") {
139  module_out_path = module_output_path
140
141  sources = [ "application_defined_record_test.cpp" ]
142
143  deps = common_deps
144
145  external_deps = common_external_deps
146
147  defines = [
148    "private=public",
149    "protected=public",
150  ]
151}
152
153ohos_unittest("AudioTest") {
154  module_out_path = module_output_path
155
156  sources = [ "audio_test.cpp" ]
157
158  deps = common_deps
159
160  external_deps = common_external_deps
161
162  defines = [
163    "private=public",
164    "protected=public",
165  ]
166}
167
168ohos_unittest("FileDataTest") {
169  module_out_path = module_output_path
170
171  sources = [ "file_test.cpp" ]
172
173  configs = [ ":module_private_config" ]
174
175  deps = common_deps
176
177  external_deps = common_external_deps
178
179  defines = [
180    "private=public",
181    "protected=public",
182  ]
183}
184
185ohos_unittest("FlexibleTypeTest") {
186  module_out_path = module_output_path
187
188  sources = [ "flexible_type_test.cpp" ]
189
190  deps = common_deps
191
192  external_deps = common_external_deps
193
194  defines = [
195    "private=public",
196    "protected=public",
197  ]
198}
199
200ohos_unittest("FolderTest") {
201  module_out_path = module_output_path
202
203  sources = [ "folder_test.cpp" ]
204
205  deps = common_deps
206
207  external_deps = common_external_deps
208
209  defines = [
210    "private=public",
211    "protected=public",
212  ]
213}
214
215ohos_unittest("HtmlTest") {
216  module_out_path = module_output_path
217
218  sources = [ "html_test.cpp" ]
219
220  deps = common_deps
221
222  external_deps = common_external_deps
223
224  defines = [
225    "private=public",
226    "protected=public",
227  ]
228}
229
230ohos_unittest("ImageTest") {
231  module_out_path = module_output_path
232
233  sources = [ "image_test.cpp" ]
234
235  deps = common_deps
236
237  external_deps = common_external_deps
238
239  defines = [
240    "private=public",
241    "protected=public",
242  ]
243}
244
245ohos_unittest("LinkTest") {
246  module_out_path = module_output_path
247
248  sources = [ "link_test.cpp" ]
249
250  deps = common_deps
251
252  external_deps = common_external_deps
253
254  defines = [
255    "private=public",
256    "protected=public",
257  ]
258}
259
260ohos_unittest("PlainTextTest") {
261  module_out_path = module_output_path
262
263  sources = [ "plain_text_test.cpp" ]
264
265  deps = common_deps
266
267  external_deps = common_external_deps
268
269  defines = [
270    "private=public",
271    "protected=public",
272  ]
273}
274
275ohos_unittest("SystemDefinedAppitemTest") {
276  module_out_path = module_output_path
277
278  sources = [ "system_defined_appitem_test.cpp" ]
279
280  deps = common_deps
281
282  external_deps = common_external_deps
283
284  defines = [
285    "private=public",
286    "protected=public",
287  ]
288}
289
290ohos_unittest("SystemDefinedFormTest") {
291  module_out_path = module_output_path
292
293  sources = [ "system_defined_form_test.cpp" ]
294
295  deps = common_deps
296
297  external_deps = common_external_deps
298
299  defines = [
300    "private=public",
301    "protected=public",
302  ]
303}
304
305ohos_unittest("SystemDefinedPixelMapTest") {
306  module_out_path = module_output_path
307
308  sources = [ "system_defined_pixelmap_test.cpp" ]
309
310  deps = common_deps
311
312  external_deps = common_external_deps
313
314  defines = [
315    "private=public",
316    "protected=public",
317  ]
318}
319
320ohos_unittest("SystemDefinedRecordTest") {
321  module_out_path = module_output_path
322
323  sources = [ "system_defined_record_test.cpp" ]
324
325  deps = common_deps
326
327  external_deps = common_external_deps
328
329  defines = [
330    "private=public",
331    "protected=public",
332  ]
333}
334
335ohos_unittest("TextTest") {
336  module_out_path = module_output_path
337
338  sources = [ "text_test.cpp" ]
339
340  deps = common_deps
341
342  external_deps = common_external_deps
343
344  defines = [
345    "private=public",
346    "protected=public",
347  ]
348}
349
350ohos_unittest("UnifiedDataTest") {
351  module_out_path = module_output_path
352
353  sources = [ "unified_data_test.cpp" ]
354
355  deps = common_deps
356
357  external_deps = common_external_deps
358
359  defines = [
360    "private=public",
361    "protected=public",
362  ]
363}
364
365###############################################################################
366group("unittest") {
367  testonly = true
368
369  deps = [
370    ":ApplicationDefineRecordTest",
371    ":AudioTest",
372    ":FileDataTest",
373    ":FlexibleTypeTest",
374    ":FolderTest",
375    ":HtmlTest",
376    ":ImageTest",
377    ":LinkTest",
378    ":NdkDataConversionTest",
379    ":PlainTextTest",
380    ":SystemDefinedAppitemTest",
381    ":SystemDefinedFormTest",
382    ":SystemDefinedPixelMapTest",
383    ":SystemDefinedRecordTest",
384    ":TextTest",
385    ":UdmfClientHapPermissionTest",
386    ":UdmfClientSystemHapTest",
387    ":UdmfClientTest",
388    ":UnifiedDataTest",
389    ":UtdClientTest",
390  ]
391}
392###############################################################################
393