1# Copyright (c) 2021-2024 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/ability/ability_base/ability_base.gni") 16 17###################################################################### 18base_output_path = "ability_base/ability_base/base_test" 19 20###################################################################### 21config("base_private_config") { 22 visibility = [ ":*" ] 23} 24 25ohos_unittest("base_object_test") { 26 module_out_path = base_output_path 27 sources = [ "base/base_object_test.cpp" ] 28 29 configs = [ ":base_private_config" ] 30 31 deps = [] 32 33 external_deps = [ 34 "ability_base:base", 35 "c_utils:utils", 36 "googletest:gtest_main", 37 "ipc:ipc_core", 38 ] 39} 40 41ohos_unittest("base_test") { 42 module_out_path = base_output_path 43 sources = [ "base/base_test.cpp" ] 44 45 configs = [ ":base_private_config" ] 46 47 deps = [] 48 49 external_deps = [ 50 "ability_base:base", 51 "c_utils:utils", 52 "googletest:gtest_main", 53 ] 54} 55 56ohos_unittest("bool_wrapper_test") { 57 module_out_path = base_output_path 58 sources = [ "base/bool_wrapper_test.cpp" ] 59 60 configs = [ ":base_private_config" ] 61 62 deps = [] 63 64 external_deps = [ 65 "ability_base:base", 66 "c_utils:utils", 67 "googletest:gtest_main", 68 "ipc:ipc_core", 69 ] 70} 71 72ohos_unittest("byte_wrapper_test") { 73 module_out_path = base_output_path 74 sources = [ "base/byte_wrapper_test.cpp" ] 75 76 configs = [ ":base_private_config" ] 77 78 deps = [] 79 80 external_deps = [ 81 "ability_base:base", 82 "c_utils:utils", 83 "googletest:gtest_main", 84 "ipc:ipc_core", 85 ] 86} 87 88ohos_unittest("double_wrapper_test") { 89 module_out_path = base_output_path 90 sources = [ "base/double_wrapper_test.cpp" ] 91 92 configs = [ ":base_private_config" ] 93 94 deps = [] 95 96 external_deps = [ 97 "ability_base:base", 98 "c_utils:utils", 99 "googletest:gtest_main", 100 "ipc:ipc_core", 101 ] 102} 103 104ohos_unittest("float_wrapper_test") { 105 module_out_path = base_output_path 106 sources = [ "base/float_wrapper_test.cpp" ] 107 108 configs = [ ":base_private_config" ] 109 110 deps = [] 111 112 external_deps = [ 113 "ability_base:base", 114 "c_utils:utils", 115 "googletest:gtest_main", 116 "ipc:ipc_core", 117 ] 118} 119 120ohos_unittest("int_wrapper_test") { 121 module_out_path = base_output_path 122 sources = [ "base/int_wrapper_test.cpp" ] 123 124 configs = [ ":base_private_config" ] 125 126 deps = [] 127 128 external_deps = [ 129 "ability_base:base", 130 "c_utils:utils", 131 "googletest:gtest_main", 132 "ipc:ipc_core", 133 ] 134} 135 136ohos_unittest("long_wrapper_test") { 137 module_out_path = base_output_path 138 sources = [ "base/long_wrapper_test.cpp" ] 139 140 configs = [ ":base_private_config" ] 141 142 deps = [] 143 144 external_deps = [ 145 "ability_base:base", 146 "c_utils:utils", 147 "googletest:gtest_main", 148 "ipc:ipc_core", 149 ] 150} 151 152###################################################################### 153want_output_path = "ability_base/ability_base/want_test" 154 155###################################################################### 156config("want_private_config") { 157 defines = [ "ABILITYBASE_LOG_TAG = \"WantUnitTest\"" ] 158} 159 160config("module_private_want_param_wrapper_config") { 161 defines = [ "ABILITYBASE_LOG_TAG = \"WantUnitTest\"" ] 162} 163 164ohos_unittest("operation_test") { 165 module_out_path = want_output_path 166 sources = [ "want/operation_test.cpp" ] 167 168 configs = [ 169 ":want_private_config", 170 "${ability_base_path}:want_public_config", 171 ] 172 173 deps = [] 174 175 external_deps = [ 176 "ability_base:base", 177 "ability_base:want", 178 "ability_base:zuri", 179 "bundle_framework:appexecfwk_base", 180 "c_utils:utils", 181 "googletest:gtest_main", 182 ] 183} 184 185ohos_unittest("patterns_matcher_test") { 186 module_out_path = want_output_path 187 sources = [ "want/patterns_matcher_test.cpp" ] 188 189 configs = [ 190 ":want_private_config", 191 "${ability_base_path}:want_public_config", 192 ] 193 194 deps = [ "${ability_base_path}:base" ] 195 196 external_deps = [ 197 "ability_base:want", 198 "bundle_framework:appexecfwk_base", 199 "c_utils:utils", 200 "googletest:gtest_main", 201 "hilog:libhilog", 202 ] 203} 204 205ohos_unittest("skills_test") { 206 module_out_path = want_output_path 207 sources = [ "want/skills_test.cpp" ] 208 209 configs = [ 210 ":want_private_config", 211 "${ability_base_path}:want_public_config", 212 ] 213 214 deps = [] 215 216 external_deps = [ 217 "ability_base:base", 218 "ability_base:want", 219 "ability_base:zuri", 220 "bundle_framework:appexecfwk_base", 221 "c_utils:utils", 222 "googletest:gtest_main", 223 "hilog:libhilog", 224 "ipc:ipc_core", 225 ] 226} 227 228ohos_unittest("want_params_test") { 229 module_out_path = want_output_path 230 sources = [ "want/want_params_test.cpp" ] 231 232 configs = [ 233 ":want_private_config", 234 "${ability_base_path}:want_public_config", 235 ] 236 237 deps = [ 238 "${ability_base_path}:base", 239 "${ability_base_path}:want", 240 ] 241 242 external_deps = [ 243 "bundle_framework:appexecfwk_base", 244 "c_utils:utils", 245 "googletest:gtest_main", 246 "hilog:libhilog", 247 "ipc:ipc_core", 248 ] 249} 250 251ohos_unittest("want_params_wrapper_test") { 252 module_out_path = want_output_path 253 sources = [ "want/want_params_wrapper_test.cpp" ] 254 255 configs = [ ":module_private_want_param_wrapper_config" ] 256 257 deps = [] 258 259 external_deps = [ 260 "ability_base:base", 261 "ability_base:want", 262 "ability_base:zuri", 263 "bundle_framework:appexecfwk_base", 264 "c_utils:utils", 265 "googletest:gtest_main", 266 "hilog:libhilog", 267 "ipc:ipc_core", 268 ] 269} 270 271ohos_unittest("want_test") { 272 module_out_path = want_output_path 273 sources = [ "want/want_test.cpp" ] 274 275 configs = [ 276 ":want_private_config", 277 "${ability_base_path}:want_public_config", 278 ] 279 280 deps = [] 281 282 external_deps = [ 283 "ability_base:base", 284 "ability_base:want", 285 "ability_base:zuri", 286 "bundle_framework:appexecfwk_base", 287 "c_utils:utils", 288 "googletest:gtest_main", 289 "hilog:libhilog", 290 "ipc:ipc_core", 291 ] 292} 293 294ohos_unittest("pac_map_test") { 295 module_out_path = want_output_path 296 include_dirs = [ 297 "${ability_base_path}/interfaces/kits/native/want/include", 298 "${ability_base_path}/interfaces/kits/native/want/src", 299 ] 300 301 sources = [ 302 "want/pac_map_test.cpp" 303 ] 304 305 configs = [ 306 ":want_private_config", 307 "${ability_base_path}:want_public_config", 308 ] 309 310 deps = [] 311 312 external_deps = [ 313 "ability_base:base", 314 "ability_base:want", 315 "bundle_framework:appexecfwk_base", 316 "c_utils:utils", 317 "googletest:gtest_main", 318 "hilog:libhilog", 319 "ipc:ipc_core", 320 "jsoncpp:jsoncpp", 321 ] 322} 323 324ohos_unittest("pac_map_second_test") { 325 module_out_path = want_output_path 326 include_dirs = [ 327 "${ability_base_path}/interfaces/kits/native/want/include", 328 "${ability_base_path}/interfaces/kits/native/want/src", 329 ] 330 331 sources = [ 332 "want/pac_map_second_test.cpp" 333 ] 334 335 configs = [ 336 ":want_private_config", 337 "${ability_base_path}:want_public_config", 338 ] 339 340 deps = [] 341 342 external_deps = [ 343 "ability_base:base", 344 "ability_base:want", 345 "bundle_framework:appexecfwk_base", 346 "c_utils:utils", 347 "googletest:gtest_main", 348 "hilog:libhilog", 349 "ipc:ipc_core", 350 "jsoncpp:jsoncpp", 351 ] 352} 353 354ohos_unittest("uri_test") { 355 module_out_path = want_output_path 356 sources = [ "want/uri_test.cpp" ] 357 358 configs = [ 359 ":want_private_config", 360 "${ability_base_path}:want_public_config", 361 ] 362 363 deps = [] 364 365 external_deps = [ 366 "ability_base:base", 367 "ability_base:want", 368 "ability_base:zuri", 369 "bundle_framework:appexecfwk_base", 370 "c_utils:utils", 371 "googletest:gtest_main", 372 "hilog:libhilog", 373 ] 374} 375 376ohos_unittest("extra_params_test") { 377 module_out_path = want_output_path 378 sources = [ "want/extra_params_test.cpp" ] 379 380 configs = [ 381 ":want_private_config", 382 "${ability_base_path}:want_public_config", 383 ] 384 385 deps = [] 386 387 external_deps = [ 388 "ability_base:base", 389 "ability_base:want", 390 "ability_base:zuri", 391 "bundle_framework:appexecfwk_base", 392 "c_utils:utils", 393 "googletest:gtest_main", 394 ] 395} 396 397ohos_unittest("array_wrapper_test") { 398 module_out_path = want_output_path 399 sources = [ "want/array_wrapper_test.cpp" ] 400 401 configs = [ 402 ":want_private_config", 403 "${ability_base_path}:want_public_config", 404 ] 405 406 deps = [] 407 408 external_deps = [ 409 "ability_base:base", 410 "ability_base:want", 411 "ability_base:zuri", 412 "bundle_framework:appexecfwk_base", 413 "c_utils:utils", 414 "googletest:gtest_main", 415 "ipc:ipc_core", 416 ] 417} 418 419ohos_unittest("zchar_wrapper_test") { 420 module_out_path = base_output_path 421 sources = [ "base/zchar_wrapper_test.cpp" ] 422 423 configs = [ 424 ":want_private_config", 425 "${ability_base_path}:want_public_config", 426 ] 427 428 deps = [] 429 430 external_deps = [ 431 "ability_base:base", 432 "ability_base:want", 433 "ability_base:zuri", 434 "bundle_framework:appexecfwk_base", 435 "c_utils:utils", 436 "googletest:gtest_main", 437 "ipc:ipc_core", 438 ] 439} 440 441ohos_unittest("short_wrapper_test") { 442 module_out_path = base_output_path 443 sources = [ "base/short_wrapper_test.cpp" ] 444 445 configs = [ 446 ":want_private_config", 447 "${ability_base_path}:want_public_config", 448 ] 449 450 deps = [] 451 452 external_deps = [ 453 "ability_base:base", 454 "ability_base:want", 455 "ability_base:zuri", 456 "bundle_framework:appexecfwk_base", 457 "c_utils:utils", 458 "googletest:gtest_main", 459 "ipc:ipc_core", 460 ] 461} 462 463ohos_unittest("string_wrapper_test") { 464 module_out_path = base_output_path 465 sources = [ "base/string_wrapper_test.cpp" ] 466 467 configs = [ 468 ":want_private_config", 469 "${ability_base_path}:want_public_config", 470 ] 471 472 deps = [] 473 474 external_deps = [ 475 "ability_base:base", 476 "ability_base:want", 477 "ability_base:zuri", 478 "bundle_framework:appexecfwk_base", 479 "c_utils:utils", 480 "googletest:gtest_main", 481 "ipc:ipc_core", 482 ] 483} 484 485ohos_unittest("user_object_wrapper_test") { 486 module_out_path = base_output_path 487 sources = [ "base/user_object_wrapper_test.cpp" ] 488 489 configs = [ 490 ":want_private_config", 491 "${ability_base_path}:want_public_config", 492 ] 493 494 deps = [] 495 496 external_deps = [ 497 "ability_base:base", 498 "ability_base:want", 499 "ability_base:zuri", 500 "bundle_framework:appexecfwk_base", 501 "c_utils:utils", 502 "googletest:gtest_main", 503 "ipc:ipc_core", 504 ] 505} 506 507ohos_unittest("cwant_manager_test") { 508 module_out_path = want_output_path 509 sources = [ "cwant/capi_want_manager_test.cpp" ] 510 511 configs = [] 512 513 include_dirs = [ 514 "${ability_base_innerapi_path}/log/include", 515 "${ability_base_kits_native_path}", 516 "${ability_base_ndk_path}/common", 517 "${ability_base_ndk_path}/cwant/include", 518 "${ability_base_path}:want_public_config", 519 ] 520 521 deps = [] 522 523 external_deps = [ 524 "ability_base:ability_base_want", 525 "ability_base:base", 526 "ability_base:want", 527 "c_utils:utils", 528 "hilog:libhilog", 529 "ipc:ipc_single", 530 ] 531} 532 533ohos_unittest("cwant_test") { 534 module_out_path = want_output_path 535 sources = [ "cwant/capi_want_test.cpp" ] 536 537 configs = [] 538 539 include_dirs = [ 540 "${ability_base_innerapi_path}/log/include", 541 "${ability_base_kits_native_path}", 542 "${ability_base_ndk_path}/common", 543 "${ability_base_ndk_path}/cwant/include", 544 ] 545 546 deps = [] 547 548 external_deps = [ 549 "ability_base:ability_base_want", 550 "ability_base:base", 551 "ability_base:want", 552 "c_utils:utils", 553 "hilog:libhilog", 554 "ipc:ipc_single", 555 ] 556} 557 558###################################################################### 559extractor_output_path = "ability_base/ability_base/extractor_test" 560 561###################################################################### 562config("extractor_private_config") { 563 visibility = [ ":*" ] 564 include_dirs = 565 [ "{ability_base_path}/interfaces/kits/native/extractor/include" ] 566 567 defines = [ "ABILITYBASE_LOG_TAG = \"ExtractorTest\"" ] 568} 569 570ohos_unittest("extractor_test") { 571 module_out_path = extractor_output_path 572 sources = [ "extractor/extractor_test.cpp" ] 573 574 configs = [ ":extractor_private_config" ] 575 576 deps = [] 577 578 external_deps = [ 579 "ability_base:extractortool", 580 "ability_base:extractresourcemanager", 581 "ability_base:string_utils", 582 "c_utils:utils", 583 "googletest:gtest_main", 584 "hilog:libhilog", 585 "resource_management:global_resmgr", 586 "zlib:libz", 587 "zlib:shared_libz", 588 ] 589} 590 591ohos_unittest("session_info_test") { 592 module_out_path = "ability_base/ability_base/session_info_test" 593 sources = [ "session_info/session_info_test.cpp" ] 594 595 configs = [] 596 597 deps = [] 598 599 external_deps = [ 600 "ability_base:session_info", 601 "ability_base:want", 602 "bundle_framework:appexecfwk_base", 603 "c_utils:utils", 604 "googletest:gtest_main", 605 "hilog:libhilog", 606 "ipc:ipc_core", 607 "zlib:libz", 608 "zlib:shared_libz", 609 ] 610} 611 612###################################################################### 613viewdata_output_path = "ability_base/ability_base/view_data_test" 614 615###################################################################### 616config("viewdata_private_config") { 617 visibility = [ ":*" ] 618 include_dirs = 619 [ "{ability_base_path}/interfaces/kits/native/view_data/include" ] 620 621 defines = [ "ABILITYBASE_LOG_TAG = \"ViewDataTest\"" ] 622} 623 624ohos_unittest("view_data_test") { 625 module_out_path = viewdata_output_path 626 sources = [ "viewdata/view_data_test.cpp" ] 627 628 configs = [ ":viewdata_private_config" ] 629 630 deps = [] 631 632 external_deps = [ 633 "ability_base:base", 634 "ability_base:session_info", 635 "ability_base:string_utils", 636 "ability_base:view_data", 637 "ability_base:want", 638 "ability_base:zuri", 639 "bundle_framework:appexecfwk_base", 640 "c_utils:utils", 641 "googletest:gtest_main", 642 "hilog:libhilog", 643 "ipc:ipc_core", 644 "json:nlohmann_json_static", 645 "zlib:libz", 646 "zlib:shared_libz", 647 ] 648} 649 650ohos_unittest("rect_test") { 651 module_out_path = viewdata_output_path 652 sources = [ "viewdata/rect_test.cpp" ] 653 654 configs = [ ":viewdata_private_config" ] 655 656 deps = [] 657 658 external_deps = [ 659 "ability_base:base", 660 "ability_base:session_info", 661 "ability_base:string_utils", 662 "ability_base:view_data", 663 "ability_base:want", 664 "ability_base:zuri", 665 "bundle_framework:appexecfwk_base", 666 "c_utils:utils", 667 "googletest:gtest_main", 668 "hilog:libhilog", 669 "ipc:ipc_core", 670 "json:nlohmann_json_static", 671 "zlib:libz", 672 "zlib:shared_libz", 673 ] 674} 675 676ohos_unittest("page_node_info_test") { 677 module_out_path = viewdata_output_path 678 sources = [ "viewdata/page_node_info_test.cpp" ] 679 680 configs = [ ":viewdata_private_config" ] 681 682 deps = [] 683 684 external_deps = [ 685 "ability_base:base", 686 "ability_base:session_info", 687 "ability_base:string_utils", 688 "ability_base:view_data", 689 "ability_base:want", 690 "ability_base:zuri", 691 "bundle_framework:appexecfwk_base", 692 "c_utils:utils", 693 "googletest:gtest_main", 694 "hilog:libhilog", 695 "ipc:ipc_core", 696 "json:nlohmann_json_static", 697 "zlib:libz", 698 "zlib:shared_libz", 699 ] 700} 701 702###################################################################### 703base_configuration_output_path = 704 "ability_base/ability_base/base_configuration_test" 705 706###################################################################### 707config("configuration_private_config") { 708 visibility = [ ":*" ] 709 include_dirs = 710 [ "${ability_base_path}/interfaces/kits/native/configuration/include" ] 711 712 defines = [ "ABILITYBASE_LOG_TAG = \"BaseConfigurationTest\"" ] 713} 714 715ohos_unittest("base_configuration_test") { 716 module_out_path = base_configuration_output_path 717 718 sources = [ "configuration/base_configuration_test.cpp" ] 719 720 configs = [ ":configuration_private_config" ] 721 deps = [] 722 723 external_deps = [ 724 "ability_base:base", 725 "ability_base:configuration", 726 "ability_base:session_info", 727 "ability_base:string_utils", 728 "ability_base:view_data", 729 "ability_base:want", 730 "ability_base:zuri", 731 "bundle_framework:appexecfwk_base", 732 "c_utils:utils", 733 "googletest:gtest_main", 734 "hilog:libhilog", 735 "ipc:ipc_core", 736 "json:nlohmann_json_static", 737 "zlib:libz", 738 "zlib:shared_libz", 739 ] 740} 741 742###################################################################### 743 744group("unittest") { 745 testonly = true 746 deps = [ 747 #":base_test", 748 ":array_wrapper_test", 749 ":base_configuration_test", 750 ":base_object_test", 751 ":bool_wrapper_test", 752 ":byte_wrapper_test", 753 ":cwant_test", 754 ":cwant_manager_test", 755 ":double_wrapper_test", 756 ":extra_params_test", 757 ":extractor_test", 758 ":float_wrapper_test", 759 ":int_wrapper_test", 760 ":long_wrapper_test", 761 ":operation_test", 762 ":page_node_info_test", 763 ":patterns_matcher_test", 764 ":rect_test", 765 ":session_info_test", 766 ":short_wrapper_test", 767 ":skills_test", 768 ":string_wrapper_test", 769 ":uri_test", 770 ":user_object_wrapper_test", 771 ":view_data_test", 772 ":want_params_test", 773 ":want_params_wrapper_test", 774 ":want_test", 775 ":pac_map_second_test", 776 ":pac_map_test", 777 ":zchar_wrapper_test", 778 ] 779} 780