# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/test.gni")
import("//foundation/multimedia/av_codec/config.gni")
module_output_path = "av_codec/stream_player_framework"
hls_test_sources = [
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/base64/base64_utils.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/app_client.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/downloader.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/media_source_loading_request.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/network_client/http_curl_client.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_media_downloader.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_segment_manager.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_playlist_downloader.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_tags.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/m3u8.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/playlist_downloader.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/http/http_media_downloader.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/http_source_plugin.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/utils/aes_decryptor.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/utils/media_cached_buffer.cpp",
"$av_codec_root_dir/test/unittest/common/http_server_demo.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/utils/http_media_utils.cpp",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/utils/string_utils.cpp",
]
config("hls_unittest_cfg") {
defines = [
"HST_ANY_WITH_NO_RTTI",
"MEDIA_OHOS",
"TESTING",
]
cflags = [
"-Wno-sign-compare",
"-fno-exceptions",
"-fno-common",
"-fstack-protector-all",
"-Wshadow",
"-FPIC",
"-FS",
"-O2",
"-D_FORTIFY_SOURCE=2",
"-Wformat=2",
"-Wdate-time",
"-Dprivate=public",
"-Dprotected=public",
]
cflags_cc = [
"-std=c++17",
"-fno-rtti",
"-Dprivate=public",
"-Dprotected=public",
]
include_dirs = [
"$av_codec_root_dir/interfaces",
"$av_codec_root_dir/interfaces/inner_api/native",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/base64",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/xml",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include/mpd_parser",
"$av_codec_root_dir/test/unittest/common",
"$av_codec_root_dir/services/drm_decryptor",
"$av_codec_root_dir/services/media_engine/modules",
"$av_codec_root_dir/services/media_engine/plugins/source/http_source/utils",
]
}
ohos_unittest("hls_media_downloader_unit_test") {
sanitize = av_codec_test_sanitize
module_out_path = module_output_path
testonly = true
configs = [
":hls_unittest_cfg",
"$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
]
sources = hls_test_sources + [ "hls_media_downloader_unit_test.cpp" ]
deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
external_deps = [
"c_utils:utils",
"certificate_manager:cert_manager_sdk",
"curl:curl_shared",
"graphic_surface:surface",
"hilog:libhilog",
"hitrace:hitrace_meter",
"init:libbegetutil",
"ipc:ipc_single",
"libxml2:libxml2",
"media_foundation:media_foundation",
"netmanager_base:net_conn_manager_if",
"openssl:libcrypto_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
]
resource_config_file =
"$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
}
ohos_unittest("hls_segment_manager_unit_test") {
sanitize = av_codec_test_sanitize
module_out_path = module_output_path
testonly = true
configs = [
":hls_unittest_cfg",
"$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
]
sources = hls_test_sources + [ "hls_segment_manager_unit_test.cpp" ]
deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
external_deps = [
"c_utils:utils",
"certificate_manager:cert_manager_sdk",
"curl:curl_shared",
"graphic_surface:surface",
"hilog:libhilog",
"hitrace:hitrace_meter",
"init:libbegetutil",
"ipc:ipc_single",
"libxml2:libxml2",
"media_foundation:media_foundation",
"netmanager_base:net_conn_manager_if",
"openssl:libcrypto_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
]
resource_config_file =
"$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
}
ohos_unittest("hls_playlist_downloader_unit_test") {
sanitize = av_codec_test_sanitize
module_out_path = module_output_path
testonly = true
configs = [
":hls_unittest_cfg",
"$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
]
sources = hls_test_sources + [ "hls_playlist_downloader_unit_test.cpp" ]
deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
external_deps = [
"c_utils:utils",
"certificate_manager:cert_manager_sdk",
"curl:curl_shared",
"graphic_surface:surface",
"hilog:libhilog",
"hitrace:hitrace_meter",
"init:libbegetutil",
"ipc:ipc_single",
"libxml2:libxml2",
"media_foundation:media_foundation",
"netmanager_base:net_conn_manager_if",
"openssl:libcrypto_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
]
resource_config_file =
"$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
}
ohos_unittest("hls_tags_unit_test") {
sanitize = av_codec_test_sanitize
module_out_path = module_output_path
testonly = true
configs = [
":hls_unittest_cfg",
"$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
]
sources = hls_test_sources + [ "hls_tags_unit_test.cpp" ]
deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
external_deps = [
"c_utils:utils",
"certificate_manager:cert_manager_sdk",
"curl:curl_shared",
"graphic_surface:surface",
"hilog:libhilog",
"hitrace:hitrace_meter",
"init:libbegetutil",
"ipc:ipc_single",
"libxml2:libxml2",
"media_foundation:media_foundation",
"netmanager_base:net_conn_manager_if",
"openssl:libcrypto_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
]
resource_config_file =
"$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
}
ohos_unittest("m3u8_unit_test") {
sanitize = av_codec_test_sanitize
module_out_path = module_output_path
testonly = true
configs = [
":hls_unittest_cfg",
"$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
]
sources = hls_test_sources + [ "m3u8_unit_test.cpp" ]
deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
external_deps = [
"c_utils:utils",
"certificate_manager:cert_manager_sdk",
"curl:curl_shared",
"graphic_surface:surface",
"hilog:libhilog",
"hitrace:hitrace_meter",
"init:libbegetutil",
"ipc:ipc_single",
"libxml2:libxml2",
"media_foundation:media_foundation",
"netmanager_base:net_conn_manager_if",
"openssl:libcrypto_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
]
resource_config_file =
"$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
}
ohos_unittest("hls_playlist_downloader_coverage_unit_test") {
sanitize = av_codec_test_sanitize
module_out_path = module_output_path
testonly = true
configs = [
":hls_unittest_cfg",
"$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
]
sources = hls_test_sources + [ "hls_playlist_downloader_coverage_unit_test.cpp" ]
deps = [ "$av_codec_root_dir/services/dfx:av_codec_service_dfx" ]
external_deps = [
"c_utils:utils",
"certificate_manager:cert_manager_sdk",
"curl:curl_shared",
"graphic_surface:surface",
"hilog:libhilog",
"hitrace:hitrace_meter",
"init:libbegetutil",
"ipc:ipc_single",
"libxml2:libxml2",
"media_foundation:media_foundation",
"netmanager_base:net_conn_manager_if",
"openssl:libcrypto_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
]
resource_config_file =
"$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
}