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/player_framework/config.gni") 16 17module_output_path = "player_framework/player_framework/player" 18 19config("player_impl_unittest_config") { 20 visibility = [ ":*" ] 21 22 cflags = [ 23 "-O2", 24 "-fPIC", 25 "-Wall", 26 "-fexceptions", 27 "-fno-rtti", 28 "-Wno-unused-but-set-variable", 29 "-Wno-format", 30 "-Dprivate=public", 31 "-Dprotected=public", 32 ] 33 cflags_cc = cflags 34 include_dirs = [ 35 "./", 36 "./mock", 37 "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/player", 38 "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native", 39 "$MEDIA_PLAYER_ROOT_DIR/services/include", 40 "$MEDIA_PLAYER_ROOT_DIR/services/services/engine_intf", 41 "$MEDIA_PLAYER_ROOT_DIR/services/services/monitor/ipc", 42 "$MEDIA_PLAYER_ROOT_DIR/services/services/player/client", 43 "$MEDIA_PLAYER_ROOT_DIR/services/services/player/ipc", 44 "$MEDIA_PLAYER_ROOT_DIR/services/services/player/server", 45 "$MEDIA_PLAYER_ROOT_DIR/services/services/sa_media/client", 46 "$MEDIA_PLAYER_ROOT_DIR/services/utils/include", 47 ] 48 defines = [] 49 50 defines += player_framework_defines 51} 52 53ohos_unittest("player_impl_unittest") { 54 module_out_path = module_output_path 55 stack_protector_ret = true 56 57 sources = [ 58 "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/common/media_errors.cpp", 59 "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/player/player_impl.cpp", 60 "$MEDIA_PLAYER_ROOT_DIR/services/utils/media_dfx.cpp", 61 "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/player/hiappevent_agent.cpp", 62 "./mock/media_local.cpp", 63 "./player_impl_unittest.cpp", 64 ] 65 66 configs = [ 67 ":player_impl_unittest_config", 68 "$MEDIA_PLAYER_ROOT_DIR/services/dfx:media_service_log_dfx_public_config", 69 "$MEDIA_PLAYER_ROOT_DIR/services/utils:media_service_utils_public_config", 70 ] 71 72 sanitize = { 73 integer_overflow = true 74 ubsan = true 75 boundary_sanitize = true 76 cfi = true 77 cfi_cross_dso = true 78 debug = false 79 } 80 81 external_deps = [ 82 "access_token:libaccesstoken_sdk", 83 "access_token:libprivacy_sdk", 84 "audio_framework:audio_client", 85 "audio_framework:audio_renderer", 86 "av_codec:av_codec_client", 87 "c_utils:utils", 88 "googletest:gmock", 89 "graphic_surface:surface", 90 "graphic_surface:sync_fence", 91 "hiappevent:hiappevent_innerapi", 92 "hicollie:libhicollie", 93 "hilog:libhilog", 94 "hisysevent:libhisysevent", 95 "hitrace:hitrace_meter", 96 "hitrace:libhitracechain", 97 "image_framework:image_native", 98 "init:libbegetutil", 99 "ipc:ipc_single", 100 "libxml2:libxml2", 101 "media_foundation:media_foundation", 102 "os_account:os_account_innerkits", 103 "qos_manager:qos", 104 "safwk:system_ability_fwk", 105 "samgr:samgr_proxy", 106 ] 107 108 if (player_framework_support_drm) { 109 external_deps += [ "drm_framework:drm_framework" ] 110 } 111 112 deps = [ 113 "$MEDIA_PLAYER_ROOT_DIR/services/dfx:media_service_log_dfx", 114 "$MEDIA_PLAYER_ROOT_DIR/services/utils:media_service_utils", 115 ] 116 117}