1# Copyright (c) 2021 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("netfirewallmanager_test") {
20  module_out_path = "netmanager_ext/netfirewallmanager_test"
21
22  sources = [
23    "$EXT_SECURITY_PATH/security/netmanager_ext_test_security.cpp",
24    "netfirewall_client_test.cpp",
25    "netfirewall_common_test.cpp",
26    "netfirewall_default_rule_parser_test.cpp",
27    "netfirewall_hisysevent_test.cpp",
28    "netfirewall_rule_manager_test.cpp",
29    "netfirewall_rule_native_helper_test.cpp",
30    "netfirewall_service_proxy_test.cpp",
31    "netfirewall_service_stub_test.cpp",
32    "netfirewall_service_test.cpp",
33  ]
34
35  include_dirs = [
36    "$EXT_INNERKITS_ROOT/include",
37    "$EXT_SECURITY_PATH/security",
38    "$BASE_INNERKITS_ROOT/netconnclient/include",
39    "$BASE_INNERKITS_ROOT/include",
40    "$NETSYSCONTROLLER_ROOT_DIR/include",
41    "$NETCONNMANAGER_COMMON_DIR/include",
42    "$NETFIREWALLMANAGER_SOURCE_DIR/include",
43    "$EXT_INNERKITS_ROOT/netfirewallclient/include",
44    "$NETMANAGER_EXT_ROOT/test/netmanager_ext_mock_test",
45  ]
46
47  deps = [
48    "$BASE_INNERKITS_ROOT/netconnclient:net_conn_parcel",
49    "$EXT_INNERKITS_ROOT/netfirewallclient:netfirewall_manager_if",
50    "$EXT_INNERKITS_ROOT/netfirewallclient:netfirewall_parcel",
51    "$NETCONNMANAGER_COMMON_DIR:net_service_common",
52    "$NETFIREWALLMANAGER_SOURCE_DIR:netfirewall_manager_static",
53    "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common",
54    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
55  ]
56
57  external_deps = [
58    "access_token:libaccesstoken_sdk",
59    "access_token:libnativetoken",
60    "access_token:libtoken_setproc",
61    "bundle_framework:appexecfwk_base",
62    "bundle_framework:appexecfwk_core",
63    "cJSON:cjson",
64    "dhcp:dhcp_sdk",
65    "eventhandler:libeventhandler",
66    "ffrt:libffrt",
67    "hilog:libhilog",
68    "hilog:libhilog",
69    "ipc:ipc_core",
70    "netmanager_base:net_native_manager_if",
71    "os_account:os_account_innerkits",
72    "relational_store:native_rdb",
73  ]
74
75  defines = [
76    "NETMGR_LOG_TAG = \"NetFirewallManagerTest\"",
77    "LOG_DOMAIN = 0xD0015B0",
78  ]
79
80  if (enable_netmgr_ext_debug) {
81    defines += [ "NETMGR_DEBUG" ]
82  }
83
84  configs = [ "$NETMANAGER_EXT_ROOT/resource:coverage_flags" ]
85
86  part_name = "netmanager_ext"
87  subsystem_name = "communication"
88}
89
90group("unittest") {
91  testonly = true
92  deps = [ ":netfirewallmanager_test" ]
93}
94