1# Copyright (c) 2023-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_ext/netmanager_ext_config.gni")
16
17EXT_SECURITY_PATH = "../../.."
18
19ohos_unittest("vpn_manager_test") {
20  sanitize = {
21    cfi = true
22    cfi_cross_dso = true
23    blocklist = "./cfi_blocklist.txt"
24    debug = false
25  }
26
27  branch_protector_ret = "pac_ret"
28
29  sources = [
30    "$EXT_SECURITY_PATH/security/netmanager_ext_test_security.cpp",
31    "extended_vpn_ctl_test.cpp",
32    "net_vpn_impl_test.cpp",
33    "networkvpn_client_test.cpp",
34    "networkvpn_service_test.cpp",
35  ]
36
37  include_dirs = [
38    "$BASE_INNERKITS_ROOT/netconnclient/include/proxy",
39    "$EXT_INNERKITS_ROOT/include",
40    "$EXT_INNERKITS_ROOT/netshareclient/include/proxy",
41    "$EXT_INNERKITS_ROOT/netshareclient/include/proxy/ipccallback",
42    "$EXT_INNERKITS_ROOT/netvpnclient/include",
43    "$EXT_INNERKITS_ROOT/netvpnclient/include/ipc",
44    "$EXT_SECURITY_PATH/security",
45    "$NETMANAGER_EXT_ROOT/services/vpnmanager/include",
46    "$NETMANAGER_EXT_ROOT/services/vpnmanager/include/ipc",
47    "$NETMANAGER_EXT_ROOT/test/netmanager_ext_mock_test",
48    "$NETSYSCONTROLLER_ROOT_DIR/include",
49  ]
50
51  deps = [
52    "$EXT_INNERKITS_ROOT/netvpnclient:net_vpn_manager_if",
53    "$NETMANAGER_EXT_ROOT/services/vpnmanager:net_vpn_manager_static",
54    "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common",
55  ]
56
57  external_deps = [
58    "ability_runtime:app_manager",
59    "access_token:libaccesstoken_sdk",
60    "access_token:libnativetoken",
61    "access_token:libtoken_setproc",
62    "bundle_framework:appexecfwk_base",
63    "bundle_framework:appexecfwk_core",
64    "cJSON:cjson",
65    "eventhandler:libeventhandler",
66    "ffrt:libffrt",
67    "hilog:libhilog",
68    "ipc:ipc_core",
69    "netmanager_base:net_manager_common",
70    "os_account:os_account_innerkits",
71  ]
72
73  defines = [
74    "NETMGR_LOG_TAG = \"NetworkVpnManager\"",
75    "LOG_DOMAIN = 0xD0015B0",
76  ]
77
78  if (enable_netmgr_ext_debug) {
79    defines += [ "NETMGR_DEBUG" ]
80  }
81
82  subsystem_name = "communication"
83  part_name = "netmanager_ext"
84  module_out_path = "netmanager_ext/vpn_manager_test"
85}
86
87group("unittest") {
88  testonly = true
89  deps = [ ":vpn_manager_test" ]
90}
91