• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 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/multimedia/av_codec/config.gni")
16
17module_output_path = "av_codec/av_codec/unittest"
18dash_test_sources = [
19  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/base64/base64_utils.cpp",
20  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/dash_media_downloader.cpp",
21  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/dash_mpd_downloader.cpp",
22  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/dash_segment_downloader.cpp",
23  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_adpt_set_manager.cpp",
24  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_adpt_set_node.cpp",
25  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_com_attrs_elements.cpp",
26  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_content_comp_node.cpp",
27  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_descriptor_node.cpp",
28  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_manager_util.cpp",
29  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_mpd_manager.cpp",
30  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_mpd_node.cpp",
31  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_mpd_parser.cpp",
32  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_mpd_util.cpp",
33  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_mult_seg_base_node.cpp",
34  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_period_manager.cpp",
35  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_period_node.cpp",
36  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_representation_manager.cpp",
37  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_representation_node.cpp",
38  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_seg_base_node.cpp",
39  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_seg_list_node.cpp",
40  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_seg_template_node.cpp",
41  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_seg_tmline_node.cpp",
42  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_seg_url_node.cpp",
43  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_url_type_node.cpp",
44  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/i_dash_mpd_node.cpp",
45  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/sidx_box_parser.cpp",
46  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/app_client.cpp",
47  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/downloader.cpp",
48  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/media_source_loading_request.cpp",
49  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/network_client/http_curl_client.cpp",
50  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/xml/xml_element.cpp",
51  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/xml/xml_parser.cpp",
52  "$av_codec_root_dir/test/unittest/common/http_server_demo.cpp",
53]
54config("dash_unittest_cfg") {
55  defines = [
56    "HST_ANY_WITH_NO_RTTI",
57    "MEDIA_OHOS",
58  ]
59
60  cflags = [
61    "-Wno-sign-compare",
62    "-fno-exceptions",
63    "-fno-common",
64    "-fstack-protector-all",
65    "-Wshadow",
66    "-FPIC",
67    "-FS",
68    "-O2",
69    "-D_FORTIFY_SOURCE=2",
70    "-Wformat=2",
71    "-Wdate-time",
72  ]
73
74  cflags_cc = [
75    "-std=c++17",
76    "-fno-rtti",
77  ]
78
79  include_dirs = [
80    "$av_codec_root_dir/interfaces",
81    "$av_codec_root_dir/interfaces/inner_api/native",
82    "$av_codec_root_dir/services/media_engine/plugins/source/http_source",
83    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download",
84    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/xml",
85    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/base64",
86    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash",
87    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include",
88    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include/mpd_parser",
89    "$av_codec_root_dir/test/unittest/common",
90  ]
91}
92
93ohos_unittest("dash_xml_unit_test") {
94  module_out_path = module_output_path
95  testonly = true
96  configs = [
97    ":dash_unittest_cfg",
98    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
99  ]
100  sources = dash_test_sources + [ "dash_xml_unit_test.cpp" ]
101  deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
102
103  external_deps = [
104    "c_utils:utils",
105    "curl:curl_shared",
106    "graphic_surface:surface",
107    "hilog:libhilog",
108    "init:libbegetutil",
109    "ipc:ipc_single",
110    "libxml2:libxml2",
111    "media_foundation:media_foundation",
112    "netmanager_base:net_conn_manager_if",
113    "openssl:libcrypto_shared",
114    "safwk:system_ability_fwk",
115    "samgr:samgr_proxy",
116  ]
117}
118
119ohos_unittest("dash_mpd_parser_unit_test") {
120  module_out_path = module_output_path
121  testonly = true
122  configs = [
123    ":dash_unittest_cfg",
124    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
125  ]
126  sources = dash_test_sources + [ "dash_mpd_parser_unit_test.cpp" ]
127  deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
128
129  external_deps = [
130    "c_utils:utils",
131    "curl:curl_shared",
132    "graphic_surface:surface",
133    "hilog:libhilog",
134    "init:libbegetutil",
135    "ipc:ipc_single",
136    "libxml2:libxml2",
137    "media_foundation:media_foundation",
138    "netmanager_base:net_conn_manager_if",
139    "openssl:libcrypto_shared",
140    "safwk:system_ability_fwk",
141    "samgr:samgr_proxy",
142  ]
143}
144
145ohos_unittest("dash_media_downloader_unit_test") {
146  module_out_path = module_output_path
147  testonly = true
148  configs = [
149    ":dash_unittest_cfg",
150    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
151  ]
152  sources = dash_test_sources + [ "dash_media_downloader_unit_test.cpp" ]
153  deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
154
155  external_deps = [
156    "c_utils:utils",
157    "curl:curl_shared",
158    "graphic_surface:surface",
159    "hilog:libhilog",
160    "init:libbegetutil",
161    "ipc:ipc_single",
162    "libxml2:libxml2",
163    "media_foundation:media_foundation",
164    "netmanager_base:net_conn_manager_if",
165    "openssl:libcrypto_shared",
166    "safwk:system_ability_fwk",
167    "samgr:samgr_proxy",
168  ]
169
170  resource_config_file =
171      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
172}
173
174ohos_unittest("dash_mpd_downloader_unit_test") {
175  module_out_path = module_output_path
176  testonly = true
177  configs = [
178    ":dash_unittest_cfg",
179    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
180  ]
181  sources = dash_test_sources + [ "dash_mpd_downloader_unit_test.cpp" ]
182  deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
183
184  external_deps = [
185    "c_utils:utils",
186    "curl:curl_shared",
187    "graphic_surface:surface",
188    "hilog:libhilog",
189    "init:libbegetutil",
190    "ipc:ipc_single",
191    "libxml2:libxml2",
192    "media_foundation:media_foundation",
193    "netmanager_base:net_conn_manager_if",
194    "openssl:libcrypto_shared",
195    "safwk:system_ability_fwk",
196    "samgr:samgr_proxy",
197  ]
198
199  resource_config_file =
200      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
201}
202
203ohos_unittest("dash_segment_downloader_unit_test") {
204  module_out_path = module_output_path
205  testonly = true
206  configs = [
207    ":dash_unittest_cfg",
208    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
209  ]
210  sources = dash_test_sources + [ "dash_segment_downloader_unit_test.cpp" ]
211  deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
212
213  external_deps = [
214    "c_utils:utils",
215    "curl:curl_shared",
216    "graphic_surface:surface",
217    "hilog:libhilog",
218    "init:libbegetutil",
219    "ipc:ipc_single",
220    "libxml2:libxml2",
221    "media_foundation:media_foundation",
222    "netmanager_base:net_conn_manager_if",
223    "openssl:libcrypto_shared",
224    "safwk:system_ability_fwk",
225    "samgr:samgr_proxy",
226  ]
227
228  resource_config_file =
229      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
230}
231
232ohos_unittest("dash_adpt_set_manager_unit_test") {
233  module_out_path = module_output_path
234  testonly = true
235  configs = [
236    ":dash_unittest_cfg",
237    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
238  ]
239  sources = dash_test_sources + [ "dash_adpt_set_manager_unit_test.cpp" ]
240  deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
241
242  external_deps = [
243    "c_utils:utils",
244    "curl:curl_shared",
245    "graphic_surface:surface",
246    "hilog:libhilog",
247    "init:libbegetutil",
248    "ipc:ipc_single",
249    "libxml2:libxml2",
250    "media_foundation:media_foundation",
251    "netmanager_base:net_conn_manager_if",
252    "openssl:libcrypto_shared",
253    "safwk:system_ability_fwk",
254    "samgr:samgr_proxy",
255  ]
256
257  cflags = [
258    "-Dprivate=public",
259    "-Dprotected=public",
260  ]
261
262  resource_config_file =
263      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
264}
265
266ohos_unittest("histream_dash_mpd_parser_unittest") {
267  module_out_path = module_output_path
268  testonly = true
269  configs = [
270    ":dash_unittest_cfg",
271    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
272  ]
273  sources = dash_test_sources + [ "histream_dash_mpd_parser_unittest.cpp" ]
274  deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
275
276  external_deps = [
277    "c_utils:utils",
278    "curl:curl_shared",
279    "graphic_surface:surface",
280    "hilog:libhilog",
281    "init:libbegetutil",
282    "ipc:ipc_single",
283    "libxml2:libxml2",
284    "media_foundation:media_foundation",
285    "netmanager_base:net_conn_manager_if",
286    "openssl:libcrypto_shared",
287    "safwk:system_ability_fwk",
288    "samgr:samgr_proxy",
289  ]
290
291  cflags = [
292    "-Dprivate=public",
293    "-Dprotected=public",
294  ]
295
296  resource_config_file =
297      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
298}
299
300ohos_unittest("sidx_box_parser_unittest") {
301  module_out_path = module_output_path
302  testonly = true
303  configs = [
304    ":dash_unittest_cfg",
305    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
306  ]
307  sources = dash_test_sources + [ "sidx_box_parser_unittest.cpp" ]
308  deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
309
310  external_deps = [
311    "c_utils:utils",
312    "curl:curl_shared",
313    "graphic_surface:surface",
314    "hilog:libhilog",
315    "init:libbegetutil",
316    "ipc:ipc_single",
317    "libxml2:libxml2",
318    "media_foundation:media_foundation",
319    "netmanager_base:net_conn_manager_if",
320    "openssl:libcrypto_shared",
321    "safwk:system_ability_fwk",
322    "samgr:samgr_proxy",
323  ]
324
325  cflags = [
326    "-Dprivate=public",
327    "-Dprotected=public",
328  ]
329
330  resource_config_file =
331      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
332}