1# Copyright (c) 2022-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/common/dfx/dsoftbus_dfx.gni")
16import("../../../../dsoftbus.gni")
17
18module_output_path = "dsoftbus/transmission"
19dsoftbus_root_path = "../../../.."
20
21ohos_unittest("TransClientSessionManagerTest") {
22  module_out_path = module_output_path
23  sources = [ "client_trans_session_manager_test.cpp" ]
24
25  include_dirs = [
26    "$dsoftbus_root_path/core/common/include",
27    "$dsoftbus_root_path/core/frame/common/include",
28    "$dsoftbus_root_path/core/transmission/common/include",
29    "$dsoftbus_root_path/sdk/transmission/session/include",
30    "$dsoftbus_root_path/core/authentication/interface",
31    "$dsoftbus_root_path/core/bus_center/interface",
32    "$dsoftbus_root_path/core/transmission/session/include",
33    "$dsoftbus_root_path/core/connection/interface",
34    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
35    "$dsoftbus_root_path/core/discovery/manager/include",
36    "$dsoftbus_root_path/core/discovery/interface",
37  ]
38
39  deps = [
40    "$dsoftbus_dfx_path/log:softbus_dfx_log",
41    "$dsoftbus_root_path/core/common:softbus_utils",
42    "$dsoftbus_root_path/core/frame:softbus_server",
43    "$dsoftbus_root_path/tests/sdk:softbus_client_static",
44  ]
45
46  if (is_standard_system) {
47    external_deps = [
48      "c_utils:utils",
49      "hilog:libhilog",
50    ]
51  } else {
52    external_deps = [
53      "c_utils:utils",
54      "hilog:libhilog",
55    ]
56  }
57}
58
59ohos_unittest("TransClientSessionServiceTest") {
60  module_out_path = module_output_path
61  sources = [ "client_trans_session_service_test.cpp" ]
62
63  include_dirs = [
64    "$dsoftbus_root_path/core/common/include",
65    "$dsoftbus_root_path/core/frame/common/include",
66    "$dsoftbus_root_path/core/transmission/common/include",
67    "$dsoftbus_root_path/sdk/transmission/session/include",
68    "$dsoftbus_root_path/adapter/default_config/spec_config",
69    "$dsoftbus_root_path/core/connection/interface",
70    "$dsoftbus_root_path/core/authentication/interface",
71    "$dsoftbus_root_path/core/bus_center/interface",
72    "$dsoftbus_root_path/core/transmission/session/include",
73    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
74    "$dsoftbus_root_path/core/discovery/manager/include",
75    "$dsoftbus_root_path/core/discovery/interface",
76  ]
77
78  deps = [
79    "$dsoftbus_dfx_path/log:softbus_dfx_log",
80    "$dsoftbus_root_path/core/common:softbus_utils",
81    "$dsoftbus_root_path/core/frame:softbus_server",
82    "$dsoftbus_root_path/tests/sdk:softbus_client_static",
83  ]
84
85  if (is_standard_system) {
86    external_deps = [
87      "c_utils:utils",
88      "hilog:libhilog",
89    ]
90  } else {
91    external_deps = [
92      "c_utils:utils",
93      "hilog:libhilog",
94    ]
95  }
96}
97
98ohos_unittest("TransClientSessionCallbackTest") {
99  module_out_path = module_output_path
100  sources = [ "client_trans_session_callback_test.cpp" ]
101
102  include_dirs = [
103    "$dsoftbus_root_path/core/common/include",
104    "$dsoftbus_root_path/core/frame/common/include",
105    "$dsoftbus_root_path/core/transmission/common/include",
106    "$dsoftbus_root_path/sdk/transmission/session/include",
107    "$dsoftbus_root_path/adapter/default_config/spec_config",
108    "$dsoftbus_root_path/sdk/transmission/session/src",
109    "$dsoftbus_root_path/sdk/transmission/trans_channel/proxy/include",
110    "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/file/include",
111    "$dsoftbus_root_path/core/connection/interface",
112    "$dsoftbus_root_path/core/authentication/interface",
113    "$dsoftbus_root_path/core/bus_center/interface",
114    "$dsoftbus_root_path/core/transmission/session/include",
115    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
116    "$dsoftbus_root_path/core/discovery/manager/include",
117    "$dsoftbus_root_path/core/discovery/interface",
118    "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/common/include",
119  ]
120
121  deps = [
122    "$dsoftbus_dfx_path/log:softbus_dfx_log",
123    "$dsoftbus_root_path/core/common:softbus_utils",
124    "$dsoftbus_root_path/core/frame:softbus_server",
125    "$dsoftbus_root_path/tests/sdk:softbus_client_static",
126  ]
127
128  if (is_standard_system) {
129    external_deps = [
130      "c_utils:utils",
131      "hilog:libhilog",
132    ]
133  } else {
134    external_deps = [
135      "c_utils:utils",
136      "hilog:libhilog",
137    ]
138  }
139}
140
141ohos_unittest("TransClientMsgServiceTest") {
142  module_out_path = module_output_path
143  sources = [ "client_trans_message_service_test.cpp" ]
144
145  include_dirs = [
146    "$dsoftbus_root_path/core/common/include",
147    "$dsoftbus_root_path/core/frame/common/include",
148    "$dsoftbus_root_path/core/transmission/common/include",
149    "$dsoftbus_root_path/sdk/transmission/session/include",
150    "$dsoftbus_root_path/sdk/transmission/session/src",
151    "$dsoftbus_root_path/interfaces/inner_kits/transport",
152    "$dsoftbus_root_path/sdk/transmission/trans_channel/statistics/include",
153    "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/file/include",
154    "$dsoftbus_root_path/sdk/transmission/trans_channel/manager/include",
155    "$dsoftbus_root_path/sdk/frame/common/include",
156    "$dsoftbus_root_path/tests/sdk/common/include",
157    "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/common/include",
158    "$dsoftbus_root_path/core/connection/interface",
159    "$dsoftbus_root_path/core/authentication/interface",
160    "$dsoftbus_root_path/core/bus_center/interface",
161    "$dsoftbus_root_path/core/transmission/session/include",
162    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
163    "$dsoftbus_root_path/core/discovery/manager/include",
164    "$dsoftbus_root_path/core/discovery/interface",
165  ]
166
167  deps = [
168    "$dsoftbus_dfx_path/log:softbus_dfx_log",
169    "$dsoftbus_root_path/core/common:softbus_utils",
170    "$dsoftbus_root_path/core/frame:softbus_server",
171    "$dsoftbus_root_path/tests/sdk:softbus_client_static",
172    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
173  ]
174
175  if (is_standard_system) {
176    external_deps = [
177      "c_utils:utils",
178      "hilog:libhilog",
179    ]
180  } else {
181    external_deps = [
182      "c_utils:utils",
183      "hilog:libhilog",
184    ]
185  }
186}
187
188ohos_unittest("TransClientSessionTest") {
189  sanitize = {
190    cfi = true
191    cfi_cross_dso = true
192    debug = false
193  }
194  module_out_path = module_output_path
195  sources = [ "client_trans_session_test.cpp" ]
196
197  include_dirs = [
198    "$dsoftbus_root_path/core/common/include",
199    "$dsoftbus_root_path/core/frame/common/include",
200    "$dsoftbus_root_path/core/transmission/common/include",
201    "$dsoftbus_root_path/sdk/transmission/session/include",
202    "$dsoftbus_root_path/sdk/transmission/session/src",
203    "$dsoftbus_root_path/sdk/transmission/trans_channel/proxy/include",
204    "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/file/include",
205    "$dsoftbus_root_path/sdk/transmission/trans_channel/qos/include",
206    "$dsoftbus_root_path/sdk/transmission/trans_channel/manager/include",
207    "$dsoftbus_root_path/sdk/frame/common/include",
208    "$dsoftbus_root_path/sdk/transmission/ipc/include",
209    "$dsoftbus_root_path/tests/sdk/common/include",
210    "$dsoftbus_root_path/interfaces/kits/common",
211    "$dsoftbus_root_path/sdk/bus_center/manager/include",
212    "$dsoftbus_root_path/sdk/transmission/trans_channel/tcp_direct/include",
213    "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/common/include",
214    "$dsoftbus_root_path/core/connection/interface",
215    "$dsoftbus_root_path/core/authentication/interface",
216    "$dsoftbus_root_path/core/bus_center/interface",
217    "$dsoftbus_root_path/core/transmission/session/include",
218    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
219    "$dsoftbus_root_path/core/discovery/manager/include",
220    "$dsoftbus_root_path/core/discovery/interface",
221  ]
222
223  deps = [
224    "$dsoftbus_dfx_path/log:softbus_dfx_log",
225    "$dsoftbus_root_path/core/common:softbus_utils",
226    "$dsoftbus_root_path/core/frame:softbus_server",
227    "$dsoftbus_root_path/tests/sdk:softbus_client_static",
228    "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
229  ]
230
231  if (is_standard_system) {
232    external_deps = [
233      "access_token:libtoken_setproc",
234      "c_utils:utils",
235      "hilog:libhilog",
236    ]
237  } else {
238    external_deps = [
239      "c_utils:utils",
240      "hilog:libhilog",
241    ]
242  }
243}
244
245ohos_unittest("TransClientSocketServiceTest") {
246  module_out_path = module_output_path
247  sources = [ "client_trans_socket_service_test.cpp" ]
248
249  deps = [ "$dsoftbus_root_path/tests/sdk:softbus_client_static" ]
250
251  if (is_standard_system) {
252    external_deps = [
253      "c_utils:utils",
254      "hilog:libhilog",
255    ]
256  } else {
257    external_deps = [
258      "c_utils:utils",
259      "hilog:libhilog",
260    ]
261  }
262}
263
264ohos_unittest("TransClientSocketTest") {
265  module_out_path = module_output_path
266  sources = [ "client_trans_inner_socket_test.cpp" ]
267
268  deps = [ "$dsoftbus_root_path/tests/sdk:softbus_client_static" ]
269
270  if (is_standard_system) {
271    external_deps = [
272      "access_token:libaccesstoken_sdk",
273      "access_token:libnativetoken",
274      "access_token:libtoken_setproc",
275      "c_utils:utils",
276      "hilog:libhilog",
277    ]
278  } else {
279    external_deps = [
280      "c_utils:utils",
281      "hilog:libhilog",
282    ]
283  }
284}
285
286ohos_unittest("SessionMockTest") {
287  module_out_path = module_output_path
288  sources = [ "session_mock_test.cpp" ]
289  include_dirs = [
290    "$dsoftbus_root_path/sdk/transmission/session/cpp/src",
291    "$dsoftbus_root_path/sdk/transmission/session/cpp/include",
292  ]
293
294  deps = [ "$dsoftbus_root_path/tests/sdk:softbus_client_static" ]
295
296  if (is_standard_system) {
297    external_deps = [
298      "access_token:libaccesstoken_sdk",
299      "access_token:libnativetoken",
300      "access_token:libtoken_setproc",
301      "c_utils:utils",
302      "hilog:libhilog",
303    ]
304  } else {
305    external_deps = [
306      "c_utils:utils",
307      "hilog:libhilog",
308    ]
309  }
310}
311
312ohos_unittest("TransClientSessionImplTest") {
313  module_out_path = module_output_path
314  sources = [ "client_trans_session_impl_test.cpp" ]
315  include_dirs = [
316    "$dsoftbus_root_path/sdk/transmission/session/cpp/include",
317    "$dsoftbus_root_path/sdk/transmission/session/cpp/src",
318  ]
319
320  deps = [
321    "$dsoftbus_root_path/core/common:softbus_utils",
322    "$dsoftbus_root_path/tests/sdk:softbus_client_static",
323  ]
324
325  if (is_standard_system) {
326    external_deps = [ "hilog:libhilog" ]
327  }
328}
329
330ohos_unittest("TransClientSessionServiceImplTest") {
331  module_out_path = module_output_path
332  sources = [ "client_trans_session_service_impl_test.cpp" ]
333  include_dirs = [
334    "$dsoftbus_root_path/sdk/transmission/session/cpp/src",
335    "$dsoftbus_root_path/sdk/transmission/session/cpp/include",
336  ]
337
338  deps = [
339    "$dsoftbus_root_path/core/common:softbus_utils",
340    "$dsoftbus_root_path/tests/sdk:softbus_client_static",
341  ]
342
343  if (is_standard_system) {
344    external_deps = [ "hilog:libhilog" ]
345  }
346}
347
348group("unittest") {
349  testonly = true
350  deps = [
351    ":SessionMockTest",
352    ":TransClientMsgServiceTest",
353    ":TransClientSessionCallbackTest",
354    ":TransClientSessionImplTest",
355    ":TransClientSessionManagerTest",
356    ":TransClientSessionServiceImplTest",
357    ":TransClientSessionServiceTest",
358    ":TransClientSessionTest",
359    ":TransClientSocketServiceTest",
360    ":TransClientSocketTest",
361  ]
362}
363