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/unittest" 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/downloader.cpp", 22 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/network_client/http_curl_client.cpp", 23 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_media_downloader.cpp", 24 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_playlist_downloader.cpp", 25 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_tags.cpp", 26 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/m3u8.cpp", 27 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/playlist_downloader.cpp", 28 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/http/http_media_downloader.cpp", 29 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/http_source_plugin.cpp", 30 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/utils/media_cached_buffer.cpp", 31 "$av_codec_root_dir/test/unittest/common/http_server_demo.cpp", 32] 33 34config("hls_unittest_cfg") { 35 defines = [ 36 "HST_ANY_WITH_NO_RTTI", 37 "MEDIA_OHOS", 38 "TESTING", 39 ] 40 41 cflags = [ 42 "-Wno-sign-compare", 43 "-fno-exceptions", 44 "-fno-common", 45 "-fstack-protector-all", 46 "-Wshadow", 47 "-FPIC", 48 "-FS", 49 "-O2", 50 "-D_FORTIFY_SOURCE=2", 51 "-Wformat=2", 52 "-Wdate-time", 53 "-Dprivate=public", 54 "-Dprotected=public", 55 ] 56 57 cflags_cc = [ 58 "-std=c++17", 59 "-fno-rtti", 60 "-Dprivate=public", 61 "-Dprotected=public", 62 ] 63 64 include_dirs = [ 65 "$av_codec_root_dir/interfaces", 66 "$av_codec_root_dir/interfaces/inner_api/native", 67 "$av_codec_root_dir/services/media_engine/plugins/source/http_source", 68 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/base64", 69 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/xml", 70 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash", 71 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include", 72 "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include/mpd_parser", 73 "$media_foundation_root_dir/src", 74 "$av_codec_root_dir/test/unittest/common", 75 "//third_party/curl/include", 76 "//third_party/openssl/include", 77 "$av_codec_root_dir/services/drm_decryptor", 78 "$av_codec_root_dir/services/media_engine/modules", 79 "$media_foundation_root_dir/interface/inner_api", 80 "//commonlibrary/c_utils/base/include/", 81 "//third_party/ffmpeg", 82 ] 83} 84 85ohos_unittest("hls_media_downloader_unit_test") { 86 sanitize = av_codec_test_sanitize 87 module_out_path = module_output_path 88 testonly = true 89 configs = [ 90 ":hls_unittest_cfg", 91 "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config", 92 ] 93 sources = hls_test_sources + [ "hls_media_downloader_unit_test.cpp" ] 94 deps = [ 95 "$av_codec_root_dir/services/dfx:av_codec_service_dfx", 96 "//third_party/curl:curl_shared", 97 "//third_party/openssl:libcrypto_shared", 98 ] 99 100 external_deps = [ 101 "c_utils:utils", 102 "graphic_surface:surface", 103 "hilog:libhilog", 104 "init:libbegetutil", 105 "ipc:ipc_single", 106 "media_foundation:media_foundation", 107 "netmanager_base:net_conn_manager_if", 108 "safwk:system_ability_fwk", 109 ] 110 resource_config_file = 111 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 112} 113 114ohos_unittest("hls_playlist_downloader_unit_test") { 115 sanitize = av_codec_test_sanitize 116 module_out_path = module_output_path 117 testonly = true 118 configs = [ 119 ":hls_unittest_cfg", 120 "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config", 121 ] 122 sources = hls_test_sources + [ "hls_playlist_downloader_unit_test.cpp" ] 123 deps = [ 124 "$av_codec_root_dir/services/dfx:av_codec_service_dfx", 125 "//third_party/curl:curl_shared", 126 "//third_party/openssl:libcrypto_shared", 127 ] 128 129 external_deps = [ 130 "c_utils:utils", 131 "graphic_surface:surface", 132 "hilog:libhilog", 133 "init:libbegetutil", 134 "ipc:ipc_single", 135 "media_foundation:media_foundation", 136 "netmanager_base:net_conn_manager_if", 137 "safwk:system_ability_fwk", 138 ] 139 resource_config_file = 140 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 141} 142 143ohos_unittest("hls_tags_unit_test") { 144 sanitize = av_codec_test_sanitize 145 module_out_path = module_output_path 146 testonly = true 147 configs = [ 148 ":hls_unittest_cfg", 149 "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config", 150 ] 151 sources = hls_test_sources + [ "hls_tags_unit_test.cpp" ] 152 deps = [ 153 "$av_codec_root_dir/services/dfx:av_codec_service_dfx", 154 "//third_party/curl:curl_shared", 155 "//third_party/openssl:libcrypto_shared", 156 ] 157 158 external_deps = [ 159 "c_utils:utils", 160 "graphic_surface:surface", 161 "hilog:libhilog", 162 "init:libbegetutil", 163 "ipc:ipc_single", 164 "media_foundation:media_foundation", 165 "netmanager_base:net_conn_manager_if", 166 "safwk:system_ability_fwk", 167 ] 168 resource_config_file = 169 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 170} 171 172ohos_unittest("m3u8_unit_test") { 173 sanitize = av_codec_test_sanitize 174 module_out_path = module_output_path 175 testonly = true 176 configs = [ 177 ":hls_unittest_cfg", 178 "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config", 179 ] 180 sources = hls_test_sources + [ "m3u8_unit_test.cpp" ] 181 deps = [ 182 "$av_codec_root_dir/services/dfx:av_codec_service_dfx", 183 "//third_party/curl:curl_shared", 184 "//third_party/openssl:libcrypto_shared", 185 ] 186 187 external_deps = [ 188 "c_utils:utils", 189 "graphic_surface:surface", 190 "hilog:libhilog", 191 "init:libbegetutil", 192 "ipc:ipc_single", 193 "media_foundation:media_foundation", 194 "netmanager_base:net_conn_manager_if", 195 "safwk:system_ability_fwk", 196 ] 197 resource_config_file = 198 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 199} 200