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