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_policy_service_test") {
18  module_out_path = "netmanager_base/net_policy_service_test"
19  sanitize = {
20    cfi = true
21    cfi_cross_dso = true
22    debug = false
23  }
24
25  branch_protector_ret = "pac_ret"
26
27  sources = [
28    "$NETMANAGER_BASE_ROOT/test/security/netmanager_base_test_security.cpp",
29    "net_policy_service_test.cpp",
30  ]
31
32  include_dirs = [
33    "$INNERKITS_ROOT/netpolicyclient/include",
34    "$NETPOLICYMANAGER_SOURCE_DIR/include",
35    "$NETPOLICYMANAGER_SOURCE_DIR/include/stub",
36    "$INNERKITS_ROOT/netconnclient/include",
37    "$NETCONNMANAGER_COMMON_DIR/include",
38    "$NETSYSCONTROLLER_ROOT_DIR/include",
39    "$NETMANAGER_BASE_ROOT/test/commonduplicatedcode",
40    "$NETMANAGER_BASE_ROOT/test/security",
41  ]
42
43  deps = [
44    "$INNERKITS_ROOT/netpolicyclient:net_policy_manager_if",
45    "$NETCONNMANAGER_COMMON_DIR:net_service_common",
46    "$NETMANAGER_BASE_ROOT/services/netpolicymanager:net_policy_manager_static",
47    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
48  ]
49
50  external_deps = [
51    "ability_base:want",
52    "ability_runtime:app_manager",
53    "access_token:libaccesstoken_sdk",
54    "access_token:libnativetoken",
55    "access_token:libtoken_setproc",
56    "bundle_framework:appexecfwk_base",
57    "bundle_framework:appexecfwk_core",
58    "cJSON:cjson",
59    "common_event_service:cesfwk_core",
60    "common_event_service:cesfwk_innerkits",
61    "eventhandler:libeventhandler",
62    "ffrt:libffrt",
63    "hitrace:hitrace_meter",
64    "ipc:ipc_core",
65    "netmanager_base:net_conn_manager_if",
66    "netmanager_base:net_stats_manager_if",
67    "relational_store:native_rdb",
68    "safwk:system_ability_fwk",
69    "samgr:samgr_proxy",
70  ]
71
72  defines = [
73    "NETMGR_LOG_TAG = \"NetPolicyUT\"",
74    "LOG_DOMAIN = 0xD0015B0",
75  ]
76
77  if (enable_netmgr_debug) {
78    defines += [ "NETMGR_DEBUG" ]
79  }
80
81  external_deps += [ "hilog:libhilog" ]
82
83  part_name = "netmanager_base"
84  subsystem_name = "communication"
85}
86