• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023-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
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/sa_media/server_manager",
49    "$MEDIA_PLAYER_ROOT_DIR/services/services/common",
50    "$MEDIA_PLAYER_ROOT_DIR/services/services/player/ipc",
51    "$MEDIA_PLAYER_ROOT_DIR/services/services/player/player_mem_manage",
52    "$MEDIA_PLAYER_ROOT_DIR/services/services/player/server",
53    "$MEDIA_PLAYER_ROOT_DIR/services/services/player/subscriber",
54    "$MEDIA_PLAYER_ROOT_DIR/services/services/media_data_source/ipc",
55    "$MEDIA_PLAYER_ROOT_DIR/services/services/media_data_source/server",
56    "$MEDIA_PLAYER_ROOT_DIR/services/services/monitor/client",
57    "$MEDIA_PLAYER_ROOT_DIR/services/services/monitor/ipc",
58    "$MEDIA_PLAYER_ROOT_DIR/services/services/monitor/server",
59    "$MEDIA_PLAYER_ROOT_DIR/services/services/recorder/ipc",
60    "$MEDIA_PLAYER_ROOT_DIR/services/services/recorder/server",
61    "$MEDIA_PLAYER_ROOT_DIR/services/services/avmetadatahelper/ipc",
62    "$MEDIA_PLAYER_ROOT_DIR/services/services/avmetadatahelper/server",
63    "avcodec/ipc",
64    "avcodec/server",
65    "avcodeclist/ipc",
66    "avcodeclist/server",
67    "$MEDIA_PLAYER_ROOT_DIR/services/services/recorder_profiles/ipc",
68    "$MEDIA_PLAYER_ROOT_DIR/services/services/recorder_profiles/server",
69    "$MEDIA_PLAYER_ROOT_DIR/services/services/screen_capture/server",
70    "$MEDIA_PLAYER_ROOT_DIR/services/services/screen_capture/ipc",
71    "$MEDIA_PLAYER_ROOT_DIR/services/services/screen_capture_monitor/server",
72    "$MEDIA_PLAYER_ROOT_DIR/services/services/screen_capture_monitor/ipc",
73    "$MEDIA_PLAYER_ROOT_DIR/services/services/transcoder/server",
74    "$MEDIA_PLAYER_ROOT_DIR/services/services/transcoder/ipc",
75    "$MEDIA_PLAYER_ROOT_DIR/services/services/observer",
76    "$MEDIA_PLAYER_ROOT_DIR/services/include",
77    "$MEDIA_PLAYER_ROOT_DIR/services/services/factory",
78    "$MEDIA_PLAYER_ROOT_DIR/services/services/engine_intf",
79    "$MEDIA_PLAYER_ROOT_DIR/services/utils/include",
80    "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native",
81    "$MEDIA_PLAYER_ROOT_DIR/services/services/common",
82    "$MEDIA_PLAYER_ROOT_DIR/services/engine/common/recorder_profiles",
83    "$MEDIA_PLAYER_ROOT_DIR/test/unittest/common/include",
84    "$MEDIA_PLAYER_ROOT_DIR/test/unittest/screen_capture_test/screen_capture_service_function_unittest/server/include",
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/ScreenCapture/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  ]
106
107  sanitize = {
108    cfi = true
109    cfi_cross_dso = true
110    debug = false
111  }
112
113  cflags = [
114    "-Wall",
115    "-Werror",
116  ]
117
118  if (player_framework_support_screen_capture) {
119    sources = [
120      "native/screen_capture_mock_factory.cpp",
121      "native/src/screen_capture_native_mock.cpp",
122      "screen_capture_unittest/src/screen_capture_unit_test.cpp",
123      "screen_capture_unittest/src/screen_capture_unit_test_exclude.cpp",
124      "screen_capture_unittest/src/screen_capture_unit_test_state.cpp",
125      "screen_capture_unittest/src/screen_capture_unit_test_strategy.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    "audio_framework:audio_client",
144    "av_codec:av_codec_client",
145    "c_utils:utils",
146    "graphic_2d:librender_service_base",
147    "graphic_surface:surface",
148    "hilog:libhilog",
149    "i18n:intl_util",
150    "player_framework:media_client",
151    "resource_management:global_resmgr",
152    "window_manager:libdm",
153  ]
154
155  resource_config_file = "../resources/ohos_test.xml"
156}
157
158##################################################################################################################
159
160ohos_unittest("screen_capture_capi_unit_test") {
161  module_out_path = module_output_path
162  include_dirs = [
163    "./",
164    "./screen_capture_unittest/include",
165    "./capi/include",
166    "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c",
167    "$MEDIA_PLAYER_ROOT_DIR/test/unittest/common/include",
168    "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/common",
169    "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native",
170  ]
171
172  sanitize = {
173    cfi = true
174    cfi_cross_dso = true
175    debug = false
176  }
177
178  cflags = [
179    "-Wall",
180    "-Werror",
181  ]
182
183  if (player_framework_support_screen_capture) {
184    sources = [
185      "capi/screen_capture_mock_factory.cpp",
186      "capi/src/screen_capture_capi_mock.cpp",
187      "screen_capture_unittest/src/screen_capture_unit_test.cpp",
188      "screen_capture_unittest/src/screen_capture_unit_test_exclude.cpp",
189      "screen_capture_unittest/src/screen_capture_unit_test_state.cpp",
190      "screen_capture_unittest/src/screen_capture_unit_test_strategy.cpp",
191    ]
192  }
193
194  deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:native_avscreen_capture" ]
195
196  external_deps = [
197    "ability_base:base",
198    "ability_base:want",
199    "ability_base:zuri",
200    "ability_runtime:ability_context_native",
201    "ability_runtime:ability_manager",
202    "ability_runtime:abilitykit_native",
203    "ability_runtime:app_context",
204    "ability_runtime:app_manager",
205    "ability_runtime:data_ability_helper",
206    "ability_runtime:mission_info",
207    "access_token:libaccesstoken_sdk",
208    "access_token:libnativetoken_shared",
209    "access_token:libtokensetproc_shared",
210    "audio_framework:audio_client",
211    "av_codec:av_codec_client",
212    "c_utils:utils",
213    "graphic_2d:librender_service_base",
214    "graphic_surface:surface",
215    "hilog:libhilog",
216    "i18n:intl_util",
217    "media_foundation:media_foundation",
218    "player_framework:media_client",
219    "resource_management:global_resmgr",
220    "window_manager:libdm",
221  ]
222
223  resource_config_file = "../resources/ohos_test.xml"
224}
225
226##################################################################################################################
227
228ohos_unittest("screen_capture_server_function_unit_test") {
229  module_out_path = module_output_path
230  stack_protector_ret = true
231  install_enable = true
232
233  sanitize = {
234    cfi = true
235    cfi_cross_dso = true
236    debug = false
237  }
238
239  configs = [
240    ":screen_capture_test_config",
241    "$MEDIA_PLAYER_ROOT_DIR/services/dfx:media_service_log_dfx_public_config",
242  ]
243
244  deps = [
245    "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:native_avscreen_capture",
246    "$MEDIA_PLAYER_ROOT_DIR/services/dfx:media_service_dfx",
247    "$MEDIA_PLAYER_ROOT_DIR/services/dfx:media_service_log_dfx",
248    "$MEDIA_PLAYER_ROOT_DIR/services/utils:media_service_utils",
249    "$MEDIA_PLAYER_ROOT_DIR/services/services:media_service",
250  ]
251
252  if (player_framework_support_screen_capture) {
253    sources = [
254      "screen_capture_service_function_unittest/server/src/audio_capturer_wrapper_function_unittest.cpp",
255      "screen_capture_service_function_unittest/server/src/screen_capture_server_function_unittest.cpp",
256      "screen_capture_service_function_unittest/server/src/screen_capture_server_function_unittest_buffer.cpp",
257      "screen_capture_service_function_unittest/server/src/screen_capture_server_function_unittest_check_param.cpp",
258      "screen_capture_service_function_unittest/server/src/screen_capture_server_function_unittest_multiInstance.cpp",
259      "screen_capture_service_function_unittest/server/src/screen_capture_server_function_unittest_recorder.cpp",
260      "screen_capture_service_function_unittest/server/src/screen_capture_server_function_unittest_voip.cpp",
261      "screen_capture_service_function_unittest/server/src/screen_capture_server_function_unittest_window.cpp",
262    ]
263  }
264
265  external_deps = [
266    "ability_base:base",
267    "ability_base:want",
268    "ability_base:zuri",
269    "ability_runtime:ability_context_native",
270    "ability_runtime:ability_manager",
271    "ability_runtime:abilitykit_native",
272    "ability_runtime:app_context",
273    "ability_runtime:app_manager",
274    "ability_runtime:data_ability_helper",
275    "ability_runtime:mission_info",
276    "access_token:libaccesstoken_sdk",
277    "access_token:libnativetoken_shared",
278    "access_token:libprivacy_sdk",
279    "access_token:libtokensetproc_shared",
280    "audio_framework:audio_client",
281    "audio_framework:audio_foundation",
282    "av_codec:av_codec_client",
283    "c_utils:utils",
284    "call_manager:tel_call_manager_api",
285    "core_service:tel_core_service_api",
286    "distributed_notification_service:ans_innerkits",
287    "graphic_2d:librender_service_base",
288    "graphic_surface:surface",
289    "hilog:libhilog",
290    "hisysevent:libhisysevent",
291    "hitrace:hitrace_meter",
292    "i18n:intl_util",
293    "ipc:ipc_single",
294    "media_foundation:media_foundation",
295    "os_account:os_account_innerkits",
296    "player_framework:media_client",
297    "qos_manager:qos",
298    "resource_management:global_resmgr",
299    "state_registry:tel_state_registry_api",
300    "window_manager:libdm",
301    "window_manager:scene_session",
302    "window_manager:scene_session_manager",
303    "window_manager:session_manager_lite",
304  ]
305
306  if (player_framework_support_power_manager) {
307    external_deps += [ "power_manager:powermgr_client" ]
308  }
309
310  if (player_framework_support_drm) {
311    external_deps += [ "drm_framework:drm_framework" ]
312  }
313
314  resource_config_file = "../resources/ohos_test.xml"
315}
316