1# Copyright (c) 2022 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.
13import("//build/test.gni")
14import("../../../../../bluetooth_part.gni")
15import("../../../../../castplus_cast_engine_part.gni")
16import("../../../../../config.gni")
17import("../../../../../efficiency_manager_part.gni")
18
19module_output_path = "multimedia_av_session/session"
20
21###############################################################################
22config("module_private_config") {
23  visibility = [ ":*" ]
24
25  include_dirs = [
26    "../../include/",
27    "../../../../../../interfaces/inner_api/native/session/include/",
28    "../../../../../services/session/server/",
29    "../../../../../services/session/adapter",
30  ]
31}
32
33common_deps = [
34  "../../../../../services/session:avsession_item",
35  "../../../../../services/session:avsession_service",
36  "../../../../../utils:avsession_utils",
37  "../../../../common:avsession_common",
38  "../../../session:avsession_client",
39  "//third_party/googletest:gtest_main",
40]
41
42common_external_deps = [
43  "ability_base:want",
44  "ability_runtime:wantagent_innerkits",
45  "access_token:libaccesstoken_sdk",
46  "access_token:libnativetoken_shared",
47  "access_token:libtokensetproc_shared",
48  "audio_framework:audio_client",
49  "background_task_mgr:bgtaskmgr_innerkits",
50  "c_utils:utils",
51  "device_manager:devicemanagersdk",
52  "dsoftbus:softbus_client",
53  "hilog:libhilog",
54  "image_framework:image_native",
55  "input:libmmi-client",
56  "ipc:ipc_single",
57  "samgr:samgr_proxy",
58]
59
60ohos_unittest("AVSessionManagerTest") {
61  module_out_path = module_output_path
62
63  sources = [ "avsession_manager_test.cpp" ]
64
65  configs = [ ":module_private_config" ]
66
67  deps = common_deps
68
69  external_deps = common_external_deps
70}
71
72ohos_unittest("AVSessionControllerTest") {
73  module_out_path = module_output_path
74
75  sources = [ "avsession_controller_test.cpp" ]
76
77  configs = [ ":module_private_config" ]
78
79  deps = common_deps
80
81  external_deps = common_external_deps
82
83  external_deps += [ "ability_base:base" ]
84}
85
86ohos_unittest("AVPlaybackStateTest") {
87  module_out_path = module_output_path
88
89  sources = [ "avplayback_state_test.cpp" ]
90
91  configs = [ ":module_private_config" ]
92
93  deps = common_deps
94
95  external_deps = common_external_deps
96}
97
98ohos_unittest("AVSessionTest") {
99  module_out_path = module_output_path
100
101  sources = [ "avsession_test.cpp" ]
102
103  configs = [ ":module_private_config" ]
104
105  deps = common_deps
106
107  external_deps = common_external_deps
108
109  external_deps += [ "ability_base:base" ]
110}
111
112ohos_unittest("AVMetaDataTest") {
113  module_out_path = module_output_path
114
115  sources = [ "avmeta_data_test.cpp" ]
116
117  configs = [ ":module_private_config" ]
118
119  deps = common_deps
120
121  external_deps = common_external_deps
122}
123
124ohos_unittest("AVCallMetaDataTest") {
125  module_out_path = module_output_path
126
127  sources = [ "avcallmeta_data_test.cpp" ]
128
129  configs = [ ":module_private_config" ]
130
131  deps = common_deps
132
133  external_deps = common_external_deps
134}
135
136ohos_unittest("AVCallStateTest") {
137  module_out_path = module_output_path
138
139  sources = [ "avcall_state_test.cpp" ]
140
141  configs = [ ":module_private_config" ]
142
143  deps = common_deps
144
145  external_deps = common_external_deps
146}
147
148ohos_unittest("AVSessionPermissionTest") {
149  module_out_path = module_output_path
150
151  sources = [ "avsession_permission_test.cpp" ]
152
153  configs = [ ":module_private_config" ]
154
155  deps = common_deps
156
157  external_deps = common_external_deps
158}
159
160ohos_unittest("AVSessionRemoteTest") {
161  module_out_path = module_output_path
162
163  sources = [ "avsession_remote_test.cpp" ]
164
165  configs = [ ":module_private_config" ]
166
167  if (castplus_cast_engine_enable) {
168    cflags = [ "-DCASTPLUS_CAST_ENGINE_ENABLE" ]
169  }
170
171  deps = common_deps
172
173  external_deps = common_external_deps
174}
175
176ohos_unittest("AVMediaDescriptionTest") {
177  module_out_path = module_output_path
178
179  sources = [ "avmedia_description_test.cpp" ]
180
181  configs = [ ":module_private_config" ]
182
183  deps = common_deps
184
185  external_deps = common_external_deps
186}
187
188ohos_unittest("AVDumperTest") {
189  module_out_path = module_output_path
190
191  sources = [ "avsession_dumper_test.cpp" ]
192
193  configs = [ ":module_private_config" ]
194
195  deps = common_deps
196
197  visibility = [ ":*" ]
198
199  include_dirs = [
200    "../../include/",
201    "../../../../../../interfaces/inner_api/native/session/include/",
202    "../../../../../services/session/adapter",
203    "../../../../../services/session/server/",
204    "../../../../../services/session/server/remote",
205  ]
206
207  external_deps = common_external_deps
208  cflags = []
209
210  if (bluetooth_part_enable) {
211    cflags = [ "-DBLUETOOTH_ENABLE" ]
212    external_deps += [ "bluetooth:btframework" ]
213  }
214
215  if (efficiency_manager_enable_in_avsession) {
216    cflags += [ "-DEFFICIENCY_MANAGER_ENABLE" ]
217  }
218
219  if (multimedia_av_session_enable_trace_control) {
220    cflags += [ "-DENBABLE_AVSESSION_TRACE_CONTROL" ]
221    external_deps += [ "hitrace:hitrace_meter" ]
222  }
223
224  if (multimedia_av_session_enable_sysevent_control) {
225    cflags += [ "-DENABLE_AVSESSION_SYSEVENT_CONTROL" ]
226    external_deps += [ "hisysevent:libhisysevent" ]
227  }
228}
229
230if (castplus_cast_engine_enable) {
231  ohos_unittest("AVCastControllerTest") {
232    module_out_path = module_output_path
233
234    sources = [ "avcast_controller_test.cpp" ]
235
236    configs = [ ":module_private_config" ]
237
238    cflags = [ "-DCASTPLUS_CAST_ENGINE_ENABLE" ]
239
240    deps = common_deps
241
242    deps += [
243      "../../../../../services/session:avsession_cast_item",
244      "../../../../../services/session:avsession_router",
245    ]
246
247    visibility = [ ":*" ]
248
249    include_dirs = [
250      "../../include/",
251      "../../../../../../interfaces/inner_api/native/session/include/",
252      "../../../../../services/session/adapter",
253      "../../../../../services/session/ipc/server",
254      "../../../../../services/session/server/",
255      "../../../../../services/session/server/remote",
256    ]
257
258    external_deps = common_external_deps
259
260    external_deps += [
261      "ability_base:want",
262      "ability_runtime:app_manager",
263      "ability_runtime:wantagent_innerkits",
264      "access_token:libaccesstoken_sdk",
265      "access_token:libtokenid_sdk",
266      "audio_framework:audio_client",
267      "bundle_framework:appexecfwk_base",
268      "bundle_framework:appexecfwk_core",
269      "c_utils:utils",
270      "cast_engine:cast_engine_client",
271      "data_object:distributeddataobject_impl",
272      "device_manager:devicemanagersdk",
273      "hilog:libhilog",
274      "input:libmmi-client",
275      "ipc:ipc_single",
276      "safwk:system_ability_fwk",
277      "samgr:samgr_proxy",
278    ]
279  }
280}
281
282###############################################################################
283group("av_session_unittest") {
284  testonly = true
285
286  deps = [
287    ":AVCallMetaDataTest",
288    ":AVCallStateTest",
289    ":AVDumperTest",
290    ":AVMediaDescriptionTest",
291    ":AVMetaDataTest",
292    ":AVPlaybackStateTest",
293    ":AVSessionControllerTest",
294    ":AVSessionManagerTest",
295    ":AVSessionPermissionTest",
296    ":AVSessionRemoteTest",
297    ":AVSessionTest",
298  ]
299
300  if (castplus_cast_engine_enable) {
301    deps += [ ":AVCastControllerTest" ]
302  }
303}
304###############################################################################
305