• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2025 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
18NETSTACK_UTILS_ROOT = "$SUBSYSTEM_DIR/netstack/utils"
19
20utils_include = [ "$NETSTACK_UTILS_ROOT/log/include" ]
21
22common_external_deps = [
23  "c_utils:utils",
24  "hilog:libhilog",
25]
26
27ohos_unittest("http_handover_handler_test") {
28  sanitize = {
29    cfi = true
30    cfi_cross_dso = true
31    debug = false
32  }
33
34  branch_protector_ret = "pac_ret"
35
36  module_out_path = "netstack/netstack/http_handover_handler_test"
37
38  include_dirs = [
39    "$NETSTACK_DIR/frameworks/js/napi/http/async_context/include",
40    "$NETSTACK_DIR/frameworks/js/napi/http/async_work/include",
41    "$NETSTACK_DIR/frameworks/js/napi/http/cache/base64/include",
42    "$NETSTACK_DIR/frameworks/js/napi/http/cache/cache_proxy/include",
43    "$NETSTACK_DIR/frameworks/js/napi/http/cache/cache_strategy/include",
44    "$NETSTACK_DIR/frameworks/js/napi/http/constant/include",
45    "$NETSTACK_DIR/frameworks/js/napi/http/http_exec/include",
46    "$NETSTACK_DIR/frameworks/js/napi/http/options/include",
47    "$NETSTACK_DIR/utils/common_utils/include",
48    "$NETSTACK_DIR/utils/profiler_utils/include",
49    "$NETSTACK_DIR/utils/tlv_utils/include",
50    "$NETSTACK_UTILS_ROOT/http_over_curl/include",
51  ]
52  include_dirs += utils_include
53
54  defines = []
55
56  deps = [
57    "$NETSTACK_DIR/frameworks/js/napi/http:http",
58    "$NETSTACK_DIR/utils/napi_utils:napi_utils",
59    "$NETSTACK_DIR/utils/napi_utils:napi_utils_static",
60  ]
61
62  external_deps = common_external_deps
63  external_deps += [
64    "ability_runtime:wantagent_innerkits",
65    "curl:curl_shared",
66    "hiprofiler:libnetwork_profiler",
67    "init:libbegetutil",
68    "napi:ace_napi",
69    "time_service:time_client",
70    "hiappevent:hiappevent_innerapi",
71  ]
72
73  if (is_mingw || is_mac) {
74    sources +=
75        [ "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp" ]
76    deps += [
77      "//vendor/open_source/boringssl:crypto_boringssl",
78      "//vendor/open_source/boringssl:ssl_boringssl",
79    ]
80  } else {
81    if (defined(global_parts_info) &&
82        defined(global_parts_info.communication_netmanager_base) &&
83        global_parts_info.communication_netmanager_base) {
84      external_deps += [
85        "netmanager_base:net_conn_manager_if",
86        "netmanager_base:net_security_config_if",
87        "netmanager_base:netsys_client",
88        "hitrace:hitrace_meter",
89        "samgr:samgr_proxy",
90        "safwk:system_ability_fwk",
91      ]
92      defines += [
93        "HAS_NETMANAGER_BASE=1",
94        "HTTP_HANDOVER_FEATURE",
95        "HTTP_STACK_NAME=\"test\"",
96      ]
97    } else {
98      defines += [ "HAS_NETMANAGER_BASE=0" ]
99    }
100  }
101
102  sources = [
103    "$NETSTACK_DIR/frameworks/js/napi/http/async_context/src/request_context.cpp",
104    "$NETSTACK_DIR/frameworks/js/napi/http/constant/src/constant.cpp",
105    "$NETSTACK_DIR/frameworks/js/napi/http/http_exec/src/http_exec.cpp",
106    "$NETSTACK_DIR/frameworks/js/napi/http/http_exec/src/http_tls_config.cpp",
107    "$NETSTACK_DIR/frameworks/js/napi/http/options/src/http_request_options.cpp",
108    "$NETSTACK_DIR/utils/profiler_utils/src/netstack_network_profiler.cpp",
109    "$NETSTACK_DIR/utils/http_over_curl/src/http_handover_handler.cpp",
110    "http_handover_handler_test.cpp",
111  ]
112
113  part_name = "netstack"
114  subsystem_name = "communication"
115}
116
117group("unittest") {
118  testonly = true
119  deps = [ ":http_handover_handler_test" ]
120}
121