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("../../../windowmanager_aafwk.gni") 16module_out_path = "window_manager/window_scene" 17 18group("unittest") { 19 testonly = true 20 21 deps = [ 22 ":ws_dual_display_fold_policy_test", 23 ":ws_dual_display_sensor_fold_state_manager_test", 24 ":ws_fold_screen_controller_test", 25 ":ws_fold_screen_sensor_manager_test", 26 ":ws_fold_screen_state_machine_test", 27 ":ws_multi_screen_manager_test", 28 ":ws_screen_cutout_controller_test", 29 ":ws_screen_property_test", 30 ":ws_screen_rotation_property_test", 31 ":ws_screen_scene_config_test", 32 ":ws_screen_session_ability_connection_test", 33 ":ws_screen_session_manager_client_proxy_test", 34 ":ws_screen_session_manager_client_stub_test", 35 ":ws_screen_session_manager_client_test", 36 ":ws_screen_session_manager_lite_proxy_test", 37 ":ws_screen_session_manager_lite_stub_test", 38 ":ws_screen_session_manager_lite_test", 39 ":ws_screen_session_manager_proxy_test", 40 ":ws_screen_session_manager_stub_test", 41 ":ws_screen_session_manager_test", 42 ":ws_screen_session_publish_test", 43 ":ws_screen_session_test", 44 ":ws_screen_setting_helper_test", 45 ":ws_screen_snapshot_picker_connection_test", 46 ":ws_sensor_fold_state_manager_test", 47 ":ws_session_display_power_controller_test", 48 ":ws_setting_observer_test", 49 ":ws_setting_provider_test", 50 ":ws_single_display_fold_policy_test", 51 ":ws_single_display_sensor_fold_state_manager_test", 52 ] 53} 54 55ohos_unittest("ws_setting_observer_test") { 56 module_out_path = module_out_path 57 58 sources = [ "setting_observer_test.cpp" ] 59 60 deps = [ ":ws_unittest_common" ] 61 62 external_deps = [ 63 "ability_runtime:ability_manager", 64 "ability_runtime:dataobs_manager", 65 "c_utils:utils", 66 "hilog:libhilog", 67 ] 68} 69 70ohos_unittest("ws_setting_provider_test") { 71 module_out_path = module_out_path 72 73 sources = [ "setting_provider_test.cpp" ] 74 75 deps = [ ":ws_unittest_common" ] 76 77 external_deps = [ 78 "c_utils:utils", 79 "data_share:datashare_consumer", 80 "hilog:libhilog", 81 ] 82} 83 84ohos_unittest("ws_single_display_fold_policy_test") { 85 module_out_path = module_out_path 86 87 sources = [ "single_display_fold_policy_test.cpp" ] 88 89 deps = [ ":ws_unittest_common" ] 90 91 external_deps = [ 92 "ability_runtime:app_manager", 93 "c_utils:utils", 94 "hilog:libhilog", 95 ] 96} 97 98ohos_unittest("ws_single_display_pocket_fold_policy_test") { 99 module_out_path = module_out_path 100 101 sources = [ "single_display_pocket_fold_policy_test.cpp" ] 102 103 deps = [ ":ws_unittest_common" ] 104 105 external_deps = [ 106 "ability_runtime:app_manager", 107 "c_utils:utils", 108 "hilog:libhilog", 109 ] 110} 111 112ohos_unittest("ws_sensor_fold_state_manager_test") { 113 module_out_path = module_out_path 114 115 sources = [ "sensor_fold_state_manager_test.cpp" ] 116 117 deps = [ ":ws_unittest_common" ] 118 119 external_deps = [ 120 "ability_runtime:app_manager", 121 "c_utils:utils", 122 "hilog:libhilog", 123 "init:libbegetutil", 124 ] 125} 126 127ohos_unittest("ws_dual_display_fold_policy_test") { 128 module_out_path = module_out_path 129 130 sources = [ "dual_display_fold_policy_test.cpp" ] 131 132 deps = [ ":ws_unittest_common" ] 133 134 external_deps = [ 135 "ability_runtime:app_manager", 136 "c_utils:utils", 137 "hilog:libhilog", 138 "init:libbegetutil", 139 ] 140} 141 142ohos_unittest("ws_dual_display_sensor_fold_state_manager_test") { 143 module_out_path = module_out_path 144 145 sources = [ "dual_display_sensor_fold_state_manager_test.cpp" ] 146 147 deps = [ ":ws_unittest_common" ] 148 149 external_deps = [ 150 "ability_runtime:app_manager", 151 "c_utils:utils", 152 "hilog:libhilog", 153 "init:libbegetutil", 154 ] 155} 156 157ohos_unittest("ws_fold_screen_sensor_manager_test") { 158 module_out_path = module_out_path 159 160 sources = [ "fold_screen_sensor_manager_test.cpp" ] 161 162 deps = [ 163 ":ws_unittest_common", 164 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 165 ] 166 167 external_deps = [ 168 "ability_runtime:app_manager", 169 "c_utils:utils", 170 "hilog:libhilog", 171 "init:libbegetutil", 172 ] 173 174 defines = [] 175 if (defined(global_parts_info) && defined(global_parts_info.sensors_sensor)) { 176 external_deps += [ "sensor:sensor_interface_native" ] 177 defines += [ "SENSOR_ENABLE" ] 178 } 179} 180 181ohos_unittest("ws_screen_session_publish_test") { 182 module_out_path = module_out_path 183 184 sources = [ "screen_session_publish_test.cpp" ] 185 186 deps = [ ":ws_unittest_common" ] 187 188 external_deps = [ 189 "ability_runtime:app_manager", 190 "c_utils:utils", 191 "common_event_service:cesfwk_innerkits", 192 "hilog:libhilog", 193 "init:libbegetutil", 194 ] 195} 196 197ohos_unittest("ws_screen_setting_helper_test") { 198 module_out_path = module_out_path 199 200 sources = [ "screen_setting_helper_test.cpp" ] 201 202 deps = [ ":ws_unittest_common" ] 203 204 external_deps = [ 205 "ability_runtime:app_manager", 206 "ability_runtime:dataobs_manager", 207 "c_utils:utils", 208 "hilog:libhilog", 209 "init:libbegetutil", 210 ] 211} 212 213ohos_unittest("ws_screen_session_manager_lite_test") { 214 module_out_path = module_out_path 215 216 sources = [ 217 "${window_base_path}/wmserver/src/zidl/mock_session_manager_service_proxy.cpp", 218 "screen_session_manager_lite_test.cpp", 219 ] 220 221 deps = [ 222 ":ws_unittest_common", 223 "${window_base_path}/dm_lite:libdm_lite", 224 "${window_base_path}/wmserver:sms", 225 ] 226 227 external_deps = [ 228 "ability_runtime:app_manager", 229 "c_utils:utils", 230 "hilog:libhilog", 231 ] 232} 233 234ohos_unittest("ws_multi_screen_manager_test") { 235 module_out_path = module_out_path 236 237 sources = [ "multi_screen_manager_test.cpp" ] 238 239 deps = [ ":ws_unittest_common" ] 240 241 external_deps = [ 242 "c_utils:utils", 243 "hilog:libhilog", 244 "hitrace:hitrace_meter", 245 ] 246} 247 248ohos_unittest("ws_screen_session_test") { 249 module_out_path = module_out_path 250 251 include_dirs = [ "${window_base_path}/window_scene/session/screen/include" ] 252 sources = [ "screen_session_test.cpp" ] 253 254 deps = [ 255 ":ws_unittest_common", 256 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 257 "${window_base_path}/window_scene/session:screen_session", 258 ] 259 260 external_deps = [ "c_utils:utils" ] 261} 262 263ohos_unittest("ws_screen_session_ability_connection_test") { 264 module_out_path = module_out_path 265 266 include_dirs = [ "${window_base_path}/window_scene/session/screen/include" ] 267 sources = [ "screen_session_ability_connection_test.cpp" ] 268 269 deps = [ 270 ":ws_unittest_common", 271 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 272 "${window_base_path}/window_scene/session:screen_session", 273 ] 274 275 external_deps = [ 276 "ability_base:base", 277 "ability_base:want", 278 "ability_runtime:abilitykit_native", 279 "ability_runtime:extension_manager", 280 "c_utils:utils", 281 "ipc:ipc_core", 282 ] 283} 284 285ohos_unittest("ws_screen_snapshot_picker_connection_test") { 286 module_out_path = module_out_path 287 288 include_dirs = [ "${window_base_path}/window_scene/session/screen/include" ] 289 sources = [ "screen_snapshot_picker_connection_test.cpp" ] 290 291 deps = [ 292 ":ws_unittest_common", 293 "${window_base_path}/window_scene/session:screen_session", 294 ] 295 296 external_deps = [ 297 "ability_runtime:abilitykit_native", 298 "c_utils:utils", 299 ] 300} 301 302ohos_unittest("ws_screen_property_test") { 303 module_out_path = module_out_path 304 305 include_dirs = [ "${window_base_path}/window_scene/session/screen/include" ] 306 sources = [ "screen_property_test.cpp" ] 307 308 deps = [ 309 ":ws_unittest_common", 310 "${window_base_path}/window_scene/session:screen_session", 311 ] 312 313 external_deps = [ 314 "c_utils:utils", 315 "graphic_2d:librender_service_client", 316 ] 317} 318 319ohos_unittest("ws_screen_cutout_controller_test") { 320 module_out_path = module_out_path 321 322 sources = [ "screen_cutout_controller_test.cpp" ] 323 324 deps = [ ":ws_unittest_common" ] 325 external_deps = [ 326 "ability_runtime:app_manager", 327 "c_utils:utils", 328 "hilog:libhilog", 329 ] 330} 331 332ohos_unittest("ws_screen_scene_config_test") { 333 module_out_path = module_out_path 334 335 sources = [ "screen_scene_config_test.cpp" ] 336 337 deps = [ 338 ":ws_unittest_common", 339 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 340 ] 341 342 external_deps = [ 343 "c_utils:utils", 344 "hilog:libhilog", 345 ] 346} 347 348ohos_unittest("ws_screen_session_manager_client_proxy_test") { 349 module_out_path = module_out_path 350 351 sources = [ "screen_session_manager_client_proxy_test.cpp" ] 352 353 deps = [ ":ws_unittest_common" ] 354} 355 356ohos_unittest("ws_screen_session_manager_client_stub_test") { 357 module_out_path = module_out_path 358 359 include_dirs = 360 [ "${window_base_path}/window_scene/screen_session_manager/include/zidl" ] 361 362 sources = [ "screen_session_manager_client_stub_test.cpp" ] 363 364 deps = [ ":ws_unittest_common" ] 365} 366 367ohos_unittest("ws_screen_session_manager_client_test") { 368 module_out_path = module_out_path 369 370 sources = [ "screen_session_manager_client_test.cpp" ] 371 372 deps = [ 373 ":ws_unittest_common", 374 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 375 ] 376} 377 378ohos_unittest("ws_screen_session_manager_lite_proxy_test") { 379 module_out_path = module_out_path 380 381 sources = [ 382 "${window_base_path}/window_scene/session_manager/src/zidl/screen_session_manager_lite_proxy.cpp", 383 "screen_session_manager_lite_proxy_test.cpp", 384 ] 385 386 deps = [ 387 ":ws_unittest_common", 388 "${window_base_path}/dm_lite:libdm_lite", 389 "${window_base_path}/wmserver:sms", 390 ] 391} 392 393ohos_unittest("ws_screen_session_manager_lite_stub_test") { 394 module_out_path = module_out_path 395 396 sources = [ "screen_session_manager_lite_stub_test.cpp" ] 397 398 deps = [ 399 ":ws_unittest_common", 400 "${window_base_path}/wmserver:sms", 401 ] 402} 403 404ohos_unittest("ws_screen_session_manager_stub_test") { 405 module_out_path = module_out_path 406 407 sources = [ "screen_session_manager_stub_test.cpp" ] 408 409 deps = [ 410 ":ws_unittest_common", 411 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 412 ] 413 414 external_deps = [ 415 "ability_runtime:app_manager", 416 "c_utils:utils", 417 "hilog:libhilog", 418 ] 419} 420 421ohos_unittest("ws_screen_session_manager_proxy_test") { 422 module_out_path = module_out_path 423 424 sources = [ "screen_session_manager_proxy_test.cpp" ] 425 426 deps = [ 427 ":ws_unittest_common", 428 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 429 ] 430 431 external_deps = [ 432 "ability_runtime:app_manager", 433 "c_utils:utils", 434 "hilog:libhilog", 435 ] 436} 437 438ohos_unittest("ws_screen_session_manager_test") { 439 module_out_path = module_out_path 440 441 sources = [ "screen_session_manager_test.cpp" ] 442 443 deps = [ 444 ":ws_unittest_common", 445 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 446 ] 447 448 external_deps = [ 449 "ability_runtime:ability_context_native", 450 "ability_runtime:app_manager", 451 "ability_runtime:runtime", 452 "c_utils:utils", 453 "hilog:libhilog", 454 ] 455} 456 457ohos_unittest("ws_fold_screen_controller_test") { 458 module_out_path = module_out_path 459 460 sources = [ "fold_screen_controller_test.cpp" ] 461 462 deps = [ ":ws_unittest_common" ] 463 464 external_deps = [ 465 "ability_runtime:app_manager", 466 "c_utils:utils", 467 "hilog:libhilog", 468 ] 469} 470 471ohos_unittest("ws_screen_rotation_property_test") { 472 module_out_path = module_out_path 473 474 sources = [ "screen_rotation_property_test.cpp" ] 475 476 deps = [ ":ws_unittest_common" ] 477 478 external_deps = [ 479 "ability_runtime:app_manager", 480 "c_utils:utils", 481 "hilog:libhilog", 482 ] 483 defines = [] 484 if (defined(global_parts_info) && defined(global_parts_info.sensors_sensor)) { 485 external_deps += [ "sensor:sensor_interface_native" ] 486 defines += [ "SENSOR_ENABLE" ] 487 } 488} 489 490ohos_unittest("ws_screen_session_dumper_test") { 491 module_out_path = module_out_path 492 493 sources = [ "screen_session_dumper_test.cpp" ] 494 495 deps = [ ":ws_unittest_common" ] 496 497 external_deps = [ 498 "c_utils:utils", 499 "hilog:libhilog", 500 ] 501} 502 503ohos_unittest("ws_session_display_power_controller_test") { 504 module_out_path = module_out_path 505 506 sources = [ "session_display_power_controller_test.cpp" ] 507 508 deps = [ ":ws_unittest_common" ] 509 510 external_deps = [ 511 "ability_runtime:app_manager", 512 "c_utils:utils", 513 "hilog:libhilog", 514 ] 515} 516 517ohos_unittest("ws_fold_screen_state_machine_test") { 518 module_out_path = module_out_path 519 520 sources = [ "fold_screen_state_machine_test.cpp" ] 521 522 deps = [ ":ws_unittest_common" ] 523 524 external_deps = [ 525 "ability_runtime:app_manager", 526 "c_utils:utils", 527 "hilog:libhilog", 528 ] 529} 530 531ohos_unittest("ws_single_display_sensor_fold_state_manager_test") { 532 module_out_path = module_out_path 533 534 sources = [ "single_display_sensor_fold_state_manager_test.cpp" ] 535 536 deps = [ ":ws_unittest_common" ] 537 538 external_deps = [ 539 "c_utils:utils", 540 "hilog:libhilog", 541 ] 542} 543 544ohos_unittest("ws_single_display_sensor_pocket_fold_state_manager_test") { 545 module_out_path = module_out_path 546 547 sources = [ "single_display_sensor_pocket_fold_state_manager_test.cpp" ] 548 549 deps = [ ":ws_unittest_common" ] 550 551 external_deps = [ 552 "c_utils:utils", 553 "hilog:libhilog", 554 ] 555} 556 557## Build ws_unittest_common.a {{{ 558config("ws_unittest_common_public_config") { 559 include_dirs = [ 560 "${window_base_path}/test/common/mock", 561 562 # for WMError Code 563 "${window_base_path}/dm/include", 564 "${window_base_path}/dmserver/include", 565 "${window_base_path}/interfaces/innerkits/dm", 566 "${window_base_path}/interfaces/innerkits/wm", 567 "${window_base_path}/window_scene/screen_session_manager/include", 568 "${window_base_path}/window_scene/session_manager/include", 569 "${window_base_path}/window_scene/session_manager_service/include", 570 "${window_base_path}/window_scene/common/include", 571 "${window_base_path}/window_scene", 572 "${window_base_path}/window_scene/test", 573 "${window_base_path}/window_scene/intention_event/service/event_stage/include", 574 "//third_party/googletest/googlemock/include", 575 576 # for window_manager_interface 577 "${window_base_path}/wmserver/include", 578 "${window_base_path}/wmserver/include/zidl", 579 "${graphic_base_path}/graphic_2d/rosen/modules/animation/window_animation/include", 580 "${multimodalinput_path}/input/interfaces/native/innerkits/event/include", 581 "${multimodalinput_path}/input/util/common/include", 582 "${ability_runtime_inner_api_path}/ability_manager/include", 583 "${window_base_path}/wm/include", 584 "${window_base_path}/wm/include/zidl", 585 586 # for session 587 "${window_base_path}/window_scene/session/container/include/zidl", 588 589 # for session_manager 590 "${multimodalinput_path}/input/interfaces/native/innerkits/event/include", 591 "${window_base_path}/window_scene/interfaces/include", 592 "${resourceschedule_path}/ffrt/interfaces/kits", 593 "${ability_runtime_inner_api_path}/ability_manager/include", 594 "${ability_runtime_inner_api_path}/session_handler/include", 595 596 "${window_base_path}/wm/include", 597 "${window_base_path}/wm/include/zidl", 598 599 # for window_manager_hilog 600 "${window_base_path}/utils/include", 601 602 "${accessibility_path}/interfaces/innerkits/common/include/", 603 "${accessibility_path}/common/interface/include/parcel/", 604 ] 605} 606 607ohos_static_library("ws_unittest_common") { 608 visibility = [ ":*" ] 609 testonly = true 610 611 public_configs = [ 612 ":ws_unittest_common_public_config", 613 "${window_base_path}/resources/config/build:coverage_flags", 614 "${window_base_path}/resources/config/build:testcase_flags", 615 ] 616 617 deps = [ 618 "${window_base_path}/dm:libdm", 619 "${window_base_path}/utils:libwmutil", 620 "${window_base_path}/utils:libwmutil_base", 621 "${window_base_path}/window_scene/common:window_scene_common", 622 "${window_base_path}/window_scene/intention_event/service:intention_event_anr_manager", 623 "${window_base_path}/window_scene/screen_session_manager:screen_session_manager_client", 624 "${window_base_path}/window_scene/session:scene_session", 625 "${window_base_path}/window_scene/session:screen_session", 626 "${window_base_path}/window_scene/session_manager:scene_session_manager", 627 "${window_base_path}/window_scene/session_manager:screen_session_manager", 628 "${window_base_path}/window_scene/session_manager:session_manager", 629 "${window_base_path}/window_scene/session_manager:session_manager_lite", 630 "${window_base_path}/wm:libwm", 631 "//third_party/googletest:gmock", 632 "//third_party/googletest:gtest_main", 633 "//third_party/libxml2:libxml2", 634 ] 635 636 public_deps = [ 637 "${arkui_path}/napi:ace_napi", 638 "${graphic_base_path}/graphic_2d/rosen/modules/render_service_client:librender_service_client", 639 "${window_base_path}/utils:libwmutil", 640 "${window_base_path}/utils:libwmutil_base", 641 ] 642 643 external_deps = [ 644 "ability_base:configuration", 645 "accessibility:accessibility_common", 646 "accessibility:accessibility_interface", 647 "c_utils:utils", 648 "hilog:libhilog", 649 "input:libmmi-client", 650 "ipc:ipc_single", 651 ] 652 653 public_external_deps = [ 654 "ability_base:session_info", 655 "ability_base:want", 656 ] 657 defines = [] 658 if (defined(global_parts_info) && defined(global_parts_info.sensors_sensor)) { 659 external_deps += [ "sensor:sensor_interface_native" ] 660 defines += [ "SENSOR_ENABLE" ] 661 } 662 663 part_name = "window_manager" 664 subsystem_name = "window" 665} 666## Build ws_unittest_common.a }}} 667