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_manager_test") { 18 module_out_path = "netmanager_base/netmanager_base/net_policy_manager_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_callback_proxy_test.cpp", 30 "net_policy_callback_test.cpp", 31 "net_policy_exception_service_test.cpp", 32 "net_policy_manager_test.cpp", 33 "net_policy_service_stub_test.cpp", 34 "net_policy_setting_test.cpp", 35 "ut_firewall_rule.cpp", 36 "ut_net_policy_callback.cpp", 37 "ut_net_policy_callback_ipc.cpp", 38 "ut_net_policy_callback_stub.cpp", 39 "ut_net_policy_client.cpp", 40 "ut_net_policy_core.cpp", 41 "ut_net_policy_event_handler.cpp", 42 "ut_net_policy_file.cpp", 43 "ut_net_policy_firewall.cpp", 44 "ut_net_policy_rule.cpp", 45 "ut_net_policy_service.cpp", 46 "ut_net_policy_service_common.cpp", 47 "ut_net_policy_traffic.cpp", 48 "ut_net_quota_policy.cpp", 49 "ut_netsys_policy_wrapper.cpp", 50 "net_access_policy_test.cpp", 51 "net_policy_db_clone_test.cpp", 52 "net_access_policy_config_test.cpp", 53 ] 54 55 include_dirs = [ 56 "$INNERKITS_ROOT/netpolicyclient/include", 57 "$NETPOLICYMANAGER_SOURCE_DIR/include", 58 "$NETPOLICYMANAGER_SOURCE_DIR/include/stub", 59 "$INNERKITS_ROOT/netconnclient/include", 60 "$NETCONNMANAGER_COMMON_DIR/include", 61 "$NETSYSCONTROLLER_ROOT_DIR/include", 62 "$NETMANAGER_BASE_ROOT/test/commonduplicatedcode", 63 "$NETMANAGER_BASE_ROOT/test/security", 64 "$NETMANAGER_BASE_ROOT/test/netpolicymanager/mock", 65 ] 66 67 deps = [ 68 "$INNERKITS_ROOT/netpolicyclient:net_policy_manager_if", 69 "$NETCONNMANAGER_COMMON_DIR:net_service_common", 70 "$NETMANAGER_BASE_ROOT/services/netpolicymanager:net_policy_manager_static", 71 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 72 ] 73 74 external_deps = [ 75 "ability_base:want", 76 "ability_runtime:app_manager", 77 "ability_runtime:wantagent_innerkits", 78 "access_token:libaccesstoken_sdk", 79 "access_token:libnativetoken", 80 "access_token:libtoken_setproc", 81 "bundle_framework:appexecfwk_base", 82 "bundle_framework:appexecfwk_core", 83 "cJSON:cjson", 84 "common_event_service:cesfwk_core", 85 "common_event_service:cesfwk_innerkits", 86 "eventhandler:libeventhandler", 87 "ffrt:libffrt", 88 "hitrace:hitrace_meter", 89 "ipc:ipc_core", 90 "netmanager_base:net_conn_manager_if", 91 "netmanager_base:net_stats_manager_if", 92 "relational_store:native_rdb", 93 "safwk:system_ability_fwk", 94 "samgr:samgr_proxy", 95 "time_service:time_client", 96 "config_policy:configpolicy_util", 97 ] 98 99 defines = [ 100 "NETMGR_LOG_TAG = \"NetPolicyUT\"", 101 "LOG_DOMAIN = 0xD0015B0", 102 "private = public", 103 ] 104 105 if (enable_netmgr_debug) { 106 defines += [ "NETMGR_DEBUG" ] 107 } 108 109 external_deps += [ "hilog:libhilog" ] 110 111 part_name = "netmanager_base" 112 subsystem_name = "communication" 113} 114