1# Copyright (c) 2022-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("../../../windowmanager_aafwk.gni") 16 17module_out_path = "window_manager/OH-DMS/dmserver" 18 19group("unittest") { 20 testonly = true 21 22 deps = [ 23 ":dmserver_abstract_display_controller_test", 24 ":dmserver_abstract_display_test", 25 ":dmserver_abstract_screen_controller_test", 26 ":dmserver_abstract_screen_test", 27 ":dmserver_display_cutout_controller_test", 28 ":dmserver_display_dumper_test", 29 ":dmserver_display_manager_agent_controller_test", 30 ":dmserver_display_manager_config_test", 31 ":dmserver_display_manager_ipc_service_test", 32 ":dmserver_display_manager_proxy_test", 33 ":dmserver_display_manager_service_inner_test", 34 ":dmserver_display_manager_service_test", 35 ":dmserver_display_power_controller_test", 36 ":dmserver_screen_rotation_controller_test", 37 ] 38} 39 40ohos_unittest("dmserver_abstract_screen_controller_test") { 41 module_out_path = module_out_path 42 43 sources = [ "abstract_screen_controller_test.cpp" ] 44 45 deps = [ ":dmserver_unittest_common" ] 46 47 external_deps = [ 48 "c_utils:utils", 49 "graphic_2d:librender_service_base", 50 "hilog:libhilog", 51 ] 52} 53 54ohos_unittest("dmserver_display_manager_agent_controller_test") { 55 module_out_path = module_out_path 56 57 sources = [ "display_manager_agent_controller_test.cpp" ] 58 59 deps = [ ":dmserver_unittest_common" ] 60 61 external_deps = [ 62 "c_utils:utils", 63 "hilog:libhilog", 64 ] 65 66 cflags = [ 67 "-Dprivate = public", 68 "-Dprotected = public", 69 ] 70} 71 72ohos_unittest("dmserver_abstract_display_test") { 73 module_out_path = module_out_path 74 75 sources = [ "abstract_display_test.cpp" ] 76 77 deps = [ ":dmserver_unittest_common" ] 78 79 external_deps = [ 80 "c_utils:utils", 81 "graphic_2d:librender_service_base", 82 "hilog:libhilog", 83 ] 84} 85 86ohos_unittest("dmserver_display_manager_service_inner_test") { 87 module_out_path = module_out_path 88 89 sources = [ "display_manager_service_inner_test.cpp" ] 90 91 deps = [ ":dmserver_unittest_common" ] 92 93 external_deps = [ 94 "c_utils:utils", 95 "graphic_2d:librender_service_base", 96 "hilog:libhilog", 97 "safwk:system_ability_fwk", 98 ] 99} 100 101ohos_unittest("dmserver_display_manager_ipc_service_test") { 102 branch_protector_ret = "pac_ret" 103 sanitize = { 104 cfi = true 105 cfi_cross_dso = true 106 cfi_vcall_icall_only = true 107 debug = false 108 } 109 module_out_path = module_out_path 110 111 sources = [ "display_manager_ipc_service_test.cpp" ] 112 113 deps = [ ":dmserver_unittest_common" ] 114 115 external_deps = [ 116 "cJSON:cjson_static", 117 "c_utils:utils", 118 "graphic_2d:librender_service_base", 119 "hilog:libhilog", 120 "libxml2:libxml2", 121 "safwk:system_ability_fwk", 122 "samgr:samgr_proxy", 123 "selinux_adapter:librestorecon", 124 ] 125} 126 127ohos_unittest("dmserver_display_manager_service_test") { 128 module_out_path = module_out_path 129 130 sources = [ "display_manager_service_test.cpp" ] 131 132 deps = [ ":dmserver_unittest_common" ] 133 134 external_deps = [ 135 "cJSON:cjson_static", 136 "c_utils:utils", 137 "graphic_2d:librender_service_base", 138 "hilog:libhilog", 139 "libxml2:libxml2", 140 "safwk:system_ability_fwk", 141 "selinux_adapter:librestorecon", 142 ] 143} 144 145ohos_unittest("dmserver_display_manager_proxy_test") { 146 module_out_path = module_out_path 147 148 sources = [ "display_manager_proxy_test.cpp" ] 149 150 deps = [ ":dmserver_unittest_common" ] 151 152 external_deps = [ 153 "c_utils:utils", 154 "graphic_surface:surface", 155 "hilog:libhilog", 156 ] 157 158 cflags = [ 159 "-Dprivate = public", 160 "-Dprotected = public", 161 ] 162} 163 164ohos_unittest("dmserver_screen_rotation_controller_test") { 165 module_out_path = module_out_path 166 167 sources = [ "screen_rotation_controller_test.cpp" ] 168 169 deps = [ ":dmserver_unittest_common" ] 170 171 external_deps = [ 172 "c_utils:utils", 173 "graphic_2d:librender_service_base", 174 "hilog:libhilog", 175 "safwk:system_ability_fwk", 176 ] 177 178 if (window_manager_feature_subscribe_motion) { 179 if (defined(global_parts_info) && defined(global_parts_info.msdp_motion)) { 180 defines = [ "WM_SUBSCRIBE_MOTION_ENABLE" ] 181 } 182 } 183} 184 185ohos_unittest("dmserver_display_dumper_test") { 186 module_out_path = module_out_path 187 188 sources = [ "display_dumper_test.cpp" ] 189 190 deps = [ ":dmserver_unittest_common" ] 191 192 external_deps = [ 193 "c_utils:utils", 194 "graphic_2d:librender_service_base", 195 "hilog:libhilog", 196 "safwk:system_ability_fwk", 197 ] 198} 199 200ohos_unittest("dmserver_display_cutout_controller_test") { 201 module_out_path = module_out_path 202 203 sources = [ "display_cutout_controller_test.cpp" ] 204 205 deps = [ ":dmserver_unittest_common" ] 206 207 external_deps = [ 208 "c_utils:utils", 209 "graphic_2d:librender_service_base", 210 "hilog:libhilog", 211 "safwk:system_ability_fwk", 212 ] 213} 214 215ohos_unittest("dmserver_display_power_controller_test") { 216 module_out_path = module_out_path 217 218 sources = [ "display_power_controller_test.cpp" ] 219 220 deps = [ ":dmserver_unittest_common" ] 221 222 external_deps = [ 223 "c_utils:utils", 224 "hilog:libhilog", 225 ] 226} 227 228ohos_unittest("dmserver_abstract_screen_test") { 229 module_out_path = module_out_path 230 231 sources = [ "abstract_screen_test.cpp" ] 232 233 deps = [ ":dmserver_unittest_common" ] 234 235 external_deps = [ 236 "c_utils:utils", 237 "graphic_2d:librender_service_base", 238 "hilog:libhilog", 239 ] 240 241 cflags = [ 242 "-Dprivate = public", 243 "-Dprotected = public", 244 ] 245} 246 247ohos_unittest("dmserver_abstract_display_controller_test") { 248 module_out_path = module_out_path 249 250 sources = [ "abstract_display_controller_test.cpp" ] 251 252 deps = [ ":dmserver_unittest_common" ] 253 254 external_deps = [ 255 "c_utils:utils", 256 "graphic_2d:librender_service_base", 257 "hilog:libhilog", 258 "safwk:system_ability_fwk", 259 ] 260} 261 262ohos_unittest("dmserver_display_manager_config_test") { 263 module_out_path = module_out_path 264 include_dirs = [ "../../src" ] 265 266 sources = [ "display_manager_config_test.cpp" ] 267 268 deps = [ ":dmserver_unittest_common" ] 269 270 external_deps = [ 271 "c_utils:utils", 272 "config_policy:configpolicy_util", 273 "hilog:libhilog", 274 "libxml2:libxml2", 275 ] 276} 277 278## Build dmserver_unittest_common.a {{{ 279config("dmserver_unittest_common_public_config") { 280 include_dirs = [ 281 "../../../dm/include", 282 "../../include", 283 "../../../snapshot", 284 "../../../interfaces/innerkits/dm", 285 "../../../test/common/mock", 286 "../../../test/common/utils/include", 287 "../../../utils/include", 288 "../../../window_scene/screen_session_manager/include", 289 "../../../window_scene/screen_session_manager_client/include", 290 "${dmserver_gen_path}", 291 ] 292} 293 294ohos_static_library("dmserver_unittest_common") { 295 visibility = [ ":*" ] 296 testonly = true 297 298 public_configs = [ 299 ":dmserver_unittest_common_public_config", 300 "../../../resources/config/build:coverage_flags", 301 "../../../resources/config/build:testcase_flags", 302 ] 303 304 public_deps = [ 305 "${window_base_path}/dm:libdm", 306 "${window_base_path}/utils:libwmutil", 307 "${window_base_path}/utils:libwmutil_base", 308 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 309 "${window_base_path}/wm:libwm", 310 "../..:libdms", 311 "../../../snapshot:snapshot_display", 312 "../../../test/common/utils:libtestutil", 313 ] 314 315 public_external_deps = [ 316 "ability_base:want", 317 "c_utils:utils", 318 "googletest:gmock", 319 "googletest:gtest_main", 320 "graphic_2d:librender_service_client", 321 "image_framework:image_native", 322 "input:libmmi-client", 323 "libjpeg-turbo:turbojpeg_static", 324 ] 325 326 external_deps = [ 327 "access_token:libaccesstoken_sdk", 328 "access_token:libnativetoken", 329 "access_token:libtoken_setproc", 330 "graphic_2d:librender_service_base", 331 "graphic_2d:librender_service_client", 332 "hilog:libhilog", 333 "ipc:ipc_single", 334 ] 335 defines = [] 336 if (defined(global_parts_info) && defined(global_parts_info.sensors_sensor)) { 337 external_deps += [ "sensor:sensor_interface_native" ] 338 defines += [ "SENSOR_ENABLE" ] 339 } 340 341 subsystem_name = "window" 342 part_name = "window_manager" 343} 344## Build dmserver_unittest_common.a }}} 345