1# Copyright (c) 2025 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/AVCodec_Video/unittest" 18 19demuxer_unit_test_cflags = [ 20 "-std=c++17", 21 "-fno-rtti", 22 "-fno-exceptions", 23 "-Wall", 24 "-fno-common", 25 "-fstack-protector-strong", 26 "-Wshadow", 27 "-FPIC", 28 "-FS", 29 "-O2", 30 "-D_FORTIFY_SOURCE=2", 31 "-fvisibility=hidden", 32 "-Wformat=2", 33 "-Wdate-time", 34 "-Werror", 35 "-Wextra", 36 "-Wimplicit-fallthrough", 37 "-Wsign-compare", 38 "-Wunused-parameter", 39 "-Dprivate=public", 40 "-Dprotected=public", 41] 42 43################################################################################################################# 44ohos_unittest("demuxer_unit_test") { 45 sanitize = av_codec_test_sanitize 46 module_out_path = module_output_path 47 testonly = true 48 include_dirs = [ 49 "./", 50 "./capi", 51 "$av_codec_root_dir/interfaces/inner_api/native", 52 "$av_codec_root_dir/interfaces/kits/c", 53 "$av_codec_root_dir/frameworks/native/capi/common", 54 "$av_codec_root_dir/test/unittest/format_test", 55 "$av_codec_root_dir/test/unittest/format_test/capi", 56 "$av_codec_root_dir/test/unittest/avsource_test", 57 "$av_codec_root_dir/test/unittest/avsource_test/capi", 58 "$av_codec_root_dir/test/unittest/common/common_mock", 59 "$av_codec_root_dir/test/unittest/common/common_mock/avmemory", 60 "$av_codec_root_dir/test/unittest/common/common_mock/avmemory/capi", 61 "$av_codec_root_dir/test/nativedemo/include", 62 "$av_codec_root_dir/test/nativedemo/avdemuxer/server_demo", 63 "$av_codec_root_dir/services/utils/include", 64 "$av_codec_root_dir/services/media_engine/modules/demuxer", 65 ] 66 67 cflags = demuxer_unit_test_cflags 68 69 if (av_codec_support_demuxer) { 70 sources = [ 71 "$av_codec_root_dir/test/nativedemo/avdemuxer/server_demo/file_server_demo.cpp", 72 "$av_codec_root_dir/test/unittest/avsource_test/capi/avsource_capi_mock.cpp", 73 "$av_codec_root_dir/test/unittest/avsource_test/capi/avsource_capi_mock_factory.cpp", 74 "./demuxer_plugin_manager_unittest.cpp", 75 ] 76 } 77 78 if (target_cpu == "arm64" || is_emulator) { 79 av_codec_path = "\"/system/lib64\"" 80 } else { 81 av_codec_path = "\"/system/lib\"" 82 } 83 defines = [ 84 "AV_CODEC_PATH=${av_codec_path}", 85 "DEMUXER_CAPI_UNIT_TEST", 86 ] 87 defines += av_codec_defines 88 public_deps = 89 [ "$av_codec_root_dir/test/unittest/common:av_codec_capi_unit_test" ] 90 deps = [ 91 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 92 "$av_codec_root_dir/services/engine/base:av_codec_codec_base", 93 "$av_codec_root_dir/services/media_engine/modules:av_codec_media_engine_modules", 94 "$av_codec_root_dir/services/utils:av_codec_service_utils", 95 ] 96 external_deps = [ 97 "audio_framework:audio_capturer", 98 "av_codec:av_codec_client", 99 "c_utils:utils", 100 "ffmpeg:libohosffmpeg", 101 "googletest:gmock_main", 102 "graphic_surface:surface", 103 "graphic_surface:sync_fence", 104 "hilog:libhilog", 105 "hitrace:libhitracechain", 106 "init:libbegetutil", 107 "ipc:ipc_single", 108 "media_foundation:media_foundation", 109 "safwk:system_ability_fwk", 110 ] 111 if (av_codec_support_drm) { 112 external_deps += [ 113 "drm_framework:drm_framework", 114 "drm_framework:native_drm", 115 ] 116 } 117 118 resource_config_file = 119 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 120}