1# Copyright (c) 2021-2022 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("//base/notification/common_event_service/event.gni") 15import("//build/test.gni") 16 17module_output_path = "common_event_service/services" 18 19config("cesfwk_services_config") { 20 visibility = [ ":*" ] 21 22 include_dirs = [ 23 "${common_event_service_path}/test/mock/include", 24 "${services_path}/include", 25 ] 26 27 cflags = [] 28 29 if (target_cpu == "arm") { 30 cflags += [ "-DBINDER_IPC_32BIT" ] 31 } 32} 33 34ohos_unittest("common_event_publish_system_event_test") { 35 module_out_path = module_output_path 36 37 sources = [ 38 "${common_event_service_path}/test/mock/mock_access_token_helper.cpp", 39 "${common_event_service_path}/test/mock/mock_bundle_manager.cpp", 40 "common_event_publish_system_event_test.cpp", 41 ] 42 43 configs = [ ":cesfwk_services_config" ] 44 45 deps = [ 46 "${ces_common_path}:libevent_common", 47 "${ces_core_path}:cesfwk_core", 48 "${ces_native_path}:cesfwk_innerkits", 49 "${services_path}:cesfwk_services", 50 "//third_party/googletest:gtest_main", 51 ] 52 53 external_deps = [ 54 "ability_base:want", 55 "access_token:libaccesstoken_sdk", 56 "bundle_framework:appexecfwk_base", 57 "bundle_framework:appexecfwk_core", 58 "c_utils:utils", 59 "eventhandler:libeventhandler", 60 "hiviewdfx_hilog_native:libhilog", 61 "ipc:ipc_core", 62 ] 63} 64 65ohos_unittest("common_event_dump_test") { 66 module_out_path = module_output_path 67 68 sources = [ 69 "${common_event_service_path}/test/mock/mock_access_token_helper.cpp", 70 "${common_event_service_path}/test/mock/mock_bundle_manager.cpp", 71 "common_event_dump_test.cpp", 72 ] 73 74 configs = [ ":cesfwk_services_config" ] 75 76 deps = [ 77 "${ces_common_path}:libevent_common", 78 "${ces_core_path}:cesfwk_core", 79 "${ces_native_path}:cesfwk_innerkits", 80 "${services_path}:cesfwk_services", 81 "//third_party/googletest:gtest_main", 82 ] 83 84 external_deps = [ 85 "ability_base:want", 86 "access_token:libaccesstoken_sdk", 87 "bundle_framework:appexecfwk_base", 88 "bundle_framework:appexecfwk_core", 89 "c_utils:utils", 90 "eventhandler:libeventhandler", 91 "hiviewdfx_hilog_native:libhilog", 92 "ipc:ipc_core", 93 ] 94} 95 96ohos_unittest("common_event_freeze_test") { 97 module_out_path = module_output_path 98 99 sources = [ 100 "${common_event_service_path}/test/mock/mock_access_token_helper.cpp", 101 "${common_event_service_path}/test/mock/mock_bundle_manager.cpp", 102 "common_event_freeze_test.cpp", 103 ] 104 105 configs = [ ":cesfwk_services_config" ] 106 107 deps = [ 108 "${ces_common_path}:libevent_common", 109 "${ces_core_path}:cesfwk_core", 110 "${ces_native_path}:cesfwk_innerkits", 111 "${services_path}:cesfwk_services", 112 "//third_party/googletest:gtest_main", 113 ] 114 115 external_deps = [ 116 "ability_base:want", 117 "access_token:libaccesstoken_sdk", 118 "bundle_framework:appexecfwk_base", 119 "bundle_framework:appexecfwk_core", 120 "c_utils:utils", 121 "eventhandler:libeventhandler", 122 "hiviewdfx_hilog_native:libhilog", 123 "ipc:ipc_core", 124 ] 125} 126 127ohos_unittest("common_event_freeze_unit_test") { 128 module_out_path = module_output_path 129 130 sources = [ 131 "${common_event_service_path}/test/mock/mock_access_token_helper.cpp", 132 "${common_event_service_path}/test/mock/mock_bundle_manager.cpp", 133 "common_event_freeze_unit_test.cpp", 134 ] 135 136 configs = [ ":cesfwk_services_config" ] 137 138 deps = [ 139 "${ces_common_path}:libevent_common", 140 "${ces_core_path}:cesfwk_core", 141 "${ces_native_path}:cesfwk_innerkits", 142 "${services_path}:cesfwk_services", 143 "//third_party/googletest:gtest_main", 144 ] 145 146 external_deps = [ 147 "ability_base:want", 148 "access_token:libaccesstoken_sdk", 149 "bundle_framework:appexecfwk_base", 150 "bundle_framework:appexecfwk_core", 151 "c_utils:utils", 152 "eventhandler:libeventhandler", 153 "hiviewdfx_hilog_native:libhilog", 154 "ipc:ipc_core", 155 ] 156} 157 158ohos_unittest("ability_manager_death_recipient_unit_test") { 159 module_out_path = module_output_path 160 161 include_dirs = [ 162 "${ces_innerkits_path}", 163 "${services_path}/include", 164 "ability_manager_death_recipient_unit_test", 165 ] 166 167 sources = [ 168 "${services_path}/src/ability_manager_death_recipient.cpp", 169 "ability_manager_death_recipient_unit_test/ability_manager_death_recipient_unit_test.cpp", 170 "mock/mock_ability_manager_helper.cpp", 171 ] 172 173 deps = [ 174 "${ces_common_path}:libevent_common", 175 "${ces_native_path}:cesfwk_innerkits", 176 "//third_party/googletest:gtest_main", 177 ] 178 179 external_deps = [ 180 "ability_runtime:ability_manager", 181 "c_utils:utils", 182 "hiviewdfx_hilog_native:libhilog", 183 "ipc:ipc_core", 184 ] 185} 186 187ohos_unittest("bundle_manager_death_recipient_unit_test") { 188 module_out_path = module_output_path 189 190 include_dirs = [ 191 "${ces_innerkits_path}", 192 "${services_path}/include", 193 ] 194 195 sources = [ 196 "${services_path}/src/bms_death_recipient.cpp", 197 "bundle_manager_death_recipient_unit_test/bundle_manager_death_recipient_unit_test.cpp", 198 "mock/mock_bundle_manager_helper.cpp", 199 ] 200 201 deps = [ 202 "${ces_common_path}:libevent_common", 203 "${ces_native_path}:cesfwk_innerkits", 204 "//third_party/googletest:gtest_main", 205 ] 206 207 external_deps = [ 208 "bundle_framework:appexecfwk_base", 209 "bundle_framework:appexecfwk_core", 210 "c_utils:utils", 211 "hiviewdfx_hilog_native:libhilog", 212 "ipc:ipc_core", 213 ] 214} 215 216ohos_unittest("static_subscriber_manager_unit_test") { 217 module_out_path = module_output_path 218 219 include_dirs = [ 220 "${ces_innerkits_path}", 221 "${services_path}/include", 222 "//third_party/json/include", 223 ] 224 225 sources = [ 226 "${services_path}/src/event_report.cpp", 227 "${services_path}/src/static_subscriber_manager.cpp", 228 "mock/mock_ability_manager_helper.cpp", 229 "mock/mock_bundle_manager_helper.cpp", 230 "static_subscriber_manager_unit_test/mock_access_token_helper.cpp", 231 "static_subscriber_manager_unit_test/mock_os_account_manager_helper.cpp", 232 "static_subscriber_manager_unit_test/static_subscriber_manager_unit_test.cpp", 233 ] 234 235 deps = [ 236 "${ces_common_path}:libevent_common", 237 "${ces_native_path}:cesfwk_innerkits", 238 "//third_party/googletest:gtest_main", 239 ] 240 241 external_deps = [ 242 "ability_base:want", 243 "ability_runtime:ability_manager", 244 "access_token:libaccesstoken_sdk", 245 "bundle_framework:appexecfwk_base", 246 "bundle_framework:appexecfwk_core", 247 "c_utils:utils", 248 "hicollie_native:libhicollie", 249 "hitrace_native:hitrace_meter", 250 "hiviewdfx_hilog_native:libhilog", 251 "ipc:ipc_core", 252 ] 253} 254 255ohos_unittest("static_subscriber_connection_unit_test") { 256 module_out_path = module_output_path 257 258 include_dirs = [ 259 "${ces_innerkits_path}", 260 "${services_path}/include", 261 "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native", 262 ] 263 264 sources = [ 265 "${services_path}/src/static_subscriber_connection.cpp", 266 "static_subscriber_connection_unit_test/mock_static_subscriber_proxy.cpp", 267 "static_subscriber_connection_unit_test/static_subscriber_connection_unit_test.cpp", 268 ] 269 270 deps = [ 271 "${ces_common_path}:libevent_common", 272 "${ces_native_path}:cesfwk_innerkits", 273 "//third_party/googletest:gtest_main", 274 ] 275 276 external_deps = [ 277 "ability_base:want", 278 "ability_runtime:ability_manager", 279 "c_utils:utils", 280 "hiviewdfx_hilog_native:libhilog", 281 "ipc:ipc_core", 282 ] 283} 284 285ohos_unittest("common_event_sticky_test") { 286 module_out_path = module_output_path 287 288 sources = [ 289 "${common_event_service_path}/test/mock/mock_access_token_helper.cpp", 290 "${common_event_service_path}/test/mock/mock_bundle_manager.cpp", 291 "common_event_sticky_test.cpp", 292 ] 293 294 configs = [ ":cesfwk_services_config" ] 295 296 deps = [ 297 "${ces_common_path}:libevent_common", 298 "${ces_core_path}:cesfwk_core", 299 "${ces_native_path}:cesfwk_innerkits", 300 "${services_path}:cesfwk_services", 301 "//third_party/googletest:gtest_main", 302 ] 303 304 external_deps = [ 305 "ability_base:want", 306 "access_token:libaccesstoken_sdk", 307 "bundle_framework:appexecfwk_base", 308 "bundle_framework:appexecfwk_core", 309 "c_utils:utils", 310 "eventhandler:libeventhandler", 311 "hiviewdfx_hilog_native:libhilog", 312 "ipc:ipc_core", 313 ] 314} 315 316ohos_unittest("common_event_subscribe_unit_test") { 317 module_out_path = module_output_path 318 319 sources = [ 320 "${common_event_service_path}/test/mock/mock_access_token_helper.cpp", 321 "${common_event_service_path}/test/mock/mock_bundle_manager.cpp", 322 "${common_event_service_path}/test/mock/mock_ipc_object_stub.cpp", 323 "common_event_subscribe_unit_test.cpp", 324 ] 325 326 configs = [ ":cesfwk_services_config" ] 327 328 deps = [ 329 "${ability_runtime_path}/frameworks/native/ability/native:static_subscriber_ipc", 330 "${ces_common_path}:libevent_common", 331 "${ces_core_path}:cesfwk_core", 332 "${ces_native_path}:cesfwk_innerkits", 333 "${services_path}:cesfwk_services", 334 "//third_party/googletest:gtest_main", 335 ] 336 337 external_deps = [ 338 "ability_base:want", 339 "ability_runtime:ability_manager", 340 "access_token:libaccesstoken_sdk", 341 "bundle_framework:appexecfwk_base", 342 "bundle_framework:appexecfwk_core", 343 "c_utils:utils", 344 "eventhandler:libeventhandler", 345 "hiviewdfx_hilog_native:libhilog", 346 "ipc:ipc_core", 347 ] 348} 349 350ohos_unittest("common_event_unsubscribe_unit_test") { 351 module_out_path = module_output_path 352 353 sources = [ 354 "${common_event_service_path}/test/mock/mock_access_token_helper.cpp", 355 "${common_event_service_path}/test/mock/mock_bundle_manager.cpp", 356 "common_event_unsubscribe_unit_test.cpp", 357 ] 358 359 configs = [ ":cesfwk_services_config" ] 360 361 deps = [ 362 "${ces_common_path}:libevent_common", 363 "${ces_core_path}:cesfwk_core", 364 "${ces_native_path}:cesfwk_innerkits", 365 "${services_path}:cesfwk_services", 366 "//third_party/googletest:gtest_main", 367 ] 368 369 external_deps = [ 370 "ability_base:want", 371 "access_token:libaccesstoken_sdk", 372 "bundle_framework:appexecfwk_base", 373 "bundle_framework:appexecfwk_core", 374 "c_utils:utils", 375 "eventhandler:libeventhandler", 376 "hiviewdfx_hilog_native:libhilog", 377 "ipc:ipc_core", 378 ] 379} 380 381ohos_unittest("common_event_publish_ordered_event_unit_test") { 382 module_out_path = module_output_path 383 384 sources = [ 385 "${common_event_service_path}/test/mock/mock_access_token_helper.cpp", 386 "${common_event_service_path}/test/mock/mock_bundle_manager.cpp", 387 "common_event_publish_ordered_event_unit_test.cpp", 388 ] 389 390 configs = [ ":cesfwk_services_config" ] 391 392 deps = [ 393 "${ces_common_path}:libevent_common", 394 "${ces_core_path}:cesfwk_core", 395 "${ces_native_path}:cesfwk_innerkits", 396 "${services_path}:cesfwk_services", 397 "//third_party/googletest:gtest_main", 398 ] 399 400 external_deps = [ 401 "ability_base:want", 402 "access_token:libaccesstoken_sdk", 403 "bundle_framework:appexecfwk_base", 404 "bundle_framework:appexecfwk_core", 405 "c_utils:utils", 406 "eventhandler:libeventhandler", 407 "hiviewdfx_hilog_native:libhilog", 408 "ipc:ipc_core", 409 ] 410} 411 412ohos_unittest("common_event_publish_permission_event_unit_test") { 413 module_out_path = module_output_path 414 415 sources = [ 416 "${common_event_service_path}/test/mock/mock_access_token_helper.cpp", 417 "${common_event_service_path}/test/mock/mock_bundle_manager.cpp", 418 "common_event_publish_permission_event_unit_test.cpp", 419 ] 420 421 configs = [ ":cesfwk_services_config" ] 422 423 deps = [ 424 "${ces_common_path}:libevent_common", 425 "${ces_core_path}:cesfwk_core", 426 "${ces_native_path}:cesfwk_innerkits", 427 "${services_path}:cesfwk_services", 428 "//third_party/googletest:gtest_main", 429 ] 430 431 external_deps = [ 432 "ability_base:want", 433 "access_token:libaccesstoken_sdk", 434 "bundle_framework:appexecfwk_base", 435 "bundle_framework:appexecfwk_core", 436 "c_utils:utils", 437 "eventhandler:libeventhandler", 438 "hiviewdfx_hilog_native:libhilog", 439 "ipc:ipc_core", 440 ] 441} 442 443ohos_unittest("common_event_publish_manager_event_unit_test") { 444 module_out_path = module_output_path 445 446 sources = [ "common_event_publish_manager_event_unit_test.cpp" ] 447 448 configs = [ ":cesfwk_services_config" ] 449 450 deps = [ 451 "${services_path}:cesfwk_services", 452 "//third_party/googletest:gtest_main", 453 ] 454 455 external_deps = [ 456 "c_utils:utils", 457 "hiviewdfx_hilog_native:libhilog", 458 ] 459} 460 461ohos_unittest("common_event_hisysevent_test") { 462 module_out_path = module_output_path 463 464 sources = [ "common_event_hisysevent_test.cpp" ] 465 466 configs = [ ":cesfwk_services_config" ] 467 468 deps = [ 469 "${services_path}:cesfwk_services", 470 "//third_party/googletest:gtest_main", 471 ] 472 473 external_deps = [ 474 "c_utils:utils", 475 "hiviewdfx_hilog_native:libhilog", 476 ] 477} 478 479ohos_unittest("common_event_access_token_helper_test") { 480 module_out_path = module_output_path 481 482 sources = [ 483 "${common_event_service_path}/test/mock/mock_accesstoken_kit.cpp", 484 "common_event_access_token_helper_test.cpp", 485 ] 486 487 configs = [ ":cesfwk_services_config" ] 488 489 deps = [ 490 "${services_path}:cesfwk_services", 491 "//third_party/googletest:gtest_main", 492 ] 493 494 external_deps = [ 495 "access_token:libaccesstoken_sdk", 496 "c_utils:utils", 497 ] 498} 499 500ohos_unittest("common_event_manager_service_test") { 501 module_out_path = module_output_path 502 503 sources = [ 504 "${common_event_service_path}/test/mock/mock_access_token_helper.cpp", 505 "${common_event_service_path}/test/mock/mock_bundle_manager.cpp", 506 "common_event_manager_service_test.cpp", 507 ] 508 509 configs = [ ":cesfwk_services_config" ] 510 511 deps = [ 512 "${ces_common_path}:libevent_common", 513 "${ces_core_path}:cesfwk_core", 514 "${ces_native_path}:cesfwk_innerkits", 515 "${services_path}:cesfwk_services", 516 "//third_party/googletest:gtest_main", 517 ] 518 519 external_deps = [ 520 "ability_base:want", 521 "access_token:libaccesstoken_sdk", 522 "bundle_framework:appexecfwk_base", 523 "bundle_framework:appexecfwk_core", 524 "c_utils:utils", 525 "eventhandler:libeventhandler", 526 "hiviewdfx_hilog_native:libhilog", 527 "ipc:ipc_core", 528 ] 529} 530 531group("unittest") { 532 testonly = true 533 deps = [] 534 535 deps += [ 536 ":ability_manager_death_recipient_unit_test", 537 ":bundle_manager_death_recipient_unit_test", 538 ":common_event_access_token_helper_test", 539 ":common_event_dump_test", 540 ":common_event_freeze_test", 541 ":common_event_freeze_unit_test", 542 ":common_event_hisysevent_test", 543 ":common_event_manager_service_test", 544 ":common_event_publish_manager_event_unit_test", 545 ":common_event_publish_ordered_event_unit_test", 546 ":common_event_publish_permission_event_unit_test", 547 ":common_event_publish_system_event_test", 548 ":common_event_sticky_test", 549 ":common_event_subscribe_unit_test", 550 ":common_event_unsubscribe_unit_test", 551 ":static_subscriber_connection_unit_test", 552 ":static_subscriber_manager_unit_test", 553 ] 554} 555