1# Copyright (c) 2024-2025 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("../../../../dsoftbus.gni") 16 17module_output_path = "dsoftbus/soft_bus/frame" 18dsoftbus_root_path = "../../../.." 19softbus_adapter_common = "${dsoftbus_root_path}/adapter/common" 20 21ohos_unittest("SoftbusServerStubTest") { 22 module_out_path = module_output_path 23 sources = [ 24 "mock/softbus_server_stub_test_mock.cpp", 25 "softbus_server_stub_test.cpp", 26 ] 27 28 include_dirs = [ 29 "$dsoftbus_dfx_path/interface/include", 30 "$dsoftbus_dfx_path/interface/include/form", 31 "$dsoftbus_root_path/adapter/common/include", 32 "$dsoftbus_root_path/core/adapter/bus_center/include", 33 "$dsoftbus_root_path/core/authentication/interface", 34 "$dsoftbus_root_path/core/bus_center/interface", 35 "$dsoftbus_root_path/core/bus_center/ipc/include", 36 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include", 37 "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include", 38 "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include", 39 "$dsoftbus_root_path/core/common/include", 40 "$dsoftbus_root_path/core/common/security/permission/include", 41 "$dsoftbus_root_path/core/connection/interface", 42 "$dsoftbus_root_path/core/discovery/interface", 43 "$dsoftbus_root_path/core/discovery/manager/include", 44 "$dsoftbus_root_path/core/frame/common/include", 45 "$dsoftbus_root_path/core/frame/standard/init/include", 46 "$dsoftbus_root_path/core/frame/standard/init/src", 47 "$dsoftbus_root_path/core/transmission/common/include", 48 "$dsoftbus_root_path/core/transmission/ipc/include", 49 "$dsoftbus_root_path/core/transmission/session/cpp/include", 50 "$dsoftbus_root_path/core/transmission/session/include", 51 "$dsoftbus_root_path/core/transmission/trans_channel/common/include", 52 "$dsoftbus_root_path/core/transmission/trans_channel/manager/include", 53 "$dsoftbus_root_path/core/transmission/trans_channel/tcp_direct/include", 54 "$dsoftbus_root_path/interfaces/kits/authentication", 55 "$dsoftbus_root_path/interfaces/kits/bus_center", 56 "$dsoftbus_root_path/interfaces/kits/common", 57 "$dsoftbus_root_path/interfaces/kits/connect", 58 "$dsoftbus_root_path/interfaces/kits/connection", 59 "$dsoftbus_root_path/interfaces/kits/disc", 60 "$dsoftbus_root_path/interfaces/kits/discovery", 61 "$dsoftbus_root_path/interfaces/kits/lnn", 62 "$dsoftbus_root_path/interfaces/kits/transport", 63 "$dsoftbus_root_path/tests/core/frame/unittest/mock", 64 "$dsoftbus_root_path/tests/sdk/common/include", 65 ] 66 67 deps = [ 68 "$dsoftbus_root_path/adapter:softbus_adapter", 69 "$dsoftbus_root_path/core/common:softbus_utils", 70 "$dsoftbus_root_path/core/frame:softbus_server", 71 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 72 "$dsoftbus_root_path/tests/sdk:softbus_client_static", 73 ] 74 75 if (is_standard_system) { 76 external_deps = [ 77 "c_utils:utils", 78 "dsoftbus:softbus_client", 79 "googletest:gmock", 80 "hilog:libhilog", 81 "ipc:ipc_single", 82 "safwk:system_ability_fwk", 83 "samgr:samgr_proxy", 84 ] 85 if (has_ces_part) { 86 external_deps += [ "common_event_service:cesfwk_innerkits" ] 87 } 88 } 89 if (dsoftbus_access_token_feature) { 90 external_deps += [ 91 "access_token:libaccesstoken_sdk", 92 "access_token:libprivacy_sdk", 93 "access_token:libtokenid_sdk", 94 "cJSON:cjson_static", 95 ] 96 } 97 if (!defined(global_parts_info) || 98 defined(global_parts_info.bundlemanager_bundle_framework)) { 99 cflags = [ "-DSUPPORT_BUNDLENAME" ] 100 external_deps += [ 101 "bundle_framework:appexecfwk_base", 102 "bundle_framework:appexecfwk_core", 103 "os_account:libaccountkits", 104 "os_account:os_account_innerkits", 105 ] 106 } 107} 108 109ohos_unittest("SoftbusServerTest") { 110 module_out_path = module_output_path 111 sources = [ 112 "mock/softbus_server_test_mock.cpp", 113 "softbus_server_test.cpp", 114 ] 115 116 include_dirs = [ 117 "$dsoftbus_root_path/core/bus_center/extend/include", 118 "$dsoftbus_root_path/core/bus_center/interface", 119 "$dsoftbus_root_path/core/bus_center/ipc/include", 120 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include", 121 "$dsoftbus_root_path/core/connection/general", 122 "$dsoftbus_root_path/core/connection/ipc/include", 123 "$dsoftbus_root_path/core/discovery/interface", 124 "$dsoftbus_root_path/core/discovery/manager/include", 125 "$dsoftbus_root_path/core/frame/standard/client_manager/include", 126 "$dsoftbus_root_path/core/frame/standard/init/include", 127 "$dsoftbus_root_path/core/frame/standard/init/src", 128 "$dsoftbus_root_path/core/transmission/broadcast/include", 129 "$dsoftbus_root_path/core/transmission/session/include", 130 "$dsoftbus_root_path/core/transmission/trans_channel/manager/include", 131 "$dsoftbus_root_path/interfaces/kits/bus_center", 132 "$dsoftbus_root_path/interfaces/kits/bus_center/enhance", 133 "$dsoftbus_root_path/interfaces/kits/connection", 134 "$dsoftbus_root_path/interfaces/kits/disc", 135 "$dsoftbus_root_path/tests/core/frame/unittest/mock", 136 ] 137 138 deps = [ 139 "$dsoftbus_root_path/core/common:softbus_utils", 140 "$dsoftbus_root_path/core/frame:softbus_server", 141 "$dsoftbus_root_path/dfx/dumper/legacy:softbus_dfx_dump", 142 ] 143 144 if (is_standard_system) { 145 external_deps = [ 146 "c_utils:utils", 147 "dsoftbus:softbus_client", 148 "googletest:gmock", 149 "hilog:libhilog", 150 "ipc:ipc_single", 151 "safwk:system_ability_fwk", 152 "samgr:samgr_proxy", 153 ] 154 } 155} 156 157ohos_unittest("SoftbusClientInfoManagerTest") { 158 module_out_path = module_output_path 159 sources = [ "softbus_client_info_manager_test.cpp" ] 160 161 include_dirs = [ 162 "$dsoftbus_root_path/core/frame/standard/client_manager/include", 163 "$dsoftbus_root_path/core/transmission/ipc/include", 164 ] 165 166 deps = [ 167 "$dsoftbus_root_path/core/common:softbus_utils", 168 "$dsoftbus_root_path/core/frame:softbus_server", 169 ] 170 171 if (is_standard_system) { 172 external_deps = [ 173 "c_utils:utils", 174 "dsoftbus:softbus_client", 175 "googletest:gmock", 176 "hilog:libhilog", 177 "ipc:ipc_single", 178 "safwk:system_ability_fwk", 179 "samgr:samgr_proxy", 180 ] 181 } 182} 183 184ohos_unittest("SoftbusGEnhanceTest") { 185 module_out_path = module_output_path 186 sources = [ "softbus_g_enhance_test.cpp" ] 187 188 include_dirs = [ 189 "$dsoftbus_dfx_path/interface/include/form", 190 "$dsoftbus_dfx_path/interface/include/legacy", 191 "$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/interface", 192 "$dsoftbus_root_path/components/nstackx/nstackx_ctrl/interface", 193 "$dsoftbus_root_path/core/broadcast/common/include", 194 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include", 195 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include", 196 "$dsoftbus_root_path/core/discovery/ble/dispatcher/include", 197 "$dsoftbus_root_path/core/discovery/interface", 198 "$dsoftbus_root_path/core/discovery/manager/include", 199 "$dsoftbus_root_path/core/discovery/usb/dispatcher/include", 200 "$dsoftbus_root_path/core/frame/init/include", 201 "$dsoftbus_root_path/core/transmission/ipc/include", 202 ] 203 204 deps = [ 205 "$dsoftbus_root_path/adapter:softbus_adapter", 206 "$dsoftbus_root_path/core/common:softbus_utils", 207 "$dsoftbus_root_path/core/frame:softbus_server", 208 ] 209 210 if (is_standard_system) { 211 external_deps = [ 212 "c_utils:utils", 213 "dsoftbus:softbus_client", 214 "googletest:gmock", 215 "hilog:libhilog", 216 "ipc:ipc_single", 217 "safwk:system_ability_fwk", 218 "samgr:samgr_proxy", 219 ] 220 } 221} 222 223group("unittest") { 224 testonly = true 225 deps = [ 226 ":SoftbusClientInfoManagerTest", 227 ":SoftbusGEnhanceTest", 228 ":SoftbusServerTest", 229 ] 230 if (dsoftbus_access_token_feature) { 231 deps += [ ":SoftbusServerStubTest" ] 232 } 233} 234