1# Copyright (c) 2023-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/ohos.gni")
15import("//build/ohos_var.gni")
16import("//build/test.gni")
17import("//foundation/deviceprofile/device_info_manager/deviceprofile.gni")
18
19module_output_path = "device_info_manager/deviceprofiletest"
20
21config("device_profile_test_config") {
22  cflags = [
23    "-Dprivate=public",
24    "-Dprotected=public",
25  ]
26  if (!device_info_manager_switch_static_disable) {
27    cflags += [ "-DDEVICE_PROFILE_SWITCH_STATIC_ENABLE" ]
28  }
29}
30
31device_profile_configs = [
32  "${device_profile_service}:device_info_manager_config",
33  ":device_profile_test_config",
34]
35
36device_profile_deps = [
37  "${device_profile_common}:distributed_device_profile_common",
38  "${device_profile_innerkits}:distributed_device_profile_sdk",
39  "${device_profile_service}:distributed_device_profile_svr",
40]
41
42device_profile_external_deps = [
43  "access_token:libaccesstoken_sdk",
44  "access_token:libnativetoken",
45  "access_token:libtoken_setproc",
46  "cJSON:cjson",
47  "c_utils:utils",
48  "config_policy:configpolicy_util",
49  "device_auth:deviceauth_sdk",
50  "device_manager:devicemanagersdk",
51  "dmsfwk:common_sdk",
52  "eventhandler:libeventhandler",
53  "hilog:libhilog",
54  "hisysevent:libhisysevent",
55  "hitrace:hitrace_meter",
56  "init:libbegetutil",
57  "ipc:ipc_core",
58  "kv_store:distributeddata_inner",
59  "relational_store:native_rdb",
60  "safwk:system_ability_fwk",
61  "samgr:samgr_proxy",
62  "syscap_codec:syscap_interface_shared",
63]
64
65ohos_unittest("rdb_adapter_new_test") {
66  module_out_path = module_output_path
67  sources = [ "unittest/rdb_adapter_test.cpp" ]
68  configs = device_profile_configs
69  deps = device_profile_deps
70  external_deps = device_profile_external_deps
71  part_name = "device_info_manager"
72  subsystem_name = "deviceprofile"
73}
74
75ohos_unittest("TrustProfileManagerTest") {
76  module_out_path = module_output_path
77  sources = [ "unittest/trust_profile_manager_test.cpp" ]
78  configs = device_profile_configs
79  deps = device_profile_deps
80  external_deps = device_profile_external_deps
81  part_name = "device_info_manager"
82  subsystem_name = "deviceprofile"
83}
84
85ohos_unittest("distributed_device_profile_client_kv_new_test") {
86  module_out_path = module_output_path
87  sources = [ "unittest/distributed_device_profile_client_kv_test.cpp" ]
88  configs = device_profile_configs
89  deps = device_profile_deps
90  external_deps = device_profile_external_deps
91  part_name = "device_info_manager"
92  subsystem_name = "deviceprofile"
93}
94
95ohos_unittest("device_profile_manager_new_test") {
96  module_out_path = module_output_path
97  sources = [ "unittest/device_profile_manager_test.cpp" ]
98  configs = device_profile_configs
99  deps = device_profile_deps
100  external_deps = device_profile_external_deps
101  part_name = "device_info_manager"
102  subsystem_name = "deviceprofile"
103}
104
105ohos_unittest("ClientRdbTest") {
106  module_out_path = module_output_path
107  sources = [ "unittest/distributed_device_profile_client_rdb_test.cpp" ]
108  configs = device_profile_configs
109  deps = device_profile_deps
110  external_deps = device_profile_external_deps
111  part_name = "device_info_manager"
112  subsystem_name = "deviceprofile"
113}
114
115ohos_unittest("dp_dumper_new_test") {
116  module_out_path = module_output_path
117  sources = [ "unittest/dp_dumper_test.cpp" ]
118  configs = device_profile_configs
119  deps = device_profile_deps
120  external_deps = device_profile_external_deps
121  part_name = "device_info_manager"
122  subsystem_name = "deviceprofile"
123}
124
125ohos_unittest("profile_cache_new_test") {
126  module_out_path = module_output_path
127  sources = [ "unittest/profile_cache_test.cpp" ]
128  configs = device_profile_configs
129  deps = device_profile_deps
130  external_deps = device_profile_external_deps
131  part_name = "device_info_manager"
132  subsystem_name = "deviceprofile"
133}
134
135ohos_unittest("profile_utils_new_test") {
136  module_out_path = module_output_path
137  sources = [ "unittest/profile_utils_test.cpp" ]
138  configs = device_profile_configs
139  deps = device_profile_deps
140  external_deps = device_profile_external_deps
141  part_name = "device_info_manager"
142  subsystem_name = "deviceprofile"
143}
144
145ohos_unittest("kv_adapter_new_test") {
146  module_out_path = module_output_path
147  sources = [ "unittest/kv_adapter_test.cpp" ]
148  configs = device_profile_configs
149  deps = device_profile_deps
150  external_deps = device_profile_external_deps
151  part_name = "device_info_manager"
152  subsystem_name = "deviceprofile"
153}
154
155ohos_unittest("event_handler_factory_new_test") {
156  module_out_path = module_output_path
157  sources = [ "unittest/event_handler_factory_test.cpp" ]
158  configs = device_profile_configs
159  deps = device_profile_deps
160  external_deps = device_profile_external_deps
161  part_name = "device_info_manager"
162  subsystem_name = "deviceprofile"
163}
164
165ohos_unittest("sync_options_new_test") {
166  module_out_path = module_output_path
167  sources = [ "unittest/sync_options_test.cpp" ]
168  configs = device_profile_configs
169  deps = device_profile_deps
170  external_deps = device_profile_external_deps
171  part_name = "device_info_manager"
172  subsystem_name = "deviceprofile"
173}
174
175ohos_unittest("DPSubscribeInfoTest") {
176  module_out_path = module_output_path
177  sources = [ "unittest/dp_subscribe_info_test.cpp" ]
178  configs = device_profile_configs
179  deps = device_profile_deps
180  external_deps = device_profile_external_deps
181  part_name = "device_info_manager"
182  subsystem_name = "deviceprofile"
183}
184
185ohos_unittest("PermissionManagerTest") {
186  module_out_path = module_output_path
187  sources = [ "unittest/permission_manager_test.cpp" ]
188  configs = device_profile_configs
189  deps = device_profile_deps
190  external_deps = device_profile_external_deps
191  part_name = "device_info_manager"
192  subsystem_name = "deviceprofile"
193}
194
195ohos_unittest("IpcUtilsTest") {
196  module_out_path = module_output_path
197  sources = [ "unittest/ipc_utils_test.cpp" ]
198  configs = device_profile_configs
199  deps = device_profile_deps
200  external_deps = device_profile_external_deps
201  part_name = "device_info_manager"
202  subsystem_name = "deviceprofile"
203}
204
205ohos_unittest("content_sensor_manager_test") {
206  module_out_path = module_output_path
207  sources = [ "unittest/content_sensor_manager_test.cpp" ]
208  configs = device_profile_configs
209  deps = device_profile_deps
210  external_deps = device_profile_external_deps
211  part_name = "device_info_manager"
212  subsystem_name = "deviceprofile"
213}
214
215ohos_unittest("content_sensor_pasteboard_info_test") {
216  module_out_path = module_output_path
217  sources = [ "unittest/content_sensor_pasteboard_info_test.cpp" ]
218  configs = device_profile_configs
219  deps = device_profile_deps
220  external_deps = device_profile_external_deps
221  part_name = "device_info_manager"
222  subsystem_name = "deviceprofile"
223}
224
225ohos_unittest("kv_store_death_recipient_test") {
226  module_out_path = module_output_path
227  sources = [ "unittest/kv_store_death_recipient_test.cpp" ]
228  configs = device_profile_configs
229  deps = device_profile_deps
230  external_deps = device_profile_external_deps
231  part_name = "device_info_manager"
232  subsystem_name = "deviceprofile"
233}
234
235ohos_unittest("kv_sync_completed_listener_test") {
236  module_out_path = module_output_path
237  sources = [ "unittest/kv_sync_completed_listener_test.cpp" ]
238  configs = device_profile_configs
239  deps = device_profile_deps
240  external_deps = device_profile_external_deps
241  part_name = "device_info_manager"
242  subsystem_name = "deviceprofile"
243}
244
245ohos_unittest("sync_subscriber_death_recipient_test") {
246  module_out_path = module_output_path
247  sources = [ "unittest/sync_subscriber_death_recipient_test.cpp" ]
248  configs = device_profile_configs
249  deps = device_profile_deps
250  external_deps = device_profile_external_deps
251  part_name = "device_info_manager"
252  subsystem_name = "deviceprofile"
253}
254
255ohos_unittest("dp_content_sensor_test") {
256  module_out_path = module_output_path
257  sources = [ "unittest/dp_content_sensor_test.cpp" ]
258  configs = device_profile_configs
259  deps = device_profile_deps
260  external_deps = device_profile_external_deps
261  part_name = "device_info_manager"
262  subsystem_name = "deviceprofile"
263}
264
265ohos_unittest("ProfileChangeListenerProxyTest") {
266  module_out_path = module_output_path
267  sources = [ "unittest/profile_change_listener_proxy_test.cpp" ]
268  configs = device_profile_configs
269  deps = device_profile_deps
270  external_deps = device_profile_external_deps
271  part_name = "device_info_manager"
272  subsystem_name = "deviceprofile"
273}
274
275ohos_unittest("device_profile_locd_callback_test") {
276  module_out_path = module_output_path
277  sources = [ "unittest/device_profile_locd_callback_test.cpp" ]
278  configs = device_profile_configs
279  deps = device_profile_deps
280  external_deps = device_profile_external_deps
281  part_name = "device_info_manager"
282  subsystem_name = "deviceprofile"
283}
284
285ohos_unittest("subscribe_profile_manager_test") {
286  module_out_path = module_output_path
287  sources = [ "unittest/subscribe_profile_manager_test.cpp" ]
288  configs = device_profile_configs
289  deps = device_profile_deps
290  external_deps = device_profile_external_deps
291  part_name = "device_info_manager"
292  subsystem_name = "deviceprofile"
293}
294
295ohos_unittest("sync_completed_callback_test") {
296  module_out_path = module_output_path
297  sources = [ "unittest/sync_completed_callback_test.cpp" ]
298  configs = device_profile_configs
299  deps = device_profile_deps
300  external_deps = device_profile_external_deps
301  part_name = "device_info_manager"
302  subsystem_name = "deviceprofile"
303}
304
305ohos_unittest("dp_profile_service_new_test") {
306  module_out_path = module_output_path
307  sources = [ "unittest/dp_profile_service_test.cpp" ]
308  configs = device_profile_configs
309  deps = device_profile_deps
310  external_deps = device_profile_external_deps
311  part_name = "device_info_manager"
312  subsystem_name = "deviceprofile"
313}
314
315ohos_unittest("dp_dm_adapter_test") {
316  module_out_path = module_output_path
317  sources = [ "unittest/dm_adapter_test.cpp" ]
318  configs = device_profile_configs
319  deps = device_profile_deps
320  external_deps = device_profile_external_deps
321  part_name = "device_info_manager"
322  subsystem_name = "deviceprofile"
323}
324
325ohos_unittest("distributed_device_profile_stub_new_test") {
326  module_out_path = module_output_path
327  sources = [ "unittest/distributed_device_profile_stub_new_test.cpp" ]
328  configs = device_profile_configs
329  deps = device_profile_deps
330  external_deps = device_profile_external_deps
331  part_name = "device_info_manager"
332  subsystem_name = "deviceprofile"
333  cflags = [
334    "-Dprivate=public",
335    "-Dprotected=public",
336  ]
337}
338
339ohos_unittest("content_sensor_manager_utils_test") {
340  module_out_path = module_output_path
341  sources = [ "unittest/content_sensor_manager_utils_test.cpp" ]
342  configs = device_profile_configs
343  deps = device_profile_deps
344  external_deps = device_profile_external_deps
345  part_name = "device_info_manager"
346  subsystem_name = "deviceprofile"
347}
348
349ohos_unittest("static_capability_collector_test") {
350  module_out_path = module_output_path
351  sources = [ "unittest/static_capability_collector_test.cpp" ]
352  configs = device_profile_configs
353  deps = device_profile_deps
354  external_deps = device_profile_external_deps
355  part_name = "device_info_manager"
356  subsystem_name = "deviceprofile"
357}
358
359ohos_unittest("static_capability_loader_test") {
360  module_out_path = module_output_path
361  sources = [ "unittest/static_capability_loader_test.cpp" ]
362  configs = device_profile_configs
363  deps = device_profile_deps
364  external_deps = device_profile_external_deps
365  part_name = "device_info_manager"
366  subsystem_name = "deviceprofile"
367}
368
369ohos_unittest("switch_adapter_test") {
370  module_out_path = module_output_path
371  sources = [ "unittest/switch_adapter_test.cpp" ]
372  configs = device_profile_configs
373  deps = device_profile_deps
374  external_deps = device_profile_external_deps
375  part_name = "device_info_manager"
376  subsystem_name = "deviceprofile"
377}
378
379ohos_unittest("profile_control_utils_test") {
380  module_out_path = module_output_path
381  sources = [ "unittest/profile_control_utils_test.cpp" ]
382  configs = device_profile_configs
383  deps = device_profile_deps
384  external_deps = device_profile_external_deps
385  part_name = "device_info_manager"
386  subsystem_name = "deviceprofile"
387}
388
389ohos_unittest("static_profile_manager_test") {
390  module_out_path = module_output_path
391  sources = [ "unittest/static_profile_manager_test.cpp" ]
392  configs = device_profile_configs
393  deps = device_profile_deps
394  external_deps = device_profile_external_deps
395  part_name = "device_info_manager"
396  subsystem_name = "deviceprofile"
397}
398
399ohos_unittest("switch_profile_manager_test") {
400  module_out_path = module_output_path
401  sources = [ "unittest/switch_profile_manager_test.cpp" ]
402  configs = device_profile_configs
403  deps = device_profile_deps
404  external_deps = device_profile_external_deps
405  part_name = "device_info_manager"
406  subsystem_name = "deviceprofile"
407}
408
409ohos_unittest("trust_Device_Profile_test") {
410  module_out_path = module_output_path
411  sources = [ "unittest/trust_device_profile_test.cpp" ]
412  configs = device_profile_configs
413  deps = device_profile_deps
414  external_deps = device_profile_external_deps
415  part_name = "device_info_manager"
416  subsystem_name = "deviceprofile"
417}
418
419group("unittest") {
420  testonly = true
421  deps = [
422    ":ClientRdbTest",
423    ":DPSubscribeInfoTest",
424    ":IpcUtilsTest",
425    ":PermissionManagerTest",
426    ":ProfileChangeListenerProxyTest",
427    ":TrustProfileManagerTest",
428    ":content_sensor_manager_test",
429    ":content_sensor_manager_utils_test",
430    ":content_sensor_pasteboard_info_test",
431    ":device_profile_locd_callback_test",
432    ":device_profile_manager_new_test",
433    ":distributed_device_profile_client_kv_new_test",
434    ":distributed_device_profile_stub_new_test",
435    ":dp_content_sensor_test",
436    ":dp_dm_adapter_test",
437    ":dp_dumper_new_test",
438    ":dp_profile_service_new_test",
439    ":event_handler_factory_new_test",
440    ":kv_adapter_new_test",
441    ":kv_store_death_recipient_test",
442    ":kv_sync_completed_listener_test",
443    ":profile_cache_new_test",
444    ":profile_control_utils_test",
445    ":profile_utils_new_test",
446    ":rdb_adapter_new_test",
447    ":static_capability_collector_test",
448    ":static_capability_loader_test",
449    ":static_profile_manager_test",
450    ":subscribe_profile_manager_test",
451    ":switch_adapter_test",
452    ":switch_profile_manager_test",
453    ":sync_completed_callback_test",
454    ":sync_options_new_test",
455    ":sync_subscriber_death_recipient_test",
456    ":trust_Device_Profile_test",
457  ]
458}
459