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("../../../core/authentication/authentication.gni")
16import("../../../dsoftbus.gni")
17import("unittest/authmanager.gni")
18
19module_output_path = "dsoftbus/auth"
20
21ohos_unittest("AuthTest") {
22  module_out_path = module_output_path
23  sources = [ "unittest/auth_test.cpp" ]
24
25  include_dirs = [
26    "$dsoftbus_root_path/core/authentication/include",
27    "$dsoftbus_root_path/core/authentication/interface",
28    "$dsoftbus_root_path/core/bus_center/interface",
29    "$dsoftbus_root_path/core/bus_center/service/include",
30    "$dsoftbus_root_path/core/bus_center/utils/include",
31    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
32    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
33    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
34    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
35    "$dsoftbus_root_path/core/common/include",
36    "$dsoftbus_root_path/core/common/message_handler/include",
37    "$dsoftbus_root_path/core/connection/interface",
38    "$dsoftbus_root_path/core/frame/$os_type/init/include",
39    "$dsoftbus_root_path/core/frame/common/include",
40    "$dsoftbus_root_path/interfaces/kits/bus_center",
41    "$dsoftbus_root_path/interfaces/kits/common",
42    "$dsoftbus_root_path/core/connection/manager",
43    "$dsoftbus_root_path/adapter/common/include/",
44    "$dsoftbus_root_path/tests/sdk/common/include",
45    "unittest/common/",
46    "$dsoftbus_root_path/core/authentication/src",
47    "$dsoftbus_root_path/core/discovery/manager/include",
48    "$dsoftbus_root_path/core/discovery/interface",
49    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
50    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
51    "$dsoftbus_root_path/core/adapter/bus_center/include",
52    "$dsoftbus_root_path/core/transmission/trans_channel/manager/include",
53    "$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
54  ]
55
56  deps = [
57    "$dsoftbus_root_path/core/common:softbus_utils",
58    "$dsoftbus_root_path/core/frame:softbus_server",
59    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
60  ]
61
62  if (is_standard_system) {
63    external_deps = [
64      "bounds_checking_function:libsec_shared",
65      "cJSON:cjson",
66      "c_utils:utils",
67      "device_auth:deviceauth_sdk",
68      "googletest:gtest_main",
69      "hilog:libhilog",
70    ]
71  } else {
72    external_deps = [
73      "bounds_checking_function:libsec_shared",
74      "cJSON:cjson",
75      "c_utils:utils",
76      "googletest:gtest_main",
77      "hilog:libhilog",
78    ]
79  }
80}
81
82ohos_unittest("AuthEnhanceMockTest") {
83  module_out_path = module_output_path
84  sanitize = {
85    cfi = true
86    cfi_cross_dso = true
87    debug = false
88  }
89  sources = [
90    "$dsoftbus_root_path/core/adapter/authentication/src/lnn_extdata_config_virtual.c",
91    "$dsoftbus_root_path/core/adapter/bus_center/src/lnn_ohos_account_adapter_virtual.cpp",
92    "$dsoftbus_root_path/core/adapter/bus_center/src/lnn_settingdata_event_monitor_virtual.cpp",
93    "$dsoftbus_root_path/core/authentication/bind/auth_device_profile_listener_virtual.cpp",
94    "$dsoftbus_root_path/core/authentication/src/auth_common.c",
95    "$dsoftbus_root_path/core/authentication/src/auth_connection.c",
96    "$dsoftbus_root_path/core/authentication/src/auth_device.c",
97    "$dsoftbus_root_path/core/authentication/src/auth_deviceprofile_virtual.cpp",
98    "$dsoftbus_root_path/core/authentication/src/auth_hichain.c",
99    "$dsoftbus_root_path/core/authentication/src/auth_hichain_adapter.c",
100    "$dsoftbus_root_path/core/authentication/src/auth_interface.c",
101    "$dsoftbus_root_path/core/authentication/src/auth_lane.c",
102    "$dsoftbus_root_path/core/authentication/src/auth_manager.c",
103    "$dsoftbus_root_path/core/authentication/src/auth_normalize_request.c",
104    "$dsoftbus_root_path/core/authentication/src/auth_request.c",
105    "$dsoftbus_root_path/core/authentication/src/auth_session_fsm.c",
106    "$dsoftbus_root_path/core/authentication/src/auth_session_json.c",
107    "$dsoftbus_root_path/core/authentication/src/auth_session_key.c",
108    "$dsoftbus_root_path/core/authentication/src/auth_session_message.c",
109    "$dsoftbus_root_path/core/authentication/src/auth_tcp_connection.c",
110    "$dsoftbus_root_path/core/authentication/src/virtual/auth_attest_virtual.c",
111    "$dsoftbus_root_path/core/authentication/src/virtual/auth_device_common_key_virtual.c",
112    "$dsoftbus_root_path/core/authentication/src/virtual/auth_hichain_system_ability_monitor_virtual.c",
113    "$dsoftbus_root_path/core/authentication/src/virtual/auth_meta_manager_virtual.c",
114    "$dsoftbus_root_path/core/authentication/src/virtual/customized_security_protocol_virtual.c",
115    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_cipherkey_manager_virtual.c",
116    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_device_info_recovery_virtual.c",
117    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_ptk_info_virtual.c",
118    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/src/lnn_feature_capability.c",
119    "$dsoftbus_root_path/core/bus_center/utils/src/lnn_compress_virtual.c",
120    "$dsoftbus_root_path/core/bus_center/utils/src/lnn_map.c",
121    "$dsoftbus_root_path/core/bus_center/utils/src/lnn_state_machine.c",
122    "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/lnn_connection_mock.cpp",
123    "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/lnn_hichain_mock.cpp",
124    "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/lnn_socket_mock.cpp",
125    "unittest/auth_common_mock.cpp",
126    "unittest/auth_net_ledger_mock.cpp",
127    "unittest/auth_test_enhance.cpp",
128  ]
129
130  include_dirs = [
131    "$dsoftbus_root_path/adapter/common/include",
132    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
133    "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
134    "$dsoftbus_root_path/core/authentication/include",
135    "$dsoftbus_root_path/core/authentication/interface",
136    "$dsoftbus_root_path/core/bus_center/interface",
137    "$dsoftbus_root_path/core/bus_center/utils/include",
138    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
139    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
140    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
141    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
142    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
143    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
144    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
145    "$dsoftbus_root_path/core/common/include",
146    "$dsoftbus_root_path/core/common/dfx/interface/include",
147    "$dsoftbus_root_path/core/common/message_handler/include",
148    "$dsoftbus_root_path/core/connection/interface",
149    "$dsoftbus_root_path/core/connection/p2p/interface",
150    "$dsoftbus_root_path/core/connection/p2p/common/include",
151    "$dsoftbus_root_path/core/frame/$os_type/init/include",
152    "$dsoftbus_root_path/core/frame/common/include",
153    "$dsoftbus_root_path/core/discovery/manager/include",
154    "$dsoftbus_root_path/core/discovery/interface",
155    "$dsoftbus_root_path/interfaces/inner_kits/lnn",
156    "$dsoftbus_root_path/interfaces/kits/bus_center",
157    "$dsoftbus_root_path/interfaces/kits/discovery",
158    "$dsoftbus_root_path/interfaces/kits/common",
159    "$dsoftbus_root_path/core/connection/manager",
160    "$dsoftbus_root_path/adapter/common/include/",
161    "$dsoftbus_root_path/tests/sdk/common/include",
162    "unittest/common/",
163    "$dsoftbus_root_path/core/authentication/src",
164    "$dsoftbus_root_path/core/discovery/manager/include",
165    "$dsoftbus_root_path/core/discovery/interface",
166    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
167    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
168    "$dsoftbus_root_path/core/adapter/bus_center/include",
169    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
170    "$dsoftbus_root_path/core/adapter/authentication/include",
171    "$dsoftbus_root_path/core/bus_center/service/include",
172    "$dsoftbus_root_path/core/connection/ble/include",
173    "$dsoftbus_root_path/core/connection/wifi_direct_cpp",
174    "$dsoftbus_root_path/core/transmission/trans_channel/manager/include",
175    "$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
176  ]
177
178  deps = [
179    "$dsoftbus_root_path/adapter:softbus_adapter",
180    "$dsoftbus_root_path/core/common:softbus_utils",
181    "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log",
182    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
183  ]
184
185  if (is_standard_system) {
186    external_deps = [
187      "bounds_checking_function:libsec_shared",
188      "cJSON:cjson",
189      "c_utils:utils",
190      "device_auth:deviceauth_sdk",
191      "googletest:gmock",
192      "googletest:gtest_main",
193      "hilog:libhilog",
194    ]
195  } else {
196    external_deps = [
197      "bounds_checking_function:libsec_shared",
198      "cJSON:cjson",
199      "c_utils:utils",
200      "googletest:gmock",
201      "googletest:gtest_main",
202      "hilog:libhilog",
203    ]
204  }
205}
206
207ohos_unittest("AuthTestCallBackTest") {
208  module_out_path = module_output_path
209  sources = [
210    "$dsoftbus_root_path/core/adapter/authentication/src/lnn_extdata_config_virtual.c",
211    "$dsoftbus_root_path/core/authentication/src/auth_common.c",
212    "$dsoftbus_root_path/core/authentication/src/auth_connection.c",
213    "$dsoftbus_root_path/core/authentication/src/auth_device.c",
214    "$dsoftbus_root_path/core/authentication/src/auth_deviceprofile_virtual.cpp",
215    "$dsoftbus_root_path/core/authentication/src/auth_hichain.c",
216    "$dsoftbus_root_path/core/authentication/src/auth_hichain_adapter.c",
217    "$dsoftbus_root_path/core/authentication/src/auth_interface.c",
218    "$dsoftbus_root_path/core/authentication/src/auth_lane.c",
219    "$dsoftbus_root_path/core/authentication/src/auth_manager.c",
220    "$dsoftbus_root_path/core/authentication/src/auth_request.c",
221    "$dsoftbus_root_path/core/authentication/src/auth_session_fsm.c",
222    "$dsoftbus_root_path/core/authentication/src/auth_session_json.c",
223    "$dsoftbus_root_path/core/authentication/src/auth_session_key.c",
224    "$dsoftbus_root_path/core/authentication/src/auth_session_message.c",
225    "$dsoftbus_root_path/core/authentication/src/auth_tcp_connection.c",
226    "$dsoftbus_root_path/core/authentication/src/virtual/auth_device_common_key_virtual.c",
227    "$dsoftbus_root_path/core/authentication/src/virtual/auth_meta_manager_virtual.c",
228    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_cipherkey_manager_virtual.c",
229    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_device_info_recovery_virtual.c",
230    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/src/lnn_feature_capability.c",
231    "$dsoftbus_root_path/core/bus_center/utils/src/lnn_compress_virtual.c",
232    "$dsoftbus_root_path/core/bus_center/utils/src/lnn_state_machine.c",
233    "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/lnn_connection_mock.cpp",
234    "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/lnn_hichain_mock.cpp",
235    "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/lnn_socket_mock.cpp",
236    "unittest/auth_common_mock.cpp",
237    "unittest/auth_net_ledger_mock.cpp",
238    "unittest/auth_test_mock.cpp",
239  ]
240
241  include_dirs = [
242    "$dsoftbus_root_path/adapter/common/include",
243    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
244    "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
245    "$dsoftbus_root_path/core/authentication/include",
246    "$dsoftbus_root_path/core/authentication/interface",
247    "$dsoftbus_root_path/core/bus_center/interface",
248    "$dsoftbus_root_path/core/bus_center/utils/include",
249    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
250    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
251    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
252    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
253    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
254    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
255    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
256    "$dsoftbus_root_path/core/common/include",
257    "$dsoftbus_root_path/core/common/message_handler/include",
258    "$dsoftbus_root_path/core/connection/interface",
259    "$dsoftbus_root_path/core/connection/p2p/interface",
260    "$dsoftbus_root_path/core/connection/p2p/common/include",
261    "$dsoftbus_root_path/core/frame/$os_type/init/include",
262    "$dsoftbus_root_path/core/frame/common/include",
263    "$dsoftbus_root_path/core/discovery/manager/include",
264    "$dsoftbus_root_path/core/discovery/interface",
265    "$dsoftbus_root_path/interfaces/inner_kits/transport",
266    "$dsoftbus_root_path/interfaces/kits/bus_center",
267    "$dsoftbus_root_path/interfaces/kits/discovery",
268    "$dsoftbus_root_path/interfaces/kits/common",
269    "$dsoftbus_root_path/core/connection/manager",
270    "$dsoftbus_root_path/adapter/common/include/",
271    "$dsoftbus_root_path/tests/sdk/common/include",
272    "unittest/common/",
273    "$dsoftbus_root_path/core/authentication/src",
274    "$dsoftbus_root_path/core/discovery/manager/include",
275    "$dsoftbus_root_path/core/discovery/interface",
276    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
277    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
278    "$dsoftbus_root_path/core/adapter/bus_center/include",
279    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
280    "$dsoftbus_root_path/core/bus_center/service/include",
281    "$dsoftbus_root_path/core/adapter/authentication/include",
282    "$dsoftbus_root_path/core/connection/ble/include",
283    "$dsoftbus_root_path/core/connection/wifi_direct_cpp",
284    "$dsoftbus_root_path/core/transmission/trans_channel/manager/include",
285    "$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
286  ]
287
288  deps = [
289    "$dsoftbus_root_path/adapter:softbus_adapter",
290    "$dsoftbus_root_path/core/common:softbus_utils",
291    "$dsoftbus_root_path/core/frame:softbus_server",
292    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
293  ]
294  if (is_standard_system) {
295    external_deps = [
296      "bounds_checking_function:libsec_shared",
297      "cJSON:cjson",
298      "c_utils:utils",
299      "device_auth:deviceauth_sdk",
300      "googletest:gmock",
301      "googletest:gtest_main",
302      "hilog:libhilog",
303    ]
304  } else {
305    external_deps = [
306      "bounds_checking_function:libsec_shared",
307      "cJSON:cjson",
308      "c_utils:utils",
309      "googletest:gmock",
310      "googletest:gtest_main",
311      "hilog:libhilog",
312    ]
313  }
314}
315
316ohos_unittest("AuthOtherTest") {
317  module_out_path = module_output_path
318  sources = [
319    "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/lnn_connection_mock.cpp",
320    "unittest/auth_other_test.cpp",
321    "unittest/auth_tcp_connection_mock.cpp",
322  ]
323
324  include_dirs = [
325    "$dsoftbus_root_path/core/authentication/include",
326    "$dsoftbus_root_path/core/authentication/interface",
327    "$dsoftbus_root_path/core/bus_center/interface",
328    "$dsoftbus_root_path/core/bus_center/utils/include",
329    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
330    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
331    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
332    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
333    "$dsoftbus_root_path/core/common/include",
334    "$dsoftbus_root_path/core/common/message_handler/include",
335    "$dsoftbus_root_path/core/connection/interface",
336    "$dsoftbus_root_path/core/frame/$os_type/init/include",
337    "$dsoftbus_root_path/core/frame/common/include",
338    "$dsoftbus_root_path/interfaces/kits/bus_center",
339    "$dsoftbus_root_path/interfaces/kits/common",
340    "$dsoftbus_root_path/core/connection/manager",
341    "$dsoftbus_root_path/adapter/common/include/",
342    "$dsoftbus_root_path/tests/sdk/common/include",
343    "unittest/common/",
344    "$dsoftbus_root_path/core/authentication/src",
345    "$dsoftbus_root_path/core/discovery/manager/include",
346    "$dsoftbus_root_path/core/discovery/interface",
347    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
348    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
349    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
350    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
351    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
352    "$dsoftbus_root_path/core/adapter/bus_center/include",
353    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
354    "$dsoftbus_root_path/core/bus_center/service/include",
355    "$dsoftbus_root_path/core/adapter/authentication/include",
356    "$dsoftbus_root_path/core/connection/wifi_direct_cpp",
357    "$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
358    "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
359  ]
360
361  deps = [
362    "$dsoftbus_root_path/core/common:softbus_utils",
363    "$dsoftbus_root_path/core/frame:softbus_server",
364    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
365  ]
366
367  if (is_standard_system) {
368    external_deps = [
369      "bounds_checking_function:libsec_shared",
370      "cJSON:cjson",
371      "c_utils:utils",
372      "device_auth:deviceauth_sdk",
373      "googletest:gmock",
374      "googletest:gtest_main",
375      "hilog:libhilog",
376    ]
377  } else {
378    external_deps = [
379      "bounds_checking_function:libsec_shared",
380      "cJSON:cjson",
381      "c_utils:utils",
382      "googletest:gmock",
383      "googletest:gtest_main",
384      "hilog:libhilog",
385    ]
386  }
387}
388
389ohos_unittest("AuthTcpConnectionTest") {
390  module_out_path = module_output_path
391  sources = [ "unittest/auth_tcp_connection_test.cpp" ]
392
393  include_dirs = [
394    "$dsoftbus_root_path/core/authentication/include",
395    "$dsoftbus_root_path/core/authentication/interface",
396    "$dsoftbus_root_path/core/bus_center/interface",
397    "$dsoftbus_root_path/core/bus_center/utils/include",
398    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
399    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
400    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
401    "$dsoftbus_root_path/core/common/include",
402    "$dsoftbus_root_path/core/common/message_handler/include",
403    "$dsoftbus_root_path/core/connection/interface",
404    "$dsoftbus_root_path/core/frame/$os_type/init/include",
405    "$dsoftbus_root_path/core/frame/common/include",
406    "$dsoftbus_root_path/interfaces/kits/bus_center",
407    "$dsoftbus_root_path/interfaces/kits/common",
408    "$dsoftbus_root_path/core/connection/manager",
409    "$dsoftbus_root_path/adapter/common/include/",
410    "$dsoftbus_root_path/tests/sdk/common/include",
411    "unittest/common/",
412    "$dsoftbus_root_path/core/authentication/src",
413    "$dsoftbus_root_path/core/discovery/manager/include",
414    "$dsoftbus_root_path/core/discovery/interface",
415    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
416    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
417    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
418    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
419    "$dsoftbus_root_path/core/transmission/trans_channel/manager/include",
420  ]
421
422  deps = [
423    "$dsoftbus_root_path/core/common:softbus_utils",
424    "$dsoftbus_root_path/core/frame:softbus_server",
425    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
426  ]
427
428  if (is_standard_system) {
429    external_deps = [
430      "bounds_checking_function:libsec_shared",
431      "cJSON:cjson",
432      "c_utils:utils",
433      "device_auth:deviceauth_sdk",
434      "googletest:gtest_main",
435      "hilog:libhilog",
436    ]
437  } else {
438    external_deps = [
439      "bounds_checking_function:libsec_shared",
440      "cJSON:cjson",
441      "c_utils:utils",
442      "googletest:gtest_main",
443      "hilog:libhilog",
444    ]
445  }
446}
447
448ohos_unittest("AuthHichainTest") {
449  module_out_path = module_output_path
450  sources = [
451    "$dsoftbus_root_path/tests/core/authentication/unittest/auth_common_mock.cpp",
452    "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/lnn_hichain_mock.cpp",
453    "unittest/auth_hichain_test.cpp",
454    "unittest/auth_net_ledger_mock.cpp",
455  ]
456
457  include_dirs = [
458    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
459    "$dsoftbus_root_path/core/authentication/include",
460    "$dsoftbus_root_path/core/authentication/interface",
461    "$dsoftbus_root_path/tests/core/authentication/unittest",
462    "$dsoftbus_root_path/core/bus_center/interface",
463    "$dsoftbus_root_path/core/bus_center/utils/include",
464    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
465    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
466    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
467    "$dsoftbus_root_path/core/common/include",
468    "$dsoftbus_root_path/core/common/message_handler/include",
469    "$dsoftbus_root_path/core/connection/interface",
470    "$dsoftbus_root_path/core/frame/$os_type/init/include",
471    "$dsoftbus_root_path/core/frame/common/include",
472    "$dsoftbus_root_path/interfaces/inner_kits/transport",
473    "$dsoftbus_root_path/interfaces/kits/bus_center",
474    "$dsoftbus_root_path/interfaces/kits/common",
475    "$dsoftbus_root_path/interfaces/kits/discovery",
476    "$dsoftbus_root_path/core/connection/manager",
477    "$dsoftbus_root_path/adapter/common/include/",
478    "$dsoftbus_root_path/tests/sdk/common/include",
479    "unittest/common/",
480    "$dsoftbus_root_path/core/authentication/src",
481    "$dsoftbus_root_path/core/discovery/manager/include",
482    "$dsoftbus_root_path/core/discovery/interface",
483    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
484    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
485    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
486    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
487    "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
488    "$dsoftbus_root_path/core/adapter/bus_center/include",
489  ]
490
491  deps = [
492    "$dsoftbus_root_path/core/common:softbus_utils",
493    "$dsoftbus_root_path/core/frame:softbus_server",
494    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
495  ]
496
497  if (is_standard_system) {
498    external_deps = [
499      "bounds_checking_function:libsec_shared",
500      "cJSON:cjson",
501      "c_utils:utils",
502      "device_auth:deviceauth_sdk",
503      "googletest:gmock",
504      "googletest:gtest_main",
505      "hilog:libhilog",
506    ]
507  } else {
508    external_deps = [
509      "bounds_checking_function:libsec_shared",
510      "cJSON:cjson",
511      "c_utils:utils",
512      "googletest:gmock",
513      "googletest:gtest_main",
514      "hilog:libhilog",
515    ]
516  }
517}
518
519ohos_unittest("AuthDeviceProfileTest") {
520  module_out_path = module_output_path
521  sources = [ "unittest/auth_device_profile_test.cpp" ]
522
523  include_dirs = [
524    "$dsoftbus_root_path/interfaces/kits",
525    "$dsoftbus_root_path/core/authentication/interface",
526    "$dsoftbus_root_path/core/authentication/include",
527    "unittest/common/",
528  ]
529
530  deps = [
531    "$dsoftbus_root_path/core/common:softbus_utils",
532    "$dsoftbus_root_path/core/frame:softbus_server",
533  ]
534
535  if (!defined(global_parts_info) ||
536      defined(global_parts_info.deviceprofile_device_info_manager)) {
537    external_deps = [
538      "bounds_checking_function:libsec_shared",
539      "cJSON:cjson",
540      "c_utils:utils",
541      "device_auth:deviceauth_sdk",
542      "device_info_manager:distributed_device_profile_common",
543      "device_info_manager:distributed_device_profile_sdk",
544      "googletest:gmock",
545      "googletest:gtest_main",
546      "hilog:libhilog",
547      "ipc:ipc_core",
548    ]
549  } else {
550    external_deps = [
551      "bounds_checking_function:libsec_shared",
552      "cJSON:cjson",
553      "c_utils:utils",
554      "googletest:gmock",
555      "googletest:gtest_main",
556      "hilog:libhilog",
557      "ipc:ipc_core",
558    ]
559  }
560}
561
562ohos_unittest("AuthSessionMessageTest") {
563  module_out_path = module_output_path
564  sources = [ "unittest/auth_session_message_test.cpp" ]
565
566  include_dirs = [
567    "$dsoftbus_root_path/core/authentication/include",
568    "$dsoftbus_root_path/core/authentication/interface",
569    "$dsoftbus_root_path/core/bus_center/interface",
570    "$dsoftbus_root_path/core/bus_center/utils/include",
571    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
572    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
573    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
574    "$dsoftbus_root_path/core/common/include",
575    "$dsoftbus_root_path/core/common/message_handler/include",
576    "$dsoftbus_root_path/core/connection/interface",
577    "$dsoftbus_root_path/core/frame/$os_type/init/include",
578    "$dsoftbus_root_path/core/frame/common/include",
579    "$dsoftbus_root_path/interfaces/kits/bus_center",
580    "$dsoftbus_root_path/interfaces/kits/common",
581    "$dsoftbus_root_path/core/connection/manager",
582    "$dsoftbus_root_path/adapter/common/include/",
583    "$dsoftbus_root_path/tests/sdk/common/include",
584    "unittest/common/",
585    "$dsoftbus_root_path/core/authentication/src",
586    "$dsoftbus_root_path/core/discovery/manager/include",
587    "$dsoftbus_root_path/core/discovery/interface",
588    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
589    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
590    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
591    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
592    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
593    "$dsoftbus_root_path/core/adapter/bus_center/include",
594    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
595    "$dsoftbus_root_path/core/bus_center/service/include",
596    "$dsoftbus_root_path/core/adapter/authentication/include",
597  ]
598
599  deps = [
600    "$dsoftbus_root_path/core/common:softbus_utils",
601    "$dsoftbus_root_path/core/frame:softbus_server",
602    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
603  ]
604
605  if (is_standard_system) {
606    external_deps = [
607      "bounds_checking_function:libsec_shared",
608      "cJSON:cjson",
609      "c_utils:utils",
610      "device_auth:deviceauth_sdk",
611      "googletest:gtest_main",
612      "hilog:libhilog",
613    ]
614  } else {
615    external_deps = [
616      "bounds_checking_function:libsec_shared",
617      "cJSON:cjson",
618      "c_utils:utils",
619      "googletest:gtest_main",
620      "hilog:libhilog",
621    ]
622  }
623}
624
625ohos_unittest("AuthManagerTest") {
626  module_out_path = module_output_path
627  sources = auth_manager_source
628
629  include_dirs = auth_manager_include
630
631  deps = [
632    "$dsoftbus_root_path/core/common:softbus_utils",
633    "$dsoftbus_root_path/core/frame:softbus_server",
634    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
635  ]
636
637  if (is_standard_system) {
638    external_deps = [
639      "bounds_checking_function:libsec_shared",
640      "cJSON:cjson",
641      "c_utils:utils",
642      "device_auth:deviceauth_sdk",
643      "googletest:gmock",
644      "googletest:gtest_main",
645      "hilog:libhilog",
646    ]
647  } else {
648    external_deps = [
649      "bounds_checking_function:libsec_shared",
650      "cJSON:cjson",
651      "c_utils:utils",
652      "device_auth:deviceauth_sdk",
653      "googletest:gmock",
654      "googletest:gtest_main",
655      "hilog:libhilog",
656    ]
657  }
658}
659
660ohos_unittest("AuthSessionFsmTest") {
661  module_out_path = module_output_path
662  sources = [
663    "$dsoftbus_root_path/tests/core/discovery/ble/softbus_ble_mock/ble_mock.cpp",
664    "unittest/auth_session_fsm_test.cpp",
665  ]
666
667  include_dirs = [
668    "$dsoftbus_root_path/core/authentication/include",
669    "$dsoftbus_root_path/core/authentication/interface",
670    "$dsoftbus_root_path/core/bus_center/interface",
671    "$dsoftbus_root_path/core/bus_center/utils/include",
672    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
673    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
674    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
675    "$dsoftbus_root_path/core/common/include",
676    "$dsoftbus_root_path/core/common/message_handler/include",
677    "$dsoftbus_root_path/core/connection/interface",
678    "$dsoftbus_root_path/core/frame/$os_type/init/include",
679    "$dsoftbus_root_path/core/frame/common/include",
680    "$dsoftbus_root_path/interfaces/kits/bus_center",
681    "$dsoftbus_root_path/interfaces/kits/common",
682    "$dsoftbus_root_path/core/connection/manager",
683    "$dsoftbus_root_path/adapter/common/include/",
684    "$dsoftbus_root_path/tests/sdk/common/include",
685    "unittest/common/",
686    "$dsoftbus_root_path/core/authentication/src",
687    "$dsoftbus_root_path/core/discovery/manager/include",
688    "$dsoftbus_root_path/core/discovery/interface",
689    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
690    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
691    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
692    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
693    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
694    "$dsoftbus_root_path/core/adapter/bus_center/include",
695    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
696    "$dsoftbus_root_path/core/bus_center/service/include",
697    "$dsoftbus_root_path/core/adapter/authentication/include",
698    "$dsoftbus_root_path/tests/core/discovery/ble/softbus_ble_mock",
699    "$dsoftbus_root_path/core/discovery/ble/softbus_ble/include",
700    "$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/interface",
701    "$dsoftbus_root_path/core/broadcast/common/include",
702  ]
703
704  deps = [
705    "$dsoftbus_root_path/core/common:softbus_utils",
706    "$dsoftbus_root_path/core/frame:softbus_server",
707    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
708  ]
709
710  if (is_standard_system) {
711    external_deps = [
712      "bounds_checking_function:libsec_shared",
713      "cJSON:cjson",
714      "c_utils:utils",
715      "device_auth:deviceauth_sdk",
716      "googletest:gmock",
717      "googletest:gtest_main",
718      "hilog:libhilog",
719    ]
720  } else {
721    external_deps = [
722      "bounds_checking_function:libsec_shared",
723      "cJSON:cjson",
724      "c_utils:utils",
725      "googletest:gmock",
726      "googletest:gtest_main",
727      "hilog:libhilog",
728    ]
729  }
730}
731
732ohos_unittest("AuthSessionKeyTest") {
733  module_out_path = module_output_path
734  sources = [ "unittest/auth_session_key_test.cpp" ]
735
736  include_dirs = [
737    "$dsoftbus_root_path/core/authentication/include",
738    "$dsoftbus_root_path/core/authentication/interface",
739    "$dsoftbus_root_path/core/bus_center/interface",
740    "$dsoftbus_root_path/core/bus_center/utils/include",
741    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
742    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
743    "$dsoftbus_root_path/interfaces/kits/bus_center",
744    "$dsoftbus_root_path/interfaces/kits/common",
745    "unittest/common/",
746    "$dsoftbus_root_path/core/authentication/src",
747    "$dsoftbus_root_path/core/adapter/bus_center/include",
748  ]
749
750  deps = [
751    "$dsoftbus_root_path/core/common:softbus_utils",
752    "$dsoftbus_root_path/core/frame:softbus_server",
753    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
754  ]
755
756  if (is_standard_system) {
757    external_deps = [
758      "bounds_checking_function:libsec_shared",
759      "c_utils:utils",
760      "device_auth:deviceauth_sdk",
761      "googletest:gtest_main",
762      "hilog:libhilog",
763    ]
764  } else {
765    external_deps = [
766      "bounds_checking_function:libsec_shared",
767      "c_utils:utils",
768      "googletest:gtest_main",
769      "hilog:libhilog",
770    ]
771  }
772}
773
774ohos_unittest("AuthNormalizeRequestTest") {
775  module_out_path = module_output_path
776  sources = [ "unittest/auth_normalize_request_test.cpp" ]
777
778  include_dirs = [
779    "$dsoftbus_root_path/core/authentication/include",
780    "$dsoftbus_root_path/core/authentication/interface",
781    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
782    "$dsoftbus_root_path/core/bus_center/interface",
783    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
784    "$dsoftbus_root_path/core/bus_center/utils/include",
785  ]
786
787  deps = [
788    "$dsoftbus_root_path/core/common:softbus_utils",
789    "$dsoftbus_root_path/core/frame:softbus_server",
790    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
791  ]
792
793  if (is_standard_system) {
794    external_deps = [
795      "bounds_checking_function:libsec_shared",
796      "cJSON:cjson",
797      "c_utils:utils",
798      "device_auth:deviceauth_sdk",
799      "googletest:gtest_main",
800      "hilog:libhilog",
801    ]
802  } else {
803    external_deps = [
804      "bounds_checking_function:libsec_shared",
805      "cJSON:cjson",
806      "c_utils:utils",
807      "googletest:gtest_main",
808      "hilog:libhilog",
809    ]
810  }
811}
812
813ohos_unittest("AuthLaneTest") {
814  module_out_path = module_output_path
815  sources = [
816    "unittest/auth_lane_mock.cpp",
817    "unittest/auth_lane_test.cpp",
818  ]
819
820  include_dirs = [
821    "$dsoftbus_root_path/core/authentication/include",
822    "$dsoftbus_root_path/core/authentication/interface",
823    "$dsoftbus_root_path/core/bus_center/interface",
824    "$dsoftbus_root_path/core/bus_center/utils/include",
825    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
826    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
827    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
828    "$dsoftbus_root_path/core/common/include",
829    "$dsoftbus_root_path/core/common/message_handler/include",
830    "$dsoftbus_root_path/core/connection/interface",
831    "$dsoftbus_root_path/core/frame/common/include",
832    "$dsoftbus_root_path/interfaces/kits/bus_center",
833    "$dsoftbus_root_path/interfaces/kits/common",
834    "$dsoftbus_root_path/core/connection/manager",
835    "$dsoftbus_root_path/adapter/common/include/",
836    "$dsoftbus_root_path/tests/sdk/common/include",
837    "unittest/common/",
838    "$dsoftbus_root_path/core/authentication/src",
839    "$dsoftbus_root_path/core/discovery/manager/include",
840    "$dsoftbus_root_path/core/discovery/interface",
841    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
842    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/src",
843    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
844    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
845    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
846    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
847    "$dsoftbus_root_path/core/adapter/bus_center/include",
848    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
849    "$dsoftbus_root_path/core/bus_center/service/include",
850    "$dsoftbus_root_path/core/adapter/authentication/include",
851    "$dsoftbus_root_path/core/connection/wifi_direct_cpp/utils",
852    "$dsoftbus_root_path/core/connection/wifi_direct_cpp",
853    "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
854    "$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
855  ]
856
857  deps = [
858    "$dsoftbus_root_path/core/common:softbus_utils",
859    "$dsoftbus_root_path/core/frame:softbus_server",
860  ]
861
862  if (is_standard_system) {
863    external_deps = [
864      "bounds_checking_function:libsec_shared",
865      "cJSON:cjson",
866      "c_utils:utils",
867      "device_auth:deviceauth_sdk",
868      "googletest:gmock",
869      "googletest:gtest_main",
870      "hilog:libhilog",
871    ]
872  } else {
873    external_deps = [
874      "bounds_checking_function:libsec_shared",
875      "cJSON:cjson",
876      "c_utils:utils",
877      "googletest:gmock",
878      "googletest:gtest_main",
879      "hilog:libhilog",
880    ]
881  }
882}
883
884ohos_unittest("AuthDeviceProfileListenerTest") {
885  module_out_path = module_output_path
886  sources = [
887    "$dsoftbus_root_path/core/authentication/bind/auth_device_profile_listener.cpp",
888    "unittest/auth_device_profile_listener_mock.cpp",
889    "unittest/auth_device_profile_listener_test.cpp",
890  ]
891
892  include_dirs = [
893    "$dsoftbus_root_path/interfaces/kits",
894    "$dsoftbus_root_path/core/authentication/interface",
895    "$dsoftbus_root_path/core/authentication/include",
896  ]
897
898  deps = [ "$dsoftbus_root_path/core/common:softbus_utils" ]
899
900  if (!defined(global_parts_info) ||
901      defined(global_parts_info.deviceprofile_device_info_manager)) {
902    external_deps = [
903      "device_info_manager:distributed_device_profile_common",
904      "device_info_manager:distributed_device_profile_sdk",
905      "hilog:libhilog",
906      "ipc:ipc_core",
907    ]
908  } else {
909    external_deps = [
910      "hilog:libhilog",
911      "ipc:ipc_core",
912    ]
913  }
914  external_deps += [
915    "bounds_checking_function:libsec_shared",
916    "c_utils:utils",
917    "device_auth:deviceauth_sdk",
918    "googletest:gmock_main",
919    "googletest:gtest_main",
920  ]
921}
922
923group("unittest") {
924  testonly = true
925  deps = [
926    ":AuthDeviceProfileListenerTest",
927    ":AuthDeviceProfileTest",
928    ":AuthEnhanceMockTest",
929    ":AuthHichainTest",
930    ":AuthLaneTest",
931    ":AuthManagerTest",
932    ":AuthNormalizeRequestTest",
933    ":AuthOtherTest",
934    ":AuthSessionFsmTest",
935    ":AuthSessionKeyTest",
936    ":AuthSessionMessageTest",
937    ":AuthTcpConnectionTest",
938    ":AuthTest",
939    ":AuthTestCallBackTest",
940  ]
941}
942
943group("fuzztest") {
944  testonly = true
945  deps = [ "fuzztest:fuzztest" ]
946  if (enhanced) {
947    deps += [
948      "$dsoftbus_root_path/dsoftbus_enhance/test/core/authentication:fuzztest",
949    ]
950  }
951}
952