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("../../../../../distributedaudio.gni") 16 17module_out_path = "distributed_audio/distributed_audio/services/audiomanager/source_device_test" 18 19config("module_private_config") { 20 visibility = [ ":*" ] 21 22 include_dirs = [ 23 "include", 24 "${audio_control_path}/controlsource/include", 25 "${audio_hdi_proxy_path}/include", 26 "${audio_processor_path}/interface", 27 "${audio_transport_path}/audioctrltransport/include", 28 "${audio_transport_path}/interface", 29 "${audio_transport_path}/receiverengine/include", 30 "${audio_transport_path}/senderengine/include", 31 "${common_path}/include", 32 "${common_path}/dfx_utils/include", 33 "${distributedaudio_path}/audiohandler/include", 34 "${innerkits_path}/native_cpp/audio_source/include", 35 "${innerkits_path}/native_cpp/audio_sink/include", 36 "${interfaces_path}/inner_kits/native_cpp/audio_sink/include", 37 "${interfaces_path}/inner_kits/native_cpp/audio_source/include", 38 "${services_path}/audiomanager/managersource/include", 39 "${services_path}/audiomanager/test/unittest/audiomanagertestutils/include", 40 "${services_path}/common/audioparam", 41 "${services_path}/common/audiodata/include", 42 "${services_path}/common/audioeventcallback", 43 ] 44 45 if (distributed_audio_extension_sa) { 46 include_dirs += [ 47 "${distributedaudio_ext_path}/services/audioprocessor/aeceffectprocessor/include", 48 "${distributedaudio_ext_path}/services/audioprocessor/effectcomponent/audiopipeline/include", 49 "${distributedaudio_ext_path}/services/audioprocessor/effectcomponent/elementfactory/include", 50 "${distributedaudio_ext_path}/services/audioprocessor/effectcomponent/elements/include", 51 "${distributedaudio_ext_path}/services/audioprocessor/effectcomponent/pipelinemanager/include", 52 ] 53 } 54} 55 56## UnitTest daudio_source_dev_test 57ohos_unittest("DaudioSourceDevTest") { 58 module_out_path = module_out_path 59 60 sources = [ "src/daudio_source_dev_test.cpp" ] 61 62 configs = [ ":module_private_config" ] 63 64 deps = [ 65 "${audio_transport_path}/receiverengine:distributed_audio_decode_transport", 66 "${audio_transport_path}/senderengine:distributed_audio_encode_transport", 67 "${services_path}/audiomanager/servicesource:distributed_audio_source", 68 "${services_path}/common:distributed_audio_utils", 69 ] 70 71 external_deps = [ 72 "audio_framework:audio_capturer", 73 "audio_framework:audio_client", 74 "audio_framework:audio_renderer", 75 "cJSON:cjson", 76 "c_utils:utils", 77 "device_manager:devicemanagersdk", 78 "distributed_hardware_fwk:distributed_av_receiver", 79 "distributed_hardware_fwk:distributed_av_sender", 80 "distributed_hardware_fwk:distributedhardwareutils", 81 "drivers_interface_distributed_audio:libdaudioext_proxy_2.1", 82 "dsoftbus:softbus_client", 83 "eventhandler:libeventhandler", 84 "googletest:gmock", 85 "hilog:libhilog", 86 "ipc:ipc_core", 87 "samgr:samgr_proxy", 88 ] 89 90 cflags = [] 91 92 if (distributed_audio_extension_sa) { 93 cflags += [ "-DECHO_CANNEL_ENABLE" ] 94 } 95 96 cflags_cc = cflags 97} 98 99## UnitTest daudio_source_dev_test 100ohos_unittest("DMicDevTest") { 101 module_out_path = module_out_path 102 103 sources = [ "src/dmic_dev_test.cpp" ] 104 105 configs = [ ":module_private_config" ] 106 107 deps = [ 108 "${audio_transport_path}/receiverengine:distributed_audio_decode_transport", 109 "${services_path}/audiomanager/servicesource:distributed_audio_source", 110 "${services_path}/common:distributed_audio_utils", 111 ] 112 113 external_deps = [ 114 "audio_framework:audio_capturer", 115 "audio_framework:audio_client", 116 "audio_framework:audio_renderer", 117 "cJSON:cjson", 118 "distributed_hardware_fwk:distributed_av_receiver", 119 "distributed_hardware_fwk:distributed_av_sender", 120 "distributed_hardware_fwk:distributedhardwareutils", 121 "distributed_hardware_fwk:libdhfwk_sdk", 122 "drivers_interface_distributed_audio:libdaudioext_proxy_2.1", 123 "dsoftbus:softbus_client", 124 "googletest:gmock", 125 "hilog:libhilog", 126 "ipc:ipc_core", 127 "samgr:samgr_proxy", 128 ] 129 130 cflags = [] 131 132 if (distributed_audio_extension_sa) { 133 cflags += [ "-DECHO_CANNEL_ENABLE" ] 134 } 135 136 cflags_cc = cflags 137} 138 139## UnitTest daudio_source_dev_test 140ohos_unittest("DSpeakerDevTest") { 141 module_out_path = module_out_path 142 143 sources = [ "src/dspeaker_dev_test.cpp" ] 144 145 configs = [ ":module_private_config" ] 146 147 deps = [ 148 "${audio_transport_path}/senderengine:distributed_audio_encode_transport", 149 "${services_path}/audiomanager/servicesource:distributed_audio_source", 150 "${services_path}/common:distributed_audio_utils", 151 ] 152 153 external_deps = [ 154 "audio_framework:audio_capturer", 155 "audio_framework:audio_client", 156 "audio_framework:audio_renderer", 157 "cJSON:cjson", 158 "c_utils:utils", 159 "distributed_hardware_fwk:distributed_av_receiver", 160 "distributed_hardware_fwk:distributed_av_sender", 161 "distributed_hardware_fwk:distributedhardwareutils", 162 "distributed_hardware_fwk:libdhfwk_sdk", 163 "drivers_interface_distributed_audio:libdaudioext_proxy_2.1", 164 "dsoftbus:softbus_client", 165 "googletest:gmock", 166 "hilog:libhilog", 167 "ipc:ipc_core", 168 "samgr:samgr_proxy", 169 ] 170} 171 172## UnitTest daudio_source_dev_test 173ohos_unittest("DAudioEchoCannelManagerTest") { 174 module_out_path = module_out_path 175 176 cflags = [ 177 "-g", 178 "-O0", 179 "-Wno-unused-variable", 180 "-fno-omit-frame-pointer", 181 "-Dprivate=public", 182 "-Dprotected=public", 183 ] 184 185 if (distributed_audio_extension_sa) { 186 sources = [ "src/daudio_echo_cannel_manager_test.cpp" ] 187 } 188 189 configs = [ ":module_private_config" ] 190 191 deps = [ 192 "${audio_transport_path}/receiverengine:distributed_audio_decode_transport", 193 "${audio_transport_path}/senderengine:distributed_audio_encode_transport", 194 "${services_path}/audiomanager/servicesource:distributed_audio_source", 195 "${services_path}/common:distributed_audio_utils", 196 ] 197 198 external_deps = [ 199 "audio_framework:audio_capturer", 200 "audio_framework:audio_client", 201 "audio_framework:audio_renderer", 202 "cJSON:cjson", 203 "c_utils:utils", 204 "distributed_hardware_fwk:distributed_av_receiver", 205 "distributed_hardware_fwk:distributed_av_sender", 206 "distributed_hardware_fwk:distributedhardwareutils", 207 "distributed_hardware_fwk:libdhfwk_sdk", 208 "drivers_interface_distributed_audio:libdaudioext_proxy_2.1", 209 "dsoftbus:softbus_client", 210 "eventhandler:libeventhandler", 211 "googletest:gmock", 212 "hilog:libhilog", 213 "ipc:ipc_core", 214 "samgr:samgr_proxy", 215 ] 216 217 if (distributed_audio_extension_sa) { 218 cflags += [ "-DECHO_CANNEL_ENABLE" ] 219 } 220 221 cflags_cc = cflags 222} 223 224group("daudio_source_dev_test") { 225 testonly = true 226 deps = [ 227 ":DAudioEchoCannelManagerTest", 228 ":DMicDevTest", 229 ":DSpeakerDevTest", 230 ":DaudioSourceDevTest", 231 ] 232} 233