• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
18NETSTACK_NAPI_ROOT = "$SUBSYSTEM_DIR/netstack/frameworks/js/napi/"
19
20utils_include = [
21  "$SUBSYSTEM_DIR/netstack/utils/common_utils/include",
22  "$SUBSYSTEM_DIR/netstack/utils/log/include",
23  "$THIRD_PARTY_ROOT/curl/include",
24]
25
26common_external_deps = [
27  "c_utils:utils",
28  "hilog:libhilog",
29]
30
31ohos_unittest("http_unittest") {
32  module_out_path = "netstack/http_unittest"
33
34  include_dirs = [
35    "$NETSTACK_NAPI_ROOT/http/async_context/include",
36    "$NETSTACK_NAPI_ROOT/http/async_work/include",
37    "$NETSTACK_NAPI_ROOT/http/cache/base64/include",
38    "$NETSTACK_NAPI_ROOT/http/cache/cache_constant/include",
39    "$NETSTACK_NAPI_ROOT/http/cache/cache_proxy/include",
40    "$NETSTACK_NAPI_ROOT/http/cache/cache_strategy/include",
41    "$NETSTACK_NAPI_ROOT/http/cache/lru_cache/include",
42    "$NETSTACK_NAPI_ROOT/http/constant/include",
43    "$NETSTACK_NAPI_ROOT/http/http_exec/include",
44    "$NETSTACK_NAPI_ROOT/http/http_module/include",
45    "$NETSTACK_NAPI_ROOT/http/options/include",
46    "$THIRD_PARTY_ROOT/curl/include",
47  ]
48  include_dirs += utils_include
49
50  if (defined(global_parts_info) &&
51      defined(global_parts_info.communication_netmanager_base) &&
52      global_parts_info.communication_netmanager_base) {
53    include_dirs += [
54      "$NETMANAGER_BASE_INNERKITS_DIR/include",
55      "$NETMANAGER_BASE_INNERKITS_DIR/netconnclient/include",
56    ]
57  }
58
59  external_deps = common_external_deps
60
61  sources = [
62    "$NETSTACK_NAPI_ROOT/http/async_context/src/request_context.cpp",
63    "$NETSTACK_NAPI_ROOT/http/constant/src/constant.cpp",
64    "$NETSTACK_NAPI_ROOT/http/http_exec/src/http_exec.cpp",
65    "$NETSTACK_NAPI_ROOT/http/options/src/http_request_options.cpp",
66    "$NETSTACK_NAPI_ROOT/http/options/src/http_response.cpp",
67    "$SUBSYSTEM_DIR/netstack/utils/common_utils/src/netstack_common_utils.cpp",
68    "HttpExecTest.cpp",
69    "HttpRequestOptionsTest.cpp",
70  ]
71
72  deps = [
73    "$SUBSYSTEM_DIR/netstack/utils/napi_utils:napi_utils",
74    "$THIRD_PARTY_ROOT/curl:curl_shared",
75  ]
76  if (is_mingw || is_mac) {
77    sources +=
78        [ "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp" ]
79    deps += [
80      "$ARKUI_ROOT/napi:ace_napi",
81      "$NETSTACK_DIR/utils/napi_utils:napi_utils_static",
82      "$THIRD_PARTY_ROOT/bounds_checking_function:libsec_static",
83      "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp_static",
84    ]
85  } else {
86    deps += [
87      "$NETSTACK_DIR/utils:stack_utils_common",
88      "$NETSTACK_DIR/utils/napi_utils:napi_utils",
89      "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp",
90    ]
91    external_deps += [
92      "hilog:libhilog",
93      "napi:ace_napi",
94    ]
95    if (defined(global_parts_info) &&
96        defined(global_parts_info.communication_netmanager_base) &&
97        global_parts_info.communication_netmanager_base) {
98      external_deps += [ "netmanager_base:net_conn_manager_if" ]
99      defines = [ "HAS_NETMANAGER_BASE=1" ]
100    } else {
101      defines = [ "HAS_NETMANAGER_BASE=0" ]
102    }
103    if (product_name != "ohos-sdk") {
104      external_deps += [ "init:libbegetutil" ]
105    }
106  }
107
108  part_name = "netstack"
109  subsystem_name = "communication"
110}
111
112group("unittest") {
113  testonly = true
114  deps = [ ":http_unittest" ]
115}
116