1# Copyright (c) 2022-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_ext/netmanager_ext_config.gni")
16
17EXT_SECURITY_PATH = "../../.."
18
19ohos_unittest("networkshare_manager_test") {
20  sanitize = {
21    cfi = true
22    cfi_cross_dso = true
23    blocklist = "./cfi_blocklist.txt"
24    debug = false
25  }
26
27  branch_protector_ret = "pac_ret"
28
29  module_out_path = "netmanager_ext/networkshare_manager_test"
30
31  sources = [
32    "$EXT_SECURITY_PATH/security/netmanager_ext_test_security.cpp",
33    "interface_configuration_test.cpp",
34    "netshare_result_callback_proxy_test.cpp",
35    "netshare_result_callback_stub_test.cpp",
36    "networkshare_hisysevent_test.cpp",
37    "networkshare_main_statemachine_test.cpp",
38    "networkshare_request_parcel_test.cpp",
39    "networkshare_service_stub_test.cpp",
40    "networkshare_service_test.cpp",
41    "networkshare_upstreammonitor_test.cpp",
42    "sharing_event_callback_proxy_test.cpp",
43    "sharing_event_callback_stub_test.cpp",
44    "static_configuration_test.cpp",
45  ]
46
47  include_dirs = [
48    "$BASE_INNERKITS_ROOT/netconnclient/include/proxy",
49    "$NETMANAGER_BASE_ROOT/utils/errorcode_utils/include",
50    "$BLUETOOTH_ROOT/interfaces/inner_api/include",
51    "$EXT_INNERKITS_ROOT/ethernetclient/include",
52    "$EXT_INNERKITS_ROOT/include",
53    "$EXT_INNERKITS_ROOT/netshareclient/include",
54    "$EXT_INNERKITS_ROOT/netshareclient/include/proxy",
55    "$EXT_INNERKITS_ROOT/netshareclient/include/proxy/ipccallback",
56    "$EXT_SECURITY_PATH/security",
57    "$NETMANAGER_EXT_ROOT/services/networksharemanager/include",
58    "$NETMANAGER_EXT_ROOT/services/networksharemanager/include/stub",
59    "$NETMANAGER_EXT_ROOT/test/netmanager_ext_mock_test",
60    "$NETSYSCONTROLLER_ROOT_DIR/include",
61    "$THIRD_PARTY_ROOT/openssl/include",
62    "$USB_MANAGER_ROOT/utils/native/include",
63    "$USB_MANAGER_ROOT/services/zidl/include",
64  ]
65
66  defines = []
67  if (communication_wifi_switch_enable) {
68    defines += [ "WIFI_MODOULE" ]
69    include_dirs += [
70      "$WIFI_MANAGER_ROOT/interfaces/kits/c",
71      "$WIFI_MANAGER_ROOT/frameworks/native/interfaces",
72    ]
73  }
74  if (communication_bluetooth_switch_enable) {
75    defines += [ "BLUETOOTH_MODOULE" ]
76  }
77
78  deps = [
79    "$EXT_INNERKITS_ROOT/ethernetclient:ethernet_parcel",
80    "$EXT_INNERKITS_ROOT/netshareclient:net_tether_manager_if",
81    "$NETMANAGER_EXT_ROOT/services/networksharemanager:net_tether_manager_static",
82    "$NETMANAGER_EXT_ROOT/utils:net_event_report",
83    "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common",
84    "$THIRD_PARTY_ROOT/googletest:gmock_main",
85  ]
86
87  external_deps = [
88    "access_token:libaccesstoken_sdk",
89    "access_token:libnativetoken",
90    "access_token:libtoken_setproc",
91    "dhcp:dhcp_sdk",
92    "eventhandler:libeventhandler",
93    "ffrt:libffrt",
94    "ipc:ipc_core",
95  ]
96
97  if (communication_wifi_switch_enable) {
98    defines += [ "WIFI_MODOULE" ]
99    external_deps += [ "wifi:wifi_sdk" ]
100  }
101
102  if (usb_manager_enable) {
103    defines += [ "USB_MODOULE" ]
104    external_deps += [
105      "drivers_interface_usb:usb_idl_headers",
106      "usb_manager:usbsrv_client",
107    ]
108  }
109
110  defines += [
111    "NETMGR_LOG_TAG = \"NetworkShareManager\"",
112    "LOG_DOMAIN = 0xD0015B0",
113  ]
114
115  if (enable_netmgr_ext_debug) {
116    defines += [ "NETMGR_DEBUG" ]
117  }
118
119  external_deps += [ "hilog:libhilog" ]
120
121  part_name = "netmanager_ext"
122  subsystem_name = "communication"
123}
124