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