1# Copyright (c) 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("netsys_dnsresolv_test") { 18 module_out_path = "netmanager_base/dnsresolv_test" 19 20 sanitize = { 21 cfi = true 22 cfi_cross_dso = true 23 debug = false 24 } 25 26 branch_protector_ret = "pac_ret" 27 28 sources = [ 29 "dns_proxy_request_socket_test.cpp", 30 "dns_quality_diag_test.cpp", 31 "dns_quality_event_handler_test.cpp", 32 "dns_resolv_listen_test.cpp", 33 "net_dns_health_callback_proxy_test.cpp", 34 "net_dns_result_callback_proxy_test.cpp", 35 ] 36 37 include_dirs = [ 38 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR", 39 "$INNERKITS_ROOT/netmanagernative/include", 40 "$NETSYSNATIVE_SOURCE_DIR/include/manager", 41 "$NETSYSNATIVE_SOURCE_DIR/include/netsys", 42 "$FWMARK_CLIENT_DIR/include", 43 "$NETMANAGERNATIVE_ROOT/include", 44 "$NETMANAGERNATIVE_ROOT/include/netsys/wrapper", 45 "$NETMANAGER_BASE_ROOT/services/common/include", 46 "$NETMANAGER_BASE_ROOT/services/netmanagernative/bpf/include", 47 "$NETMANAGER_BASE_ROOT/services/netmanagernative/src/netsys", 48 "$NETMANAGER_BASE_ROOT/test/commonduplicatedcode", 49 "$NETSYSCONTROLLER_ROOT_DIR/include", 50 "$NETMANAGERNATIVE_ROOT/src/netsys/dnsresolv", 51 "$INNERKITS_ROOT/netconnclient/include", 52 "$INNERKITS_ROOT/netconnclient/include/proxy", 53 ] 54 55 deps = [ 56 "$FWMARK_CLIENT_DIR:fwmark_client", 57 "$NETMANAGERNATIVE_ROOT:netsys_client", 58 "$NETMANAGER_BASE_ROOT/services/netmanagernative:netsys_native_manager_static", 59 "$NETMANAGER_BASE_ROOT/services/netmanagernative/bpf:netsys_bpf_utils", 60 "$NETMANAGER_BASE_ROOT/services/netsyscontroller:netsys_controller", 61 ] 62 63 external_deps = [ 64 "ability_base:want", 65 "bundle_framework:appexecfwk_base", 66 "bundle_framework:appexecfwk_core", 67 "cJSON:cjson", 68 "c_utils:utils", 69 "dhcp:dhcp_sdk", 70 "ffrt:libffrt", 71 "googletest:gmock_main", 72 "init:libbegetutil", 73 "ipc:ipc_core", 74 "safwk:system_ability_fwk", 75 "samgr:samgr_proxy", 76 ] 77 78 defines = [ 79 "NETMGRNATIVE_LOG_TAG = \"NetsysNativeService\"", 80 "LOG_DOMAIN = 0xD0015B0", 81 ] 82 83 external_deps += [ "hilog:libhilog" ] 84 85 part_name = "netmanager_base" 86 subsystem_name = "communication" 87} 88 89ohos_unittest("netsys_dnsresolv_mock_test") { 90 module_out_path = "netmanager_base/dnsresolv_test" 91 92 sanitize = { 93 cfi = true 94 cfi_cross_dso = true 95 debug = false 96 } 97 98 branch_protector_ret = "pac_ret" 99 100 sources = [ "../mock/src/parcel.cpp" ] 101 102 sources += [ 103 "$NETMANAGERNATIVE_ROOT/src/netsys/dnsresolv/netsys_net_dns_health_data.cpp", 104 "$NETMANAGERNATIVE_ROOT/src/netsys/dnsresolv/netsys_net_dns_result_data.cpp", 105 ] 106 107 include_dirs = [ 108 "$INNERKITS_ROOT/netmanagernative/include", 109 "$INNERKITS_ROOT/netconnclient/include", 110 "$INNERKITS_ROOT/netconnclient/include/proxy", 111 "$NETMANAGER_BASE_ROOT/test/commonduplicatedcode", 112 "$NETMANAGER_BASE_ROOT/test/netmanagernative/unittest/mock/include", 113 "$NETMANAGERNATIVE_ROOT/include/netsys", 114 ] 115 116 deps = [ 117 "$NETMANAGERNATIVE_ROOT:netsys_client", 118 "$NETMANAGER_BASE_ROOT/services/netmanagernative:netsys_native_manager_static", 119 ] 120 121 external_deps = [ 122 "ability_base:want", 123 "bundle_framework:appexecfwk_base", 124 "bundle_framework:appexecfwk_core", 125 "c_utils:utils", 126 "ffrt:libffrt", 127 "googletest:gmock_main", 128 "hilog:libhilog", 129 "ipc:ipc_core", 130 "safwk:system_ability_fwk", 131 "samgr:samgr_proxy", 132 ] 133 134 defines = [ 135 "NETMGRNATIVE_LOG_TAG = \"NetsysNativeService\"", 136 "LOG_DOMAIN = 0xD0015B0", 137 ] 138 139 part_name = "netmanager_base" 140 subsystem_name = "communication" 141} 142