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 = true
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 = [ "unittest/auth_other_test.cpp" ]
319
320  include_dirs = [
321    "$dsoftbus_root_path/core/authentication/include",
322    "$dsoftbus_root_path/core/authentication/interface",
323    "$dsoftbus_root_path/core/bus_center/interface",
324    "$dsoftbus_root_path/core/bus_center/utils/include",
325    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
326    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
327    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
328    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
329    "$dsoftbus_root_path/core/common/include",
330    "$dsoftbus_root_path/core/common/message_handler/include",
331    "$dsoftbus_root_path/core/connection/interface",
332    "$dsoftbus_root_path/core/frame/$os_type/init/include",
333    "$dsoftbus_root_path/core/frame/common/include",
334    "$dsoftbus_root_path/interfaces/kits/bus_center",
335    "$dsoftbus_root_path/interfaces/kits/common",
336    "$dsoftbus_root_path/core/connection/manager",
337    "$dsoftbus_root_path/adapter/common/include/",
338    "$dsoftbus_root_path/tests/sdk/common/include",
339    "unittest/common/",
340    "$dsoftbus_root_path/core/authentication/src",
341    "$dsoftbus_root_path/core/discovery/manager/include",
342    "$dsoftbus_root_path/core/discovery/interface",
343    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
344    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
345    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
346    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
347    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
348    "$dsoftbus_root_path/core/adapter/bus_center/include",
349    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
350    "$dsoftbus_root_path/core/bus_center/service/include",
351    "$dsoftbus_root_path/core/adapter/authentication/include",
352    "$dsoftbus_root_path/core/connection/wifi_direct_cpp",
353    "$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
354  ]
355
356  deps = [
357    "$dsoftbus_root_path/core/common:softbus_utils",
358    "$dsoftbus_root_path/core/frame:softbus_server",
359    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
360  ]
361
362  if (is_standard_system) {
363    external_deps = [
364      "bounds_checking_function:libsec_shared",
365      "cJSON:cjson",
366      "c_utils:utils",
367      "device_auth:deviceauth_sdk",
368      "googletest:gmock",
369      "googletest:gtest_main",
370      "hilog:libhilog",
371    ]
372  } else {
373    external_deps = [
374      "bounds_checking_function:libsec_shared",
375      "cJSON:cjson",
376      "c_utils:utils",
377      "googletest:gmock",
378      "googletest:gtest_main",
379      "hilog:libhilog",
380    ]
381  }
382}
383
384ohos_unittest("AuthTcpConnectionTest") {
385  module_out_path = module_output_path
386  sources = [ "unittest/auth_tcp_connection_test.cpp" ]
387
388  include_dirs = [
389    "$dsoftbus_root_path/core/authentication/include",
390    "$dsoftbus_root_path/core/authentication/interface",
391    "$dsoftbus_root_path/core/bus_center/interface",
392    "$dsoftbus_root_path/core/bus_center/utils/include",
393    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
394    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
395    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
396    "$dsoftbus_root_path/core/common/include",
397    "$dsoftbus_root_path/core/common/message_handler/include",
398    "$dsoftbus_root_path/core/connection/interface",
399    "$dsoftbus_root_path/core/frame/$os_type/init/include",
400    "$dsoftbus_root_path/core/frame/common/include",
401    "$dsoftbus_root_path/interfaces/kits/bus_center",
402    "$dsoftbus_root_path/interfaces/kits/common",
403    "$dsoftbus_root_path/core/connection/manager",
404    "$dsoftbus_root_path/adapter/common/include/",
405    "$dsoftbus_root_path/tests/sdk/common/include",
406    "unittest/common/",
407    "$dsoftbus_root_path/core/authentication/src",
408    "$dsoftbus_root_path/core/discovery/manager/include",
409    "$dsoftbus_root_path/core/discovery/interface",
410    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
411    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
412    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
413    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
414    "$dsoftbus_root_path/core/transmission/trans_channel/manager/include",
415  ]
416
417  deps = [
418    "$dsoftbus_root_path/core/common:softbus_utils",
419    "$dsoftbus_root_path/core/frame:softbus_server",
420    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
421  ]
422
423  if (is_standard_system) {
424    external_deps = [
425      "bounds_checking_function:libsec_shared",
426      "cJSON:cjson",
427      "c_utils:utils",
428      "device_auth:deviceauth_sdk",
429      "googletest:gtest_main",
430      "hilog:libhilog",
431    ]
432  } else {
433    external_deps = [
434      "bounds_checking_function:libsec_shared",
435      "cJSON:cjson",
436      "c_utils:utils",
437      "googletest:gtest_main",
438      "hilog:libhilog",
439    ]
440  }
441}
442
443ohos_unittest("AuthHichainTest") {
444  module_out_path = module_output_path
445  sources = [
446    "$dsoftbus_root_path/tests/core/authentication/unittest/auth_common_mock.cpp",
447    "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/lnn_hichain_mock.cpp",
448    "unittest/auth_hichain_test.cpp",
449    "unittest/auth_net_ledger_mock.cpp",
450  ]
451
452  include_dirs = [
453    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
454    "$dsoftbus_root_path/core/authentication/include",
455    "$dsoftbus_root_path/core/authentication/interface",
456    "$dsoftbus_root_path/tests/core/authentication/unittest",
457    "$dsoftbus_root_path/core/bus_center/interface",
458    "$dsoftbus_root_path/core/bus_center/utils/include",
459    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
460    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
461    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
462    "$dsoftbus_root_path/core/common/include",
463    "$dsoftbus_root_path/core/common/message_handler/include",
464    "$dsoftbus_root_path/core/connection/interface",
465    "$dsoftbus_root_path/core/frame/$os_type/init/include",
466    "$dsoftbus_root_path/core/frame/common/include",
467    "$dsoftbus_root_path/interfaces/inner_kits/transport",
468    "$dsoftbus_root_path/interfaces/kits/bus_center",
469    "$dsoftbus_root_path/interfaces/kits/common",
470    "$dsoftbus_root_path/interfaces/kits/discovery",
471    "$dsoftbus_root_path/core/connection/manager",
472    "$dsoftbus_root_path/adapter/common/include/",
473    "$dsoftbus_root_path/tests/sdk/common/include",
474    "unittest/common/",
475    "$dsoftbus_root_path/core/authentication/src",
476    "$dsoftbus_root_path/core/discovery/manager/include",
477    "$dsoftbus_root_path/core/discovery/interface",
478    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
479    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
480    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
481    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
482    "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
483    "$dsoftbus_root_path/core/adapter/bus_center/include",
484  ]
485
486  deps = [
487    "$dsoftbus_root_path/core/common:softbus_utils",
488    "$dsoftbus_root_path/core/frame:softbus_server",
489    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
490  ]
491
492  if (is_standard_system) {
493    external_deps = [
494      "bounds_checking_function:libsec_shared",
495      "cJSON:cjson",
496      "c_utils:utils",
497      "device_auth:deviceauth_sdk",
498      "googletest:gmock",
499      "googletest:gtest_main",
500      "hilog:libhilog",
501    ]
502  } else {
503    external_deps = [
504      "bounds_checking_function:libsec_shared",
505      "cJSON:cjson",
506      "c_utils:utils",
507      "googletest:gmock",
508      "googletest:gtest_main",
509      "hilog:libhilog",
510    ]
511  }
512}
513
514ohos_unittest("AuthSessionMessageTest") {
515  module_out_path = module_output_path
516  sources = [ "unittest/auth_session_message_test.cpp" ]
517
518  include_dirs = [
519    "$dsoftbus_root_path/core/authentication/include",
520    "$dsoftbus_root_path/core/authentication/interface",
521    "$dsoftbus_root_path/core/bus_center/interface",
522    "$dsoftbus_root_path/core/bus_center/utils/include",
523    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
524    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
525    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
526    "$dsoftbus_root_path/core/common/include",
527    "$dsoftbus_root_path/core/common/message_handler/include",
528    "$dsoftbus_root_path/core/connection/interface",
529    "$dsoftbus_root_path/core/frame/$os_type/init/include",
530    "$dsoftbus_root_path/core/frame/common/include",
531    "$dsoftbus_root_path/interfaces/kits/bus_center",
532    "$dsoftbus_root_path/interfaces/kits/common",
533    "$dsoftbus_root_path/core/connection/manager",
534    "$dsoftbus_root_path/adapter/common/include/",
535    "$dsoftbus_root_path/tests/sdk/common/include",
536    "unittest/common/",
537    "$dsoftbus_root_path/core/authentication/src",
538    "$dsoftbus_root_path/core/discovery/manager/include",
539    "$dsoftbus_root_path/core/discovery/interface",
540    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
541    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
542    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
543    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
544    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
545    "$dsoftbus_root_path/core/adapter/bus_center/include",
546    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
547    "$dsoftbus_root_path/core/bus_center/service/include",
548    "$dsoftbus_root_path/core/adapter/authentication/include",
549  ]
550
551  deps = [
552    "$dsoftbus_root_path/core/common:softbus_utils",
553    "$dsoftbus_root_path/core/frame:softbus_server",
554    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
555  ]
556
557  if (is_standard_system) {
558    external_deps = [
559      "bounds_checking_function:libsec_shared",
560      "cJSON:cjson",
561      "c_utils:utils",
562      "device_auth:deviceauth_sdk",
563      "googletest:gtest_main",
564      "hilog:libhilog",
565    ]
566  } else {
567    external_deps = [
568      "bounds_checking_function:libsec_shared",
569      "cJSON:cjson",
570      "c_utils:utils",
571      "googletest:gtest_main",
572      "hilog:libhilog",
573    ]
574  }
575}
576
577ohos_unittest("AuthManagerTest") {
578  module_out_path = module_output_path
579  sources = auth_manager_source
580
581  include_dirs = auth_manager_include
582
583  deps = [
584    "$dsoftbus_root_path/core/common:softbus_utils",
585    "$dsoftbus_root_path/core/frame:softbus_server",
586    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
587  ]
588
589  if (is_standard_system) {
590    external_deps = [
591      "bounds_checking_function:libsec_shared",
592      "cJSON:cjson",
593      "c_utils:utils",
594      "device_auth:deviceauth_sdk",
595      "googletest:gmock",
596      "googletest:gtest_main",
597      "hilog:libhilog",
598    ]
599  } else {
600    external_deps = [
601      "bounds_checking_function:libsec_shared",
602      "cJSON:cjson",
603      "c_utils:utils",
604      "device_auth:deviceauth_sdk",
605      "googletest:gmock",
606      "googletest:gtest_main",
607      "hilog:libhilog",
608    ]
609  }
610}
611
612ohos_unittest("AuthSessionFsmTest") {
613  module_out_path = module_output_path
614  sources = [
615    "$dsoftbus_root_path/tests/core/discovery/ble/softbus_ble_mock/ble_mock.cpp",
616    "unittest/auth_session_fsm_test.cpp",
617  ]
618
619  include_dirs = [
620    "$dsoftbus_root_path/core/authentication/include",
621    "$dsoftbus_root_path/core/authentication/interface",
622    "$dsoftbus_root_path/core/bus_center/interface",
623    "$dsoftbus_root_path/core/bus_center/utils/include",
624    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
625    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
626    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
627    "$dsoftbus_root_path/core/common/include",
628    "$dsoftbus_root_path/core/common/message_handler/include",
629    "$dsoftbus_root_path/core/connection/interface",
630    "$dsoftbus_root_path/core/frame/$os_type/init/include",
631    "$dsoftbus_root_path/core/frame/common/include",
632    "$dsoftbus_root_path/interfaces/kits/bus_center",
633    "$dsoftbus_root_path/interfaces/kits/common",
634    "$dsoftbus_root_path/core/connection/manager",
635    "$dsoftbus_root_path/adapter/common/include/",
636    "$dsoftbus_root_path/tests/sdk/common/include",
637    "unittest/common/",
638    "$dsoftbus_root_path/core/authentication/src",
639    "$dsoftbus_root_path/core/discovery/manager/include",
640    "$dsoftbus_root_path/core/discovery/interface",
641    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
642    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
643    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
644    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
645    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
646    "$dsoftbus_root_path/core/adapter/bus_center/include",
647    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
648    "$dsoftbus_root_path/core/bus_center/service/include",
649    "$dsoftbus_root_path/core/adapter/authentication/include",
650    "$dsoftbus_root_path/tests/core/discovery/ble/softbus_ble_mock",
651    "$dsoftbus_root_path/core/discovery/ble/softbus_ble/include",
652    "$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/interface",
653    "$dsoftbus_root_path/core/broadcast/common/include",
654  ]
655
656  deps = [
657    "$dsoftbus_root_path/core/common:softbus_utils",
658    "$dsoftbus_root_path/core/frame:softbus_server",
659    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
660  ]
661
662  if (is_standard_system) {
663    external_deps = [
664      "bounds_checking_function:libsec_shared",
665      "cJSON:cjson",
666      "c_utils:utils",
667      "device_auth:deviceauth_sdk",
668      "googletest:gmock",
669      "googletest:gtest_main",
670      "hilog:libhilog",
671    ]
672  } else {
673    external_deps = [
674      "bounds_checking_function:libsec_shared",
675      "cJSON:cjson",
676      "c_utils:utils",
677      "googletest:gmock",
678      "googletest:gtest_main",
679      "hilog:libhilog",
680    ]
681  }
682}
683
684ohos_unittest("AuthSessionKeyTest") {
685  module_out_path = module_output_path
686  sources = [ "unittest/auth_session_key_test.cpp" ]
687
688  include_dirs = [
689    "$dsoftbus_root_path/core/authentication/include",
690    "$dsoftbus_root_path/core/authentication/interface",
691    "$dsoftbus_root_path/core/bus_center/interface",
692    "$dsoftbus_root_path/core/bus_center/utils/include",
693    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
694    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
695    "$dsoftbus_root_path/interfaces/kits/bus_center",
696    "$dsoftbus_root_path/interfaces/kits/common",
697    "unittest/common/",
698    "$dsoftbus_root_path/core/authentication/src",
699    "$dsoftbus_root_path/core/adapter/bus_center/include",
700  ]
701
702  deps = [
703    "$dsoftbus_root_path/core/common:softbus_utils",
704    "$dsoftbus_root_path/core/frame:softbus_server",
705    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
706  ]
707
708  if (is_standard_system) {
709    external_deps = [
710      "bounds_checking_function:libsec_shared",
711      "c_utils:utils",
712      "device_auth:deviceauth_sdk",
713      "googletest:gtest_main",
714      "hilog:libhilog",
715    ]
716  } else {
717    external_deps = [
718      "bounds_checking_function:libsec_shared",
719      "c_utils:utils",
720      "googletest:gtest_main",
721      "hilog:libhilog",
722    ]
723  }
724}
725
726ohos_unittest("AuthNormalizeRequestTest") {
727  module_out_path = module_output_path
728  sources = [ "unittest/auth_normalize_request_test.cpp" ]
729
730  include_dirs = [
731    "$dsoftbus_root_path/core/authentication/include",
732    "$dsoftbus_root_path/core/authentication/interface",
733    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
734    "$dsoftbus_root_path/core/bus_center/interface",
735    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
736    "$dsoftbus_root_path/core/bus_center/utils/include",
737  ]
738
739  deps = [
740    "$dsoftbus_root_path/core/common:softbus_utils",
741    "$dsoftbus_root_path/core/frame:softbus_server",
742    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
743  ]
744
745  if (is_standard_system) {
746    external_deps = [
747      "bounds_checking_function:libsec_shared",
748      "cJSON:cjson",
749      "c_utils:utils",
750      "device_auth:deviceauth_sdk",
751      "googletest:gtest_main",
752      "hilog:libhilog",
753    ]
754  } else {
755    external_deps = [
756      "bounds_checking_function:libsec_shared",
757      "cJSON:cjson",
758      "c_utils:utils",
759      "googletest:gtest_main",
760      "hilog:libhilog",
761    ]
762  }
763}
764
765ohos_unittest("AuthLaneTest") {
766  module_out_path = module_output_path
767  sources = [
768    "unittest/auth_lane_mock.cpp",
769    "unittest/auth_lane_test.cpp",
770  ]
771
772  include_dirs = [
773    "$dsoftbus_root_path/core/authentication/include",
774    "$dsoftbus_root_path/core/authentication/interface",
775    "$dsoftbus_root_path/core/bus_center/interface",
776    "$dsoftbus_root_path/core/bus_center/utils/include",
777    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
778    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
779    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
780    "$dsoftbus_root_path/core/common/include",
781    "$dsoftbus_root_path/core/common/message_handler/include",
782    "$dsoftbus_root_path/core/connection/interface",
783    "$dsoftbus_root_path/core/frame/common/include",
784    "$dsoftbus_root_path/interfaces/kits/bus_center",
785    "$dsoftbus_root_path/interfaces/kits/common",
786    "$dsoftbus_root_path/core/connection/manager",
787    "$dsoftbus_root_path/adapter/common/include/",
788    "$dsoftbus_root_path/tests/sdk/common/include",
789    "unittest/common/",
790    "$dsoftbus_root_path/core/authentication/src",
791    "$dsoftbus_root_path/core/discovery/manager/include",
792    "$dsoftbus_root_path/core/discovery/interface",
793    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
794    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/src",
795    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
796    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
797    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
798    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
799    "$dsoftbus_root_path/core/adapter/bus_center/include",
800    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
801    "$dsoftbus_root_path/core/bus_center/service/include",
802    "$dsoftbus_root_path/core/adapter/authentication/include",
803    "$dsoftbus_root_path/core/connection/wifi_direct/utils",
804    "$dsoftbus_root_path/core/connection/wifi_direct",
805    "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
806    "$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
807  ]
808
809  deps = [
810    "$dsoftbus_root_path/core/common:softbus_utils",
811    "$dsoftbus_root_path/core/frame:softbus_server",
812  ]
813
814  if (is_standard_system) {
815    external_deps = [
816      "bounds_checking_function:libsec_shared",
817      "cJSON:cjson",
818      "c_utils:utils",
819      "device_auth:deviceauth_sdk",
820      "googletest:gmock",
821      "googletest:gtest_main",
822      "hilog:libhilog",
823    ]
824  } else {
825    external_deps = [
826      "bounds_checking_function:libsec_shared",
827      "cJSON:cjson",
828      "c_utils:utils",
829      "googletest:gmock",
830      "googletest:gtest_main",
831      "hilog:libhilog",
832    ]
833  }
834}
835
836group("unittest") {
837  testonly = true
838  deps = [
839    ":AuthEnhanceMockTest",
840    ":AuthHichainTest",
841    ":AuthLaneTest",
842    ":AuthManagerTest",
843    ":AuthNormalizeRequestTest",
844    ":AuthOtherTest",
845    ":AuthSessionFsmTest",
846    ":AuthSessionKeyTest",
847    ":AuthSessionMessageTest",
848    ":AuthTcpConnectionTest",
849    ":AuthTest",
850    ":AuthTestCallBackTest",
851  ]
852}
853
854group("fuzztest") {
855  testonly = true
856  deps = [ "fuzztest:fuzztest" ]
857  if (enhanced) {
858    deps += [
859      "$dsoftbus_root_path/dsoftbus_enhance/test/core/authentication:fuzztest",
860    ]
861  }
862}
863