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/player_framework/config.gni") 16 17config("screen_capture_test_config") { 18 visibility = [ ":*" ] 19 20 cflags = [ 21 "-std=c++17", 22 "-fno-rtti", 23 "-fno-exceptions", 24 "-Wall", 25 "-fno-common", 26 "-fstack-protector-strong", 27 "-Wshadow", 28 "-FPIC", 29 "-FS", 30 "-O2", 31 "-D_FORTIFY_SOURCE=2", 32 "-Wformat=2", 33 "-Wfloat-equal", 34 "-Wdate-time", 35 "-Werror", 36 "-Wimplicit-fallthrough", 37 "-Wsign-compare", 38 "-Dprivate=public", 39 "-Dprotected=public", 40 ] 41 42 include_dirs = [ 43 "./", 44 "./screen_capture_unittest/include", 45 "./capi/include", 46 "$MEDIA_PLAYER_ROOT_DIR/services/services/sa_media/ipc", 47 "$MEDIA_PLAYER_ROOT_DIR/services/services/sa_media/server", 48 "$MEDIA_PLAYER_ROOT_DIR/services/services/common", 49 "$MEDIA_PLAYER_ROOT_DIR/services/services/player/ipc", 50 "$MEDIA_PLAYER_ROOT_DIR/services/services/player/player_mem_manage", 51 "$MEDIA_PLAYER_ROOT_DIR/services/services/player/server", 52 "$MEDIA_PLAYER_ROOT_DIR/services/services/player/subscriber", 53 "$MEDIA_PLAYER_ROOT_DIR/services/services/media_data_source/ipc", 54 "$MEDIA_PLAYER_ROOT_DIR/services/services/media_data_source/server", 55 "$MEDIA_PLAYER_ROOT_DIR/services/services/monitor/client", 56 "$MEDIA_PLAYER_ROOT_DIR/services/services/monitor/ipc", 57 "$MEDIA_PLAYER_ROOT_DIR/services/services/monitor/server", 58 "$MEDIA_PLAYER_ROOT_DIR/services/services/recorder/ipc", 59 "$MEDIA_PLAYER_ROOT_DIR/services/services/recorder/server", 60 "$MEDIA_PLAYER_ROOT_DIR/services/services/avmetadatahelper/ipc", 61 "$MEDIA_PLAYER_ROOT_DIR/services/services/avmetadatahelper/server", 62 "avcodec/ipc", 63 "avcodec/server", 64 "avcodeclist/ipc", 65 "avcodeclist/server", 66 "$MEDIA_PLAYER_ROOT_DIR/services/services/recorder_profiles/ipc", 67 "$MEDIA_PLAYER_ROOT_DIR/services/services/recorder_profiles/server", 68 "$MEDIA_PLAYER_ROOT_DIR/services/services/screen_capture/server", 69 "$MEDIA_PLAYER_ROOT_DIR/services/services/screen_capture/ipc", 70 "$MEDIA_PLAYER_ROOT_DIR/services/services/screen_capture_monitor/server", 71 "$MEDIA_PLAYER_ROOT_DIR/services/services/screen_capture_monitor/ipc", 72 "$MEDIA_PLAYER_ROOT_DIR/services/services/transcoder/server", 73 "$MEDIA_PLAYER_ROOT_DIR/services/services/transcoder/ipc", 74 "$MEDIA_PLAYER_ROOT_DIR/services/services/observer", 75 "$MEDIA_PLAYER_ROOT_DIR/services/include", 76 "$MEDIA_PLAYER_ROOT_DIR/services/services/factory", 77 "$MEDIA_PLAYER_ROOT_DIR/services/services/engine_intf", 78 "$MEDIA_PLAYER_ROOT_DIR/services/utils/include", 79 "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native", 80 "$MEDIA_PLAYER_ROOT_DIR/services/services/common", 81 "$MEDIA_PLAYER_ROOT_DIR/services/engine/common/recorder_profiles", 82 "$MEDIA_PLAYER_ROOT_DIR/test/unittest/common/include", 83 "$MEDIA_PLAYER_ROOT_DIR/test/unittest/screen_capture_test/screen_capture_server_function_unittest/include", 84 "$MEDIA_PLAYER_GRAPHIC_SURFACE/interfaces/inner_api/surface", 85 ] 86 87 defines = [] 88 defines += player_framework_defines 89 90 if (target_cpu == "arm") { 91 cflags += [ "-DBINDER_IPC_32BIT" ] 92 } 93} 94 95module_output_path = "player_framework/screen_capture" 96 97ohos_unittest("screen_capture_native_unit_test") { 98 module_out_path = module_output_path 99 include_dirs = [ 100 "./", 101 "./screen_capture_unittest/include", 102 "./native/include", 103 "$MEDIA_PLAYER_ROOT_DIR/test/unittest/common/include", 104 "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native", 105 "$MEDIA_PLAYER_GRAPHIC_SURFACE/interfaces/inner_api/surface", 106 ] 107 108 sanitize = { 109 cfi = true 110 cfi_cross_dso = true 111 debug = false 112 } 113 114 cflags = [ 115 "-Wall", 116 "-Werror", 117 ] 118 119 if (player_framework_support_screen_capture) { 120 sources = [ 121 "native/screen_capture_mock_factory.cpp", 122 "native/src/screen_capture_native_mock.cpp", 123 "screen_capture_unittest/src/screen_capture_unit_test.cpp", 124 "screen_capture_unittest/src/screen_capture_unit_test_exclude.cpp", 125 "screen_capture_unittest/src/screen_capture_unit_test_state.cpp", 126 ] 127 } 128 129 external_deps = [ 130 "ability_base:base", 131 "ability_base:want", 132 "ability_base:zuri", 133 "ability_runtime:ability_context_native", 134 "ability_runtime:ability_manager", 135 "ability_runtime:abilitykit_native", 136 "ability_runtime:app_context", 137 "ability_runtime:app_manager", 138 "ability_runtime:data_ability_helper", 139 "ability_runtime:mission_info", 140 "access_token:libaccesstoken_sdk", 141 "access_token:libnativetoken_shared", 142 "access_token:libtokensetproc_shared", 143 "av_codec:av_codec_client", 144 "c_utils:utils", 145 "graphic_surface:surface", 146 "hilog:libhilog", 147 "player_framework:media_client", 148 "window_manager:libdm", 149 ] 150 151 resource_config_file = "../resources/ohos_test.xml" 152} 153 154################################################################################################################## 155 156ohos_unittest("screen_capture_capi_unit_test") { 157 module_out_path = module_output_path 158 include_dirs = [ 159 "./", 160 "./screen_capture_unittest/include", 161 "./capi/include", 162 "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c", 163 "$MEDIA_PLAYER_ROOT_DIR/test/unittest/common/include", 164 "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/common", 165 "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native", 166 "$MEDIA_PLAYER_GRAPHIC_SURFACE/interfaces/inner_api/surface", 167 ] 168 169 sanitize = { 170 cfi = true 171 cfi_cross_dso = true 172 debug = false 173 } 174 175 cflags = [ 176 "-Wall", 177 "-Werror", 178 ] 179 180 if (player_framework_support_screen_capture) { 181 sources = [ 182 "capi/screen_capture_mock_factory.cpp", 183 "capi/src/screen_capture_capi_mock.cpp", 184 "screen_capture_unittest/src/screen_capture_unit_test.cpp", 185 "screen_capture_unittest/src/screen_capture_unit_test_exclude.cpp", 186 "screen_capture_unittest/src/screen_capture_unit_test_state.cpp", 187 ] 188 } 189 190 deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:native_avscreen_capture" ] 191 192 external_deps = [ 193 "ability_base:base", 194 "ability_base:want", 195 "ability_base:zuri", 196 "ability_runtime:ability_context_native", 197 "ability_runtime:ability_manager", 198 "ability_runtime:abilitykit_native", 199 "ability_runtime:app_context", 200 "ability_runtime:app_manager", 201 "ability_runtime:data_ability_helper", 202 "ability_runtime:mission_info", 203 "access_token:libaccesstoken_sdk", 204 "access_token:libnativetoken_shared", 205 "access_token:libtokensetproc_shared", 206 "av_codec:av_codec_client", 207 "c_utils:utils", 208 "graphic_surface:surface", 209 "hilog:libhilog", 210 "media_foundation:media_foundation", 211 "player_framework:media_client", 212 "window_manager:libdm", 213 ] 214 215 resource_config_file = "../resources/ohos_test.xml" 216} 217 218################################################################################################################## 219 220ohos_unittest("screen_capture_server_function_unit_test") { 221 module_out_path = module_output_path 222 stack_protector_ret = true 223 install_enable = true 224 225 sanitize = { 226 cfi = true 227 cfi_cross_dso = true 228 debug = false 229 } 230 231 public_deps = [ "$MEDIA_PLAYER_ROOT_DIR/services/services:media_service" ] 232 233 configs = [ 234 ":screen_capture_test_config", 235 "$MEDIA_PLAYER_ROOT_DIR/services/dfx:media_service_log_dfx_public_config", 236 ] 237 238 deps = [ 239 "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:native_avscreen_capture", 240 "$MEDIA_PLAYER_ROOT_DIR/services/dfx:media_service_dfx", 241 "$MEDIA_PLAYER_ROOT_DIR/services/dfx:media_service_log_dfx", 242 "$MEDIA_PLAYER_ROOT_DIR/services/utils:media_service_utils", 243 ] 244 245 if (player_framework_support_screen_capture) { 246 sources = [ 247 "screen_capture_server_function_unittest/src/audio_capturer_wrapper_function_unittest.cpp", 248 "screen_capture_server_function_unittest/src/screen_capture_server_function_unittest.cpp", 249 "screen_capture_server_function_unittest/src/screen_capture_server_function_unittest_voip.cpp", 250 ] 251 } 252 253 external_deps = [ 254 "ability_base:base", 255 "ability_base:want", 256 "ability_base:zuri", 257 "ability_runtime:ability_context_native", 258 "ability_runtime:ability_manager", 259 "ability_runtime:abilitykit_native", 260 "ability_runtime:app_context", 261 "ability_runtime:app_manager", 262 "ability_runtime:data_ability_helper", 263 "ability_runtime:mission_info", 264 "access_token:libaccesstoken_sdk", 265 "access_token:libnativetoken_shared", 266 "access_token:libprivacy_sdk", 267 "access_token:libtokensetproc_shared", 268 "audio_framework:audio_client", 269 "av_codec:av_codec_client", 270 "c_utils:utils", 271 "call_manager:tel_call_manager_api", 272 "core_service:tel_core_service_api", 273 "distributed_notification_service:ans_innerkits", 274 "graphic_surface:surface", 275 "hilog:libhilog", 276 "ipc:ipc_single", 277 "media_foundation:media_foundation", 278 "os_account:os_account_innerkits", 279 "player_framework:media_client", 280 "qos_manager:qos", 281 "state_registry:tel_state_registry_api", 282 "window_manager:libdm", 283 ] 284 285 if (player_framework_support_power_manager) { 286 external_deps += [ "power_manager:powermgr_client" ] 287 } 288 289 resource_config_file = "../resources/ohos_test.xml" 290} 291