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" 18 19hls_test_sources = [ 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/download/app_client.cpp", 22 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/downloader.cpp", 23 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/media_source_loading_request.cpp", 24 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/network_client/http_curl_client.cpp", 25 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_media_downloader.cpp", 26 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_playlist_downloader.cpp", 27 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_tags.cpp", 28 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/m3u8.cpp", 29 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/playlist_downloader.cpp", 30 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/http/http_media_downloader.cpp", 31 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/http_source_plugin.cpp", 32 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/utils/media_cached_buffer.cpp", 33 "$av_codec_root_dir/test/unittest/common/http_server_demo.cpp", 34] 35 36config("hls_unittest_cfg") { 37 defines = [ 38 "HST_ANY_WITH_NO_RTTI", 39 "MEDIA_OHOS", 40 "TESTING", 41 ] 42 43 cflags = [ 44 "-Wno-sign-compare", 45 "-fno-exceptions", 46 "-fno-common", 47 "-fstack-protector-all", 48 "-Wshadow", 49 "-FPIC", 50 "-FS", 51 "-O2", 52 "-D_FORTIFY_SOURCE=2", 53 "-Wformat=2", 54 "-Wdate-time", 55 "-Dprivate=public", 56 "-Dprotected=public", 57 ] 58 59 cflags_cc = [ 60 "-std=c++17", 61 "-fno-rtti", 62 "-Dprivate=public", 63 "-Dprotected=public", 64 ] 65 66 include_dirs = [ 67 "$av_codec_root_dir/interfaces", 68 "$av_codec_root_dir/interfaces/inner_api/native", 69 "$av_codec_root_dir/services/media_engine/plugins/source/http_source", 70 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/base64", 71 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/xml", 72 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash", 73 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include", 74 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include/mpd_parser", 75 "$av_codec_root_dir/test/unittest/common", 76 "$av_codec_root_dir/services/drm_decryptor", 77 "$av_codec_root_dir/services/media_engine/modules", 78 ] 79} 80 81ohos_unittest("hls_media_downloader_unit_test") { 82 sanitize = av_codec_test_sanitize 83 module_out_path = module_output_path 84 testonly = true 85 configs = [ 86 ":hls_unittest_cfg", 87 "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config", 88 ] 89 sources = hls_test_sources + [ "hls_media_downloader_unit_test.cpp" ] 90 deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ] 91 92 external_deps = [ 93 "c_utils:utils", 94 "curl:curl_shared", 95 "graphic_surface:surface", 96 "hilog:libhilog", 97 "init:libbegetutil", 98 "ipc:ipc_single", 99 "libxml2:libxml2", 100 "media_foundation:media_foundation", 101 "netmanager_base:net_conn_manager_if", 102 "openssl:libcrypto_shared", 103 "safwk:system_ability_fwk", 104 "samgr:samgr_proxy", 105 ] 106 resource_config_file = 107 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 108} 109 110ohos_unittest("hls_playlist_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 + [ "hls_playlist_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("hls_tags_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 + [ "hls_tags_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("m3u8_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 + [ "m3u8_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