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("//foundation/communication/netmanager_base/netmanager_base_config.gni")
16
17ohos_unittest("net_conn_manager_test") {
18  module_out_path = "netmanager_base/net_conn_manager_test"
19  sanitize = {
20    cfi = true
21    cfi_cross_dso = true
22    debug = false
23  }
24
25  branch_protector_ret = "pac_ret"
26  use_exceptions = true
27  sources = [
28    "$NETMANAGER_BASE_ROOT/test/security/netmanager_base_test_security.cpp",
29    "net_common_event_test.cpp",
30    "net_conn_callback_stub_test.cpp",
31    "net_conn_callback_test.cpp",
32    "net_conn_manager_test.cpp",
33    "net_conn_service_test.cpp",
34    "net_detection_callback_stub_test.cpp",
35    "net_detection_callback_test.cpp",
36  ]
37
38  include_dirs = [
39    "$INNERKITS_ROOT/include",
40    "$INNERKITS_ROOT/netconnclient/include",
41    "$INNERKITS_ROOT/netconnclient/include/proxy",
42    "$NETCONNMANAGER_SOURCE_DIR/include/stub",
43    "$NETCONNMANAGER_SOURCE_DIR/include",
44    "$SAMGR_MANAGER_ROOT/interfaces/innerkits/samgr_proxy/include",
45    "$NETMANAGERNATIVE_ROOT/net_mgr_native/include",
46    "$NETMANAGERNATIVE_ROOT/common/include",
47    "$NETPOLICYMANAGER_SOURCE_DIR/include",
48    "$NETPOLICYMANAGER_SOURCE_DIR/include/stub",
49    "$NETMANAGER_BASE_ROOT/services/common/include",
50    "$NETMANAGER_BASE_ROOT/test/commonduplicatedcode",
51    "$NETMANAGER_BASE_ROOT/test/security",
52    "$NETSYSCONTROLLER_ROOT_DIR/include",
53    "$NETSYSNATIVE_SOURCE_DIR/include/netsys",
54    "$INNERKITS_ROOT/netmanagernative/include",
55    "$THIRD_PARTY_ROOT/curl/include",
56    "$THIRD_PARTY_ROOT/openssl/include",
57  ]
58
59  deps = [
60    "$INNERKITS_ROOT/netconnclient:net_conn_manager_if",
61    "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if",
62    "$NETCONNMANAGER_SOURCE_DIR:net_conn_manager_static",
63    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
64    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
65    "$THIRD_PARTY_ROOT/openssl:libcrypto_shared",
66    "$THIRD_PARTY_ROOT/openssl:libssl_shared",
67  ]
68
69  external_deps = [
70    "ability_base:want",
71    "ability_base:zuri",
72    "ability_runtime:ability_manager",
73    "access_token:libaccesstoken_sdk",
74    "access_token:libnativetoken",
75    "access_token:libtoken_setproc",
76    "bundle_framework:appexecfwk_base",
77    "bundle_framework:appexecfwk_core",
78    "cJSON:cjson",
79    "common_event_service:cesfwk_core",
80    "common_event_service:cesfwk_innerkits",
81    "data_share:datashare_common",
82    "data_share:datashare_consumer",
83    "eventhandler:libeventhandler",
84    "ffrt:libffrt",
85    "hisysevent:libhisysevent",
86    "hitrace:hitrace_meter",
87    "ipc:ipc_core",
88    "os_account:os_account_innerkits",
89    "relational_store:native_rdb",
90    "safwk:system_ability_fwk",
91    "samgr:samgr_proxy",
92  ]
93
94  defines = [
95    "NETMGR_LOG_TAG = \"NetConnManager\"",
96    "LOG_DOMAIN = 0xD0015B0",
97  ]
98
99  if (enable_netmgr_debug) {
100    defines += [ "NETMGR_DEBUG" ]
101  }
102
103  external_deps += [ "hilog:libhilog" ]
104
105  if (enable_sys_func) {
106    defines += [ "SYS_FUNC" ]
107  }
108
109  part_name = "netmanager_base"
110  subsystem_name = "communication"
111}
112