1# Copyright (c) 2021-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/test.gni") 15import("//foundation/communication/netmanager_base/netmanager_base_config.gni") 16 17ohos_unittest("net_policy_manager_test") { 18 module_out_path = "netmanager_base/net_policy_manager_test" 19 sanitize = { 20 cfi = true 21 cfi_cross_dso = true 22 debug = false 23 } 24 sources = [ 25 "net_policy_callback_proxy_test.cpp", 26 "net_policy_callback_test.cpp", 27 "net_policy_exception_service_test.cpp", 28 "net_policy_manager_test.cpp", 29 "net_policy_service_stub_test.cpp", 30 "net_policy_setting_test.cpp", 31 "ut_firewall_rule.cpp", 32 "ut_net_policy_base.cpp", 33 "ut_net_policy_callback.cpp", 34 "ut_net_policy_callback_ipc.cpp", 35 "ut_net_policy_callback_stub.cpp", 36 "ut_net_policy_client.cpp", 37 "ut_net_policy_core.cpp", 38 "ut_net_policy_event_handler.cpp", 39 "ut_net_policy_file.cpp", 40 "ut_net_policy_firewall.cpp", 41 "ut_net_policy_rule.cpp", 42 "ut_net_policy_service_common.cpp", 43 "ut_net_policy_traffic.cpp", 44 "ut_net_quota_policy.cpp", 45 "ut_netsys_policy_wrapper.cpp", 46 ] 47 48 include_dirs = [ 49 "$INNERKITS_ROOT/netpolicyclient/include", 50 "$INNERKITS_ROOT/netpolicyclient/include/proxy", 51 "$NETPOLICYMANAGER_SOURCE_DIR/include", 52 "$NETPOLICYMANAGER_SOURCE_DIR/include/stub", 53 "$INNERKITS_ROOT/netconnclient/include", 54 "$NETCONNMANAGER_COMMON_DIR/include", 55 "$NETSYSCONTROLLER_ROOT_DIR/include", 56 ] 57 58 deps = [ 59 "$INNERKITS_ROOT/netpolicyclient:net_policy_manager_if", 60 "$NETCONNMANAGER_COMMON_DIR:net_service_common", 61 "$NETMANAGER_BASE_ROOT/services/netpolicymanager:net_policy_manager_static", 62 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 63 ] 64 65 external_deps = [ 66 "ability_base:want", 67 "ability_runtime:app_manager", 68 "access_token:libaccesstoken_sdk", 69 "access_token:libnativetoken", 70 "access_token:libtoken_setproc", 71 "common_event_service:cesfwk_core", 72 "common_event_service:cesfwk_innerkits", 73 "eventhandler:libeventhandler", 74 "hitrace:hitrace_meter", 75 "ipc:ipc_core", 76 "netmanager_base:net_conn_manager_if", 77 "netmanager_base:net_stats_manager_if", 78 "safwk:system_ability_fwk", 79 "samgr:samgr_proxy", 80 ] 81 82 defines = [ 83 "NETMGR_LOG_TAG = \"NetPolicyUT\"", 84 "LOG_DOMAIN = 0xD0015B0", 85 ] 86 87 if (enable_netmgr_debug) { 88 defines += [ "NETMGR_DEBUG" ] 89 } 90 91 external_deps += [ "hilog:libhilog" ] 92 93 part_name = "netmanager_base" 94 subsystem_name = "communication" 95} 96