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