1# Copyright (c) 2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//build/test.gni")
16import("//foundation/communication/netstack/netstack_config.gni")
17
18NETSSL_NAPI = "$NETSTACK_DIR/frameworks/js/napi/net_ssl"
19NETSSL_INNERAPI = "$NETSTACK_DIR/interfaces/innerkits/net_ssl"
20
21utils_include = [
22  "$SUBSYSTEM_DIR/netstack/utils/common_utils/include",
23  "$SUBSYSTEM_DIR/netstack/utils/log/include",
24  "$SUBSYSTEM_DIR/netstack/utils/napi_utils/include",
25  "$THIRD_PARTY_ROOT/curl/include",
26]
27
28common_external_deps = [
29  "hilog:libhilog",
30  "napi:ace_napi",
31]
32
33ohos_unittest("netssl_unittest") {
34  module_out_path = "netstack/netssl_unittest"
35
36  include_dirs = [
37    "$NETSTACK_DIR/utils/napi_utils/include",
38    "$THIRD_PARTY_ROOT/openssl/include",
39    "$NETSSL_INNERAPI/include",
40    "$NETSTACK_DIR/frameworks/native/net_ssl/include",
41    "$NETSSL_NAPI/async_context/include",
42    "$NETSSL_NAPI/async_work/include",
43    "$NETSSL_NAPI/net_ssl_exec/include",
44    "$NETSSL_NAPI/net_ssl_module/include",
45  ]
46  include_dirs += utils_include
47
48  sources = [
49    "$NETSSL_NAPI/async_context/src/cert_context.cpp",
50    "$NETSSL_NAPI/async_work/src/net_ssl_async_work.cpp",
51    "$NETSSL_NAPI/net_ssl_exec/src/net_ssl_exec.cpp",
52    "$NETSSL_NAPI/net_ssl_module/src/net_ssl_module.cpp",
53    "NetsslTest.cpp",
54  ]
55
56  deps = [
57    "$NETSSL_INNERAPI:net_ssl",
58    "$NETSSL_NAPI:networksecurity_napi",
59    "$NETSTACK_DIR/utils/napi_utils:napi_utils",
60  ]
61
62  external_deps = common_external_deps
63  external_deps += [
64    "openssl:libcrypto_shared",
65    "openssl:libssl_shared",
66  ]
67
68  part_name = "netstack"
69  subsystem_name = "communication"
70}
71
72group("unittest") {
73  testonly = true
74  deps = [ ":netssl_unittest" ]
75}
76