1# Copyright (c) 2021-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("../../powermgr.gni") 16import("../powermgr_test.gni") 17 18module_output_path = "${powermgr_part_name}/powermgr_native" 19 20############################################################################### 21config("module_private_config") { 22 visibility = [ ":*" ] 23 24 include_dirs = [ 25 "include", 26 "mock", 27 "include/utils", 28 "${powermgr_service_zidl}/include", 29 "${powermgr_service_zidl}/src/shutdown", 30 "${powermgr_service_path}/native/src/", 31 "${powermgr_service_path}/native/src/actions/", 32 "${powermgr_service_path}/native/src/actions/default", 33 "${powermgr_service_path}/native/src/shutdown", 34 "${powermgr_service_path}/native/src/suspend", 35 "${powermgr_service_path}/native/src/wakeup", 36 "${powermgr_test_path}/mock/action", 37 ] 38} 39 40config("module_mock_private_config") { 41 include_dirs = [ 42 "include/mock", 43 "mock", 44 "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include/", 45 "//commonlibrary/c_utils/base/include/", 46 "${powermgr_service_zidl}/include", 47 "${powermgr_service_path}/test/mock/action", 48 ] 49} 50 51deps_ex = [ 52 "ability_base:base", 53 "ability_base:want", 54 "ability_runtime:ability_manager", 55 "config_policy:configpolicy_util", 56 "common_event_service:cesfwk_innerkits", 57 "ipc:ipc_core", 58 "hilog:libhilog", 59 "safwk:system_ability_fwk", 60 "samgr:samgr_proxy", 61 "sensor:sensor_interface_native", 62 "c_utils:utils", 63 "input:libmmi-client", 64] 65 66defs = [ "POWER_GTEST" ] 67 68##############################client_test########################################## 69 70ohos_unittest("test_power_mgr_client") { 71 module_out_path = module_output_path 72 73 sources = [ "src/power_mgr_client_test.cpp" ] 74 75 configs = [ 76 "${powermgr_utils_path}:utils_config", 77 ":module_private_config", 78 "${powermgr_utils_path}:coverage_flags", 79 ] 80 81 deps = [ 82 "${powermgr_inner_api}:powermgr_client", 83 "${powermgr_service_path}:powermgr_stub", 84 "${powermgr_service_path}:powermgrservice", 85 "${powermgr_service_path}/native/src/actions:powermgr_actions", 86 "//third_party/googletest:gmock_main", 87 "//third_party/googletest:gtest_main", 88 ] 89 90 if (has_display_manager_part) { 91 deps_ex += [ "display_manager:displaymgr" ] 92 } 93 external_deps = deps_ex 94} 95 96##############################unittest########################################## 97ohos_unittest("test_register_callback_mode") { 98 module_out_path = module_output_path 99 100 sources = [ "src/power_register_callback_mode_test.cpp" ] 101 102 configs = [ 103 "${powermgr_utils_path}:utils_config", 104 ":module_private_config", 105 "${powermgr_utils_path}:coverage_flags", 106 ] 107 108 deps = [ 109 "${powermgr_inner_api}:powermgr_client", 110 "${powermgr_service_path}:powermgr_stub", 111 "${powermgr_service_path}:powermgrservice", 112 "${powermgr_service_path}/native/src/actions:powermgr_actions", 113 "//third_party/googletest:gtest_main", 114 ] 115 116 external_deps = deps_ex 117} 118 119ohos_unittest("test_power_get_mode") { 120 module_out_path = module_output_path 121 122 sources = [ "src/power_get_mode_test.cpp" ] 123 124 configs = [ 125 "${powermgr_utils_path}:utils_config", 126 ":module_private_config", 127 "${powermgr_utils_path}:coverage_flags", 128 ] 129 130 deps = [ 131 "${powermgr_inner_api}:powermgr_client", 132 "${powermgr_service_path}:powermgr_stub", 133 "${powermgr_service_path}:powermgrservice", 134 "${powermgr_service_path}/native/src/actions:powermgr_actions", 135 "//third_party/googletest:gtest_main", 136 ] 137 138 external_deps = deps_ex 139} 140 141ohos_unittest("test_power_set_mode") { 142 module_out_path = module_output_path 143 144 sources = [ "src/power_set_mode_test.cpp" ] 145 146 configs = [ 147 "${powermgr_utils_path}:utils_config", 148 ":module_private_config", 149 "${powermgr_utils_path}:coverage_flags", 150 ] 151 152 deps = [ 153 "${powermgr_inner_api}:powermgr_client", 154 "${powermgr_service_path}:powermgr_stub", 155 "${powermgr_service_path}:powermgrservice", 156 "${powermgr_service_path}/native/src/actions:powermgr_actions", 157 "//third_party/googletest:gtest_main", 158 ] 159 160 external_deps = deps_ex 161} 162 163ohos_unittest("test_power_device_mode") { 164 module_out_path = module_output_path 165 166 sources = [ "src/power_device_mode_test.cpp" ] 167 168 configs = [ 169 "${powermgr_utils_path}:utils_config", 170 ":module_private_config", 171 "${powermgr_utils_path}:coverage_flags", 172 ] 173 174 deps = [ 175 "${powermgr_inner_api}:powermgr_client", 176 "${powermgr_service_path}:powermgrservice", 177 "//third_party/googletest:gtest_main", 178 ] 179 180 external_deps = deps_ex 181} 182 183ohos_unittest("test_running_lock") { 184 module_out_path = module_output_path 185 186 sources = [ "src/running_lock_test.cpp" ] 187 188 configs = [ 189 "${powermgr_utils_path}:utils_config", 190 ":module_private_config", 191 "${powermgr_utils_path}:coverage_flags", 192 ] 193 194 deps = [ 195 "${powermgr_inner_api}:powermgr_client", 196 "${powermgr_service_path}:powermgrservice", 197 "//third_party/googletest:gtest_main", 198 ] 199 200 external_deps = deps_ex 201} 202 203ohos_unittest("test_power_mgr_service") { 204 module_out_path = module_output_path 205 206 sources = [ "src/power_mgr_service_test.cpp" ] 207 208 configs = [ 209 "${powermgr_utils_path}:utils_config", 210 ":module_private_config", 211 "${powermgr_utils_path}:coverage_flags", 212 ] 213 214 deps = [ 215 "${powermgr_inner_api}:powermgr_client", 216 "${powermgr_service_path}:powermgrservice", 217 "//third_party/googletest:gtest_main", 218 ] 219 220 external_deps = deps_ex 221} 222 223ohos_unittest("test_power_mgr_service_death") { 224 module_out_path = module_output_path 225 226 sources = [ 227 "mock/mock_power_remote_object.cpp", 228 "src/power_mgr_service_death_test.cpp", 229 ] 230 231 configs = [ 232 "${powermgr_utils_path}:utils_config", 233 ":module_private_config", 234 "${powermgr_utils_path}:coverage_flags", 235 ] 236 237 defines = [ "POWERMGR_SERVICE_DEATH_UT" ] 238 239 deps = [ 240 "${powermgr_inner_api}:powermgr_client", 241 "${powermgr_service_path}:powermgrservice", 242 "//third_party/googletest:gtest_main", 243 ] 244 245 external_deps = deps_ex 246} 247 248ohos_unittest("ces_system") { 249 module_out_path = module_output_path 250 251 sources = [ "src/ces_system_test.cpp" ] 252 253 configs = [ 254 "${powermgr_utils_path}:utils_config", 255 ":module_private_config", 256 "${powermgr_utils_path}:coverage_flags", 257 ] 258 259 deps = [ 260 "${powermgr_inner_api}:powermgr_client", 261 "${powermgr_service_path}:powermgr_stub", 262 "${powermgr_service_path}:powermgrservice", 263 "${powermgr_service_path}/native/src/actions:powermgr_actions", 264 "//third_party/googletest:gtest_main", 265 ] 266 267 external_deps = deps_ex 268} 269 270ohos_unittest("test_power_state_level_framework") { 271 module_out_path = module_output_path 272 273 resource_config_file = 274 "${powermgr_root_path}/test/unittest/resources/ohos_test.xml" 275 276 sources = [ "src/power_state_level_framework_test.cpp" ] 277 278 configs = [ 279 "${powermgr_utils_path}:utils_config", 280 ":module_private_config", 281 "${powermgr_utils_path}:coverage_flags", 282 ] 283 284 deps = [ 285 "${powermgr_inner_api}:powermgr_client", 286 "${powermgr_service_path}:powermgrservice", 287 "//third_party/googletest:gtest_main", 288 ] 289 290 external_deps = deps_ex 291} 292 293ohos_unittest("test_power_state_machine") { 294 module_out_path = module_output_path 295 296 sources = [ "src/power_state_machine_test.cpp" ] 297 298 configs = [ 299 "${powermgr_utils_path}:utils_config", 300 ":module_private_config", 301 "${powermgr_utils_path}:coverage_flags", 302 ] 303 304 deps = [ 305 "${powermgr_inner_api}:powermgr_client", 306 "${powermgr_service_path}:powermgr_stub", 307 "${powermgr_service_path}:powermgrservice", 308 "//third_party/googletest:gmock_main", 309 "//third_party/googletest:gtest_main", 310 ] 311 312 external_deps = deps_ex 313} 314 315ohos_unittest("test_power_mgr_mock") { 316 module_out_path = module_output_path 317 318 sources = [ "src/power_mgr_mock_test.cpp" ] 319 320 configs = [ 321 "${powermgr_utils_path}:utils_config", 322 ":module_private_config", 323 "${powermgr_utils_path}:coverage_flags", 324 ] 325 326 deps = [ 327 "${powermgr_inner_api}:powermgr_client", 328 "${powermgr_service_path}:powermgr_stub", 329 "${powermgr_service_path}:powermgrservice", 330 "${powermgr_service_path}/native/src/actions:powermgr_actions", 331 "//third_party/googletest:gmock_main", 332 "//third_party/googletest:gtest_main", 333 ] 334 335 external_deps = deps_ex 336} 337 338ohos_unittest("test_power_mgr_fail_check") { 339 module_out_path = module_output_path 340 341 sources = [ "src/power_mgr_fail_check_test.cpp" ] 342 343 configs = [ 344 "${powermgr_utils_path}:utils_config", 345 ":module_private_config", 346 "${powermgr_utils_path}:coverage_flags", 347 ] 348 349 deps = [ 350 "${powermgr_inner_api}:powermgr_client", 351 "${powermgr_service_path}:powermgr_stub", 352 "${powermgr_service_path}:powermgrservice", 353 "${powermgr_service_path}/native/src/actions:powermgr_actions", 354 "//third_party/googletest:gmock_main", 355 "//third_party/googletest:gtest_main", 356 ] 357 358 external_deps = deps_ex 359} 360 361if (false) { 362 ohos_unittest("test_power_mgr_notify") { 363 module_out_path = module_output_path 364 365 sources = [ "src/power_mgr_notify_test.cpp" ] 366 367 configs = [ 368 "${powermgr_utils_path}:utils_config", 369 ":module_private_config", 370 "${powermgr_utils_path}:coverage_flags", 371 ] 372 373 deps = [ 374 "${powermgr_inner_api}:powermgr_client", 375 "${powermgr_service_path}:powermgrservice", 376 "${powermgr_service_path}/native/src/actions:powermgr_actions", 377 "//third_party/googletest:gtest_main", 378 ] 379 380 external_deps = deps_ex 381 } 382} 383 384##############################coveragetest########################################## 385ohos_unittest("test_power_mgr_util") { 386 module_out_path = module_output_path 387 388 include_dirs = [ 389 "${powermgr_utils_path}/permission/include", 390 "${powermgr_utils_path}/param/include", 391 "${powermgr_utils_path}/setting/include", 392 "src/mock", 393 ] 394 395 sources = [ 396 "${powermgr_utils_path}/param/src/sysparam.cpp", 397 "${powermgr_utils_path}/permission/src/permission.cpp", 398 "${powermgr_utils_path}/setting/src/setting_observer.cpp", 399 "${powermgr_utils_path}/setting/src/setting_provider.cpp", 400 "src/mock/mock_accesstoken_kit.cpp", 401 "src/power_mgr_util_test.cpp", 402 ] 403 404 configs = [ 405 "${powermgr_utils_path}:utils_config", 406 ":module_private_config", 407 "${powermgr_utils_path}:coverage_flags", 408 ] 409 410 deps = [ 411 "${ability_runtime_path}/interfaces/inner_api/dataobs_manager:dataobs_manager", 412 "${powermgr_utils_path}/param:power_sysparam", 413 "${powermgr_utils_path}/setting:power_setting", 414 "//third_party/googletest:gtest_main", 415 ] 416 417 external_deps = [ 418 "ability_base:zuri", 419 "ability_runtime:ability_manager", 420 "access_token:libaccesstoken_sdk", 421 "access_token:libtokenid_sdk", 422 "data_share:datashare_common", 423 "data_share:datashare_consumer", 424 "init:libbeget_proxy", 425 "init:libbegetutil", 426 ] 427 external_deps += deps_ex 428} 429 430ohos_unittest("test_power_mock_object") { 431 module_out_path = module_output_path 432 433 sources = [ 434 "${powermgr_service_zidl}/src/power_mgr_proxy.cpp", 435 "mock/mock_power_remote_object.cpp", 436 "src/mock/power_mock_object_test.cpp", 437 ] 438 439 configs = [ 440 "${powermgr_utils_path}:utils_config", 441 ":module_private_config", 442 ":module_mock_private_config", 443 "${powermgr_utils_path}:coverage_flags", 444 ] 445 446 deps = [ 447 "${powermgr_inner_api}:powermgr_client", 448 "${powermgr_service_path}:powermgr_stub", 449 "${powermgr_service_path}:powermgrservice", 450 "//third_party/googletest:gtest_main", 451 ] 452 453 external_deps = deps_ex 454} 455 456ohos_unittest("test_mock_parcel") { 457 module_out_path = module_output_path 458 459 sources = [ 460 "${powermgr_service_zidl}/src/power_mgr_proxy.cpp", 461 "mock/mock_message_parcel.cpp", 462 "mock/mock_parcel.cpp", 463 "src/mock/power_mock_parcel_test.cpp", 464 ] 465 466 configs = [ 467 "${powermgr_utils_path}:utils_config", 468 ":module_private_config", 469 ":module_mock_private_config", 470 "${powermgr_utils_path}:coverage_flags", 471 ] 472 473 deps = [ 474 "${powermgr_inner_api}:powermgr_client", 475 "${powermgr_service_path}:powermgr_stub", 476 "${powermgr_service_path}:powermgrservice", 477 "${powermgr_utils_path}/permission:power_permission", 478 "//third_party/googletest:gtest_main", 479 ] 480 481 external_deps = deps_ex 482} 483 484ohos_unittest("test_mock_peer") { 485 module_out_path = module_output_path 486 487 sources = [ 488 "${powermgr_service_zidl}/src/power_mgr_proxy.cpp", 489 "mock/mock_peer_holder.cpp", 490 "src/mock/power_mock_peer_test.cpp", 491 ] 492 493 configs = [ 494 "${powermgr_utils_path}:utils_config", 495 ":module_private_config", 496 ":module_mock_private_config", 497 "${powermgr_utils_path}:coverage_flags", 498 ] 499 500 deps = [ 501 "${powermgr_inner_api}:powermgr_client", 502 "${powermgr_service_path}:powermgr_stub", 503 "${powermgr_service_path}:powermgrservice", 504 "//third_party/googletest:gtest_main", 505 ] 506 507 external_deps = deps_ex 508} 509 510ohos_unittest("test_mock_proxy") { 511 module_out_path = module_output_path 512 513 sources = [ 514 "${powermgr_service_zidl}/src/power_mgr_proxy.cpp", 515 "mock/mock_message_parcel.cpp", 516 "mock/mock_parcel.cpp", 517 "src/mock/power_mock_proxy_test.cpp", 518 ] 519 520 configs = [ 521 "${powermgr_utils_path}:utils_config", 522 ":module_private_config", 523 ":module_mock_private_config", 524 "${powermgr_utils_path}:coverage_flags", 525 ] 526 527 defines = [ 528 "MOCK_WRITE_INTERFACE_TOKEN_RETURN_TRUE", 529 "MOCK_MOCK_READSTRING_DESCRIPTIR", 530 ] 531 532 deps = [ 533 "${powermgr_inner_api}:powermgr_client", 534 "${powermgr_service_path}:powermgr_stub", 535 "${powermgr_service_path}:powermgrservice", 536 "//third_party/googletest:gtest_main", 537 ] 538 539 external_deps = deps_ex 540} 541 542ohos_unittest("power_state_machine_native_test") { 543 module_out_path = module_output_path 544 defines = defs 545 546 sources = [ "src/native_power_state_machine_test.cpp" ] 547 548 configs = [ 549 "${powermgr_utils_path}:utils_config", 550 ":module_private_config", 551 "${powermgr_utils_path}:coverage_flags", 552 ] 553 554 deps = [ 555 "${powermgr_inner_api}:powermgr_client", 556 "${powermgr_service_path}:powermgr_stub", 557 "${powermgr_service_path}:powermgrservice", 558 "//third_party/googletest:gtest_main", 559 ] 560 561 external_deps = deps_ex 562} 563 564ohos_unittest("test_running_lock_native") { 565 module_out_path = module_output_path 566 defines = defs 567 568 sources = [ "src/running_lock_native_test.cpp" ] 569 570 configs = [ 571 "${powermgr_utils_path}:utils_config", 572 ":module_private_config", 573 "${powermgr_utils_path}:coverage_flags", 574 ] 575 576 deps = [ 577 "${powermgr_inner_api}:powermgr_client", 578 "${powermgr_service_path}:powermgr_stub", 579 "${powermgr_service_path}:powermgrservice", 580 "//third_party/googletest:gtest_main", 581 ] 582 583 external_deps = deps_ex 584} 585 586ohos_unittest("test_power_mgr_service_native") { 587 module_out_path = module_output_path 588 defines = defs 589 590 defines += [ "THERMAL_GTEST" ] 591 592 sources = [ "src/power_mgr_service_native_test.cpp" ] 593 594 configs = [ 595 "${powermgr_utils_path}:utils_config", 596 ":module_private_config", 597 "${powermgr_utils_path}:coverage_flags", 598 ] 599 600 deps = [ 601 "${powermgr_inner_api}:powermgr_client", 602 "${powermgr_service_path}:powermgr_stub", 603 "${powermgr_service_path}:powermgrservice", 604 "//third_party/googletest:gmock_main", 605 "//third_party/googletest:gtest_main", 606 ] 607 608 external_deps = deps_ex 609} 610 611ohos_unittest("test_device_state_action_native") { 612 module_out_path = module_output_path 613 defines = defs 614 615 sources = [ "src/device_state_action_native_test.cpp" ] 616 617 configs = [ 618 "${powermgr_utils_path}:utils_config", 619 ":module_private_config", 620 "${powermgr_utils_path}:coverage_flags", 621 ] 622 623 deps = [ 624 "${powermgr_inner_api}:powermgr_client", 625 "${powermgr_service_path}:powermgr_stub", 626 "${powermgr_service_path}:powermgrservice", 627 "//third_party/googletest:gtest_main", 628 ] 629 630 deps_ex += [ "display_manager:displaymgr" ] 631 external_deps = deps_ex 632} 633 634ohos_unittest("test_power_mgr_dump") { 635 module_out_path = module_output_path 636 637 sources = [ "src/power_mgr_dump_test.cpp" ] 638 639 configs = [ 640 "${powermgr_utils_path}:utils_config", 641 ":module_private_config", 642 "${powermgr_utils_path}:coverage_flags", 643 ] 644 645 deps = [ 646 "${powermgr_inner_api}:powermgr_client", 647 "${powermgr_service_path}:powermgrservice", 648 "//third_party/googletest:gmock_main", 649 "//third_party/googletest:gtest_main", 650 ] 651 652 external_deps = deps_ex 653} 654 655ohos_unittest("test_power_mgr_client_native") { 656 module_out_path = module_output_path 657 defines = defs 658 659 sources = [ "src/power_mgr_client_native_test.cpp" ] 660 661 configs = [ 662 "${powermgr_utils_path}:utils_config", 663 ":module_private_config", 664 "${powermgr_utils_path}:coverage_flags", 665 ] 666 667 deps = [ 668 "${powermgr_inner_api}:powermgr_client", 669 "${powermgr_service_path}:powermgr_stub", 670 "${powermgr_service_path}:powermgrservice", 671 "//third_party/googletest:gmock_main", 672 "//third_party/googletest:gtest_main", 673 ] 674 675 external_deps = deps_ex 676} 677 678ohos_unittest("power_mode_module_native_test") { 679 module_out_path = module_output_path 680 defines = defs 681 sources = [ "src/power_mode_module_native_test.cpp" ] 682 configs = [ 683 "${powermgr_utils_path}:utils_config", 684 ":module_private_config", 685 "${powermgr_utils_path}:coverage_flags", 686 ] 687 deps = [ 688 "${powermgr_inner_api}:powermgr_client", 689 "${powermgr_service_path}:powermgr_stub", 690 "${powermgr_service_path}:powermgrservice", 691 "//third_party/googletest:gtest_main", 692 ] 693 external_deps = deps_ex 694} 695 696ohos_unittest("test_running_lock_hub_native") { 697 module_out_path = module_output_path 698 defines = defs 699 700 include_dirs = 701 [ "${powermgr_service_path}/native/src/actions/default/suspend" ] 702 703 sources = [ "src/running_lock_hub_native_test.cpp" ] 704 705 configs = [ 706 "${powermgr_utils_path}:utils_config", 707 ":module_private_config", 708 "${powermgr_utils_path}:coverage_flags", 709 ] 710 711 defines += [ "THERMAL_GTEST" ] 712 713 deps = [ 714 "${powermgr_inner_api}:powermgr_client", 715 "${powermgr_service_path}:powermgr_stub", 716 "${powermgr_service_path}:powermgrservice", 717 "//third_party/googletest:gtest_main", 718 ] 719 720 external_deps = deps_ex 721} 722 723ohos_unittest("test_running_lock_mock") { 724 module_out_path = module_output_path 725 726 sources = [ "src/running_lock_mock_test.cpp" ] 727 728 configs = [ 729 "${powermgr_utils_path}:utils_config", 730 ":module_private_config", 731 "${powermgr_utils_path}:coverage_flags", 732 ] 733 734 deps = [ 735 "${powermgr_inner_api}:powermgr_client", 736 "${powermgr_service_path}:powermgr_stub", 737 "${powermgr_service_path}:powermgrservice", 738 "${powermgr_service_path}/native/src/actions:powermgr_actions", 739 "//third_party/googletest:gmock_main", 740 "//third_party/googletest:gtest_main", 741 ] 742 743 external_deps = deps_ex 744} 745 746ohos_unittest("test_power_suspend_parse") { 747 module_out_path = module_output_path 748 749 sources = [ "src/power_suspend_parse_test.cpp" ] 750 751 configs = [ 752 "${powermgr_utils_path}:utils_config", 753 ":module_private_config", 754 "${powermgr_utils_path}:coverage_flags", 755 ] 756 757 include_dirs = [ "${powermgr_service_path}/native/src/setting/" ] 758 759 defines = [ "THERMAL_GTEST" ] 760 761 deps = [ 762 "${powermgr_inner_api}:powermgr_client", 763 "${powermgr_service_path}:powermgr_stub", 764 "${powermgr_service_path}:powermgrservice", 765 "${powermgr_service_path}/native/src/actions:powermgr_actions", 766 "${powermgr_utils_path}/setting:power_setting", 767 "//third_party/googletest:gtest_main", 768 ] 769 770 external_deps = [ 771 "ability_base:zuri", 772 "ability_runtime:ability_manager", 773 "c_utils:utils", 774 "data_share:datashare_common", 775 "data_share:datashare_consumer", 776 "hilog:libhilog", 777 "ipc:ipc_core", 778 "samgr:samgr_proxy", 779 ] 780 external_deps += deps_ex 781} 782 783ohos_unittest("test_power_wakeup_parse") { 784 module_out_path = module_output_path 785 786 sources = [ "src/power_wakeup_parse_test.cpp" ] 787 788 configs = [ 789 "${powermgr_utils_path}:utils_config", 790 ":module_private_config", 791 "${powermgr_utils_path}:coverage_flags", 792 ] 793 794 include_dirs = [ "${powermgr_service_path}/native/src/setting/" ] 795 796 defines = [ "THERMAL_GTEST" ] 797 798 deps = [ 799 "${powermgr_inner_api}:powermgr_client", 800 "${powermgr_service_path}:powermgr_stub", 801 "${powermgr_service_path}:powermgrservice", 802 "${powermgr_service_path}/native/src/actions:powermgr_actions", 803 "${powermgr_utils_path}/setting:power_setting", 804 "//third_party/googletest:gtest_main", 805 ] 806 807 external_deps = [ 808 "ability_base:zuri", 809 "ability_runtime:ability_manager", 810 "c_utils:utils", 811 "data_share:datashare_common", 812 "data_share:datashare_consumer", 813 "hilog:libhilog", 814 "ipc:ipc_core", 815 "samgr:samgr_proxy", 816 ] 817 external_deps += deps_ex 818} 819 820ohos_unittest("test_power_suspend") { 821 module_out_path = module_output_path 822 823 sources = [ "src/power_suspend_test.cpp" ] 824 825 configs = [ 826 "${powermgr_utils_path}:utils_config", 827 ":module_private_config", 828 ":module_mock_private_config", 829 "${powermgr_utils_path}:coverage_flags", 830 ] 831 832 include_dirs = [ "${powermgr_service_path}/native/src/setting/" ] 833 834 defines = [ "POWERMGR_GTEST" ] 835 836 deps = [ 837 "${powermgr_inner_api}:powermgr_client", 838 "${powermgr_service_path}:powermgr_stub", 839 "${powermgr_service_path}:powermgrservice", 840 "${powermgr_service_path}/native/src/actions:powermgr_actions", 841 "${powermgr_utils_path}/setting:power_setting", 842 "//third_party/googletest:gmock_main", 843 "//third_party/googletest:gtest_main", 844 "//third_party/jsoncpp:jsoncpp", 845 ] 846 847 external_deps = [ 848 "ability_base:zuri", 849 "ability_runtime:ability_manager", 850 "c_utils:utils", 851 "data_share:datashare_common", 852 "data_share:datashare_consumer", 853 "hilog:libhilog", 854 "ipc:ipc_core", 855 "samgr:samgr_proxy", 856 ] 857 external_deps += deps_ex 858} 859 860ohos_unittest("test_power_wakeup") { 861 module_out_path = module_output_path 862 863 sources = [ "src/power_wakeup_test.cpp" ] 864 865 configs = [ 866 "${powermgr_utils_path}:utils_config", 867 ":module_private_config", 868 ":module_mock_private_config", 869 "${powermgr_utils_path}:coverage_flags", 870 ] 871 872 include_dirs = [ "${powermgr_service_path}/native/src/setting/" ] 873 874 defines = [ "POWERMGR_GTEST" ] 875 876 deps = [ 877 "${powermgr_inner_api}:powermgr_client", 878 "${powermgr_service_path}:powermgr_stub", 879 "${powermgr_service_path}:powermgrservice", 880 "${powermgr_service_path}/native/src/actions:powermgr_actions", 881 "${powermgr_utils_path}/setting:power_setting", 882 "//third_party/googletest:gmock_main", 883 "//third_party/googletest:gtest_main", 884 "//third_party/jsoncpp:jsoncpp", 885 ] 886 887 external_deps = [ 888 "ability_base:zuri", 889 "ability_runtime:ability_manager", 890 "c_utils:utils", 891 "data_share:datashare_common", 892 "data_share:datashare_consumer", 893 "hilog:libhilog", 894 "ipc:ipc_core", 895 "samgr:samgr_proxy", 896 ] 897 external_deps += deps_ex 898} 899 900ohos_unittest("test_power_shutdown_clinet") { 901 module_out_path = module_output_path 902 903 sources = [ "src/shutdown_client_test.cpp" ] 904 905 configs = [ 906 "${powermgr_utils_path}:utils_config", 907 ":module_private_config", 908 "${powermgr_utils_path}:coverage_flags", 909 ] 910 911 deps = [ 912 "${powermgr_inner_api}:powermgr_client", 913 "${powermgr_service_path}:powermgrservice", 914 "//third_party/googletest:gtest_main", 915 ] 916 external_deps = deps_ex 917} 918 919ohos_unittest("test_power_service_mock") { 920 module_out_path = module_output_path 921 922 sources = [ "src/power_service_mock_test.cpp" ] 923 924 configs = [ 925 "${powermgr_utils_path}:utils_config", 926 ":module_private_config", 927 ":module_mock_private_config", 928 "${powermgr_utils_path}:coverage_flags", 929 ] 930 931 include_dirs = [ "${powermgr_service_path}/native/src/setting/" ] 932 933 defines = [ "POWERMGR_GTEST" ] 934 935 deps = [ 936 "${powermgr_inner_api}:powermgr_client", 937 "${powermgr_service_path}:powermgr_stub", 938 "${powermgr_service_path}:powermgrservice", 939 "${powermgr_service_path}/native/src/actions:powermgr_actions", 940 "${powermgr_utils_path}/permission:power_permission", 941 "${powermgr_utils_path}/setting:power_setting", 942 "//third_party/googletest:gmock_main", 943 "//third_party/googletest:gtest_main", 944 "//third_party/jsoncpp:jsoncpp", 945 ] 946 947 external_deps = [ 948 "ability_base:zuri", 949 "ability_runtime:ability_manager", 950 "c_utils:utils", 951 "data_share:datashare_common", 952 "data_share:datashare_consumer", 953 "ipc:ipc_core", 954 "samgr:samgr_proxy", 955 ] 956 external_deps += deps_ex 957} 958 959ohos_unittest("test_power_getcontroller_mock") { 960 module_out_path = module_output_path 961 962 sources = [ "src/power_getcontroller_mock_test.cpp" ] 963 964 configs = [ 965 "${powermgr_utils_path}:utils_config", 966 ":module_private_config", 967 ":module_mock_private_config", 968 "${powermgr_utils_path}:coverage_flags", 969 ] 970 971 include_dirs = [ "${powermgr_service_path}/native/src/setting/" ] 972 973 defines = [ "POWERMGR_GTEST" ] 974 975 deps = [ 976 "${powermgr_inner_api}:powermgr_client", 977 "${powermgr_service_path}:powermgr_stub", 978 "${powermgr_service_path}:powermgrservice", 979 "${powermgr_service_path}/native/src/actions:powermgr_actions", 980 "${powermgr_utils_path}/permission:power_permission", 981 "${powermgr_utils_path}/setting:power_setting", 982 "//third_party/googletest:gmock_main", 983 "//third_party/googletest:gtest_main", 984 "//third_party/jsoncpp:jsoncpp", 985 ] 986 987 external_deps = [ 988 "ability_base:zuri", 989 "ability_runtime:ability_manager", 990 "c_utils:utils", 991 "data_share:datashare_common", 992 "data_share:datashare_consumer", 993 "ipc:ipc_core", 994 "samgr:samgr_proxy", 995 ] 996 external_deps += deps_ex 997} 998 999ohos_unittest("test_power_screenon_mock") { 1000 module_out_path = module_output_path 1001 1002 sources = [ "src/power_screenon_mock_test.cpp" ] 1003 1004 configs = [ 1005 "${powermgr_utils_path}:utils_config", 1006 ":module_private_config", 1007 ":module_mock_private_config", 1008 "${powermgr_utils_path}:coverage_flags", 1009 ] 1010 1011 include_dirs = [ "${powermgr_service_path}/native/src/setting/" ] 1012 1013 defines = [ "POWERMGR_GTEST" ] 1014 1015 deps = [ 1016 "${powermgr_inner_api}:powermgr_client", 1017 "${powermgr_service_path}:powermgr_stub", 1018 "${powermgr_service_path}:powermgrservice", 1019 "${powermgr_service_path}/native/src/actions:powermgr_actions", 1020 "${powermgr_utils_path}/permission:power_permission", 1021 "${powermgr_utils_path}/setting:power_setting", 1022 "//third_party/googletest:gmock_main", 1023 "//third_party/googletest:gtest_main", 1024 "//third_party/jsoncpp:jsoncpp", 1025 ] 1026 1027 external_deps = [ 1028 "ability_base:zuri", 1029 "ability_runtime:ability_manager", 1030 "c_utils:utils", 1031 "data_share:datashare_common", 1032 "data_share:datashare_consumer", 1033 "ipc:ipc_core", 1034 "samgr:samgr_proxy", 1035 ] 1036 external_deps += deps_ex 1037} 1038 1039ohos_unittest("test_power_parsesources_mock") { 1040 module_out_path = module_output_path 1041 1042 sources = [ "src/power_parsesources_mock_test.cpp" ] 1043 1044 configs = [ 1045 "${powermgr_utils_path}:utils_config", 1046 ":module_private_config", 1047 ":module_mock_private_config", 1048 "${powermgr_utils_path}:coverage_flags", 1049 ] 1050 1051 include_dirs = [ "${powermgr_service_path}/native/src/setting/" ] 1052 1053 deps = [ 1054 "${powermgr_inner_api}:powermgr_client", 1055 "${powermgr_service_path}:powermgr_stub", 1056 "${powermgr_service_path}:powermgrservice", 1057 "${powermgr_service_path}/native/src/actions:powermgr_actions", 1058 "${powermgr_utils_path}/permission:power_permission", 1059 "${powermgr_utils_path}/setting:power_setting", 1060 "//third_party/googletest:gmock_main", 1061 "//third_party/googletest:gtest_main", 1062 "//third_party/jsoncpp:jsoncpp", 1063 ] 1064 1065 external_deps = [ 1066 "ability_base:zuri", 1067 "ability_runtime:ability_manager", 1068 "c_utils:utils", 1069 "data_share:datashare_common", 1070 "data_share:datashare_consumer", 1071 "ipc:ipc_core", 1072 "samgr:samgr_proxy", 1073 ] 1074 external_deps += deps_ex 1075} 1076 1077################################powermgrdialog################################ 1078 1079ohos_unittest("test_power_mgr_powerdialog") { 1080 module_out_path = module_output_path 1081 1082 sources = [ 1083 "mock/mock_power_remote_object.cpp", 1084 "src/power_mgr_powerdialog_test.cpp", 1085 ] 1086 1087 configs = [ 1088 "${powermgr_utils_path}:utils_config", 1089 ":module_private_config", 1090 "${powermgr_utils_path}:coverage_flags", 1091 ] 1092 1093 deps = [ 1094 "${powermgr_inner_api}:powermgr_client", 1095 "${powermgr_service_path}:powermgr_stub", 1096 "${powermgr_service_path}:powermgrservice", 1097 "${powermgr_service_path}/native/src/actions:powermgr_actions", 1098 "${powermgr_utils_path}/param:power_sysparam", 1099 "${powermgr_utils_path}/permission:power_permission", 1100 "${powermgr_utils_path}/setting:power_setting", 1101 "//third_party/googletest:gmock_main", 1102 "//third_party/googletest:gtest_main", 1103 "//third_party/libxml2:libxml2", 1104 ] 1105 1106 external_deps = deps_ex 1107} 1108 1109group("unittest") { 1110 testonly = true 1111 deps = [ 1112 ":power_mode_module_native_test", 1113 ":power_state_machine_native_test", 1114 ":test_device_state_action_native", 1115 ":test_mock_parcel", 1116 ":test_mock_peer", 1117 ":test_mock_proxy", 1118 ":test_power_device_mode", 1119 ":test_power_getcontroller_mock", 1120 ":test_power_mgr_client", 1121 ":test_power_mgr_client_native", 1122 ":test_power_mgr_dump", 1123 ":test_power_mgr_mock", 1124 ":test_power_mgr_powerdialog", 1125 ":test_power_mgr_service", 1126 ":test_power_mgr_service_death", 1127 ":test_power_mgr_service_native", 1128 ":test_power_mgr_util", 1129 ":test_power_mock_object", 1130 ":test_power_parsesources_mock", 1131 ":test_power_screenon_mock", 1132 ":test_power_service_mock", 1133 ":test_power_set_mode", 1134 ":test_power_shutdown_clinet", 1135 ":test_power_state_level_framework", 1136 ":test_power_state_machine", 1137 ":test_power_suspend", 1138 ":test_power_suspend_parse", 1139 ":test_power_wakeup", 1140 ":test_power_wakeup_parse", 1141 ":test_running_lock", 1142 ":test_running_lock_hub_native", 1143 ":test_running_lock_mock", 1144 ":test_running_lock_native", 1145 ] 1146} 1147