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. 13import("//build/test.gni") 14import("//foundation/filemanagement/dfs_service/distributedfile.gni") 15 16ohos_unittest("cloud_sync_callback_client_test") { 17 module_out_path = "filemanagement/dfs_service" 18 19 sources = [ "cloud_sync_callback_client_test.cpp" ] 20 21 include_dirs = [ 22 "${services_path}/cloudsyncservice/include/ipc", 23 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 24 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 25 "${distributedfile_path}/utils/log/include", 26 ] 27 28 deps = [ 29 "//third_party/googletest:gmock_main", 30 "//third_party/googletest:gtest_main", 31 ] 32 33 external_deps = [ 34 "c_utils:utils", 35 "dfs_service:cloudsync_kit_inner", 36 "hilog:libhilog", 37 "ipc:ipc_single", 38 ] 39 40 defines = [ "private=public" ] 41 42 use_exceptions = true 43} 44 45ohos_unittest("cloud_sync_callback_stub_test") { 46 module_out_path = "filemanagement/dfs_service" 47 48 sources = [ "cloud_sync_callback_stub_test.cpp" ] 49 50 include_dirs = [ 51 "${services_path}/cloudsyncservice/include/ipc", 52 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 53 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 54 "${distributedfile_path}/utils/log/include", 55 ] 56 57 deps = [ 58 "//third_party/googletest:gmock_main", 59 "//third_party/googletest:gtest_main", 60 ] 61 62 external_deps = [ 63 "c_utils:utils", 64 "dfs_service:cloudsync_kit_inner", 65 "hilog:libhilog", 66 "ipc:ipc_single", 67 ] 68 69 defines = [ "private=public" ] 70 71 use_exceptions = true 72} 73 74ohos_unittest("cloud_sync_manager_impl_test") { 75 branch_protector_ret = "pac_ret" 76 sanitize = { 77 integer_overflow = true 78 cfi = true 79 cfi_cross_dso = true 80 debug = false 81 blocklist = "${distributedfile_path}/cfi_blocklist.txt" 82 } 83 84 module_out_path = "filemanagement/dfs_service" 85 86 sources = [ 87 "${distributedfile_path}/test/mock/ipc/cloud_sync_service_proxy_mock.cpp", 88 "cloud_sync_manager_impl_test.cpp", 89 ] 90 91 include_dirs = [ 92 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 93 "${services_path}/cloudsyncservice/include/ipc", 94 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 95 "${distributedfile_path}/test/mock/ipc", 96 "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner", 97 "${distributedfile_path}/utils/log/include", 98 ] 99 100 deps = [ 101 "${services_path}/cloudsyncservice:cloudsync_sa_static", 102 "//third_party/googletest:gmock_main", 103 "//third_party/googletest:gtest_main", 104 ] 105 106 external_deps = [ 107 "c_utils:utils", 108 "dfs_service:cloudsync_kit_inner", 109 "hilog:libhilog", 110 "ipc:ipc_single", 111 ] 112 113 defines = [ "private=public" ] 114 115 use_exceptions = true 116} 117 118ohos_unittest("cloud_sync_manager_impl_unnomal_test") { 119 module_out_path = "filemanagement/dfs_service" 120 121 sources = [ 122 "${distributedfile_path}/test/mock/ipc/cloud_sync_service_proxy_unnomal_mock.cpp", 123 "cloud_sync_manager_impl_unnomal_test.cpp", 124 ] 125 126 include_dirs = [ 127 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 128 "${services_path}/cloudsyncservice/include/ipc", 129 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 130 "${distributedfile_path}/test/mock/ipc", 131 "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner", 132 "${distributedfile_path}/utils/log/include", 133 ] 134 135 deps = [ 136 "${services_path}/cloudsyncservice:cloudsync_sa_static", 137 "//third_party/googletest:gmock_main", 138 "//third_party/googletest:gtest_main", 139 ] 140 141 external_deps = [ 142 "c_utils:utils", 143 "dfs_service:cloudsync_kit_inner", 144 "hilog:libhilog", 145 "ipc:ipc_single", 146 ] 147 148 defines = [ "private=public" ] 149 150 use_exceptions = true 151} 152 153ohos_unittest("cloud_sync_manager_test") { 154 module_out_path = "filemanagement/dfs_service" 155 156 sources = [ "cloud_sync_manager_test.cpp" ] 157 158 include_dirs = [ 159 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 160 "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner", 161 ] 162 163 deps = [ 164 "${utils_path}:libdistributedfileutils", 165 "//third_party/googletest:gmock_main", 166 "//third_party/googletest:gtest_main", 167 ] 168 169 external_deps = [ 170 "c_utils:utils", 171 "dfs_service:cloudsync_kit_inner", 172 "hilog:libhilog", 173 "ipc:ipc_single", 174 ] 175 176 defines = [ "private=public" ] 177 178 use_exceptions = true 179} 180 181ohos_unittest("cloud_sync_service_proxy_test") { 182 module_out_path = "filemanagement/dfs_service" 183 184 sources = [ "cloud_sync_service_proxy_test.cpp" ] 185 186 include_dirs = [ 187 "${services_path}/cloudsyncservice/include/ipc", 188 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 189 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 190 "${distributedfile_path}/utils/log/include", 191 ] 192 193 deps = [ 194 "//third_party/googletest:gmock_main", 195 "//third_party/googletest:gtest_main", 196 ] 197 198 external_deps = [ 199 "c_utils:utils", 200 "dfs_service:cloudsync_kit_inner", 201 "hilog:libhilog", 202 "ipc:ipc_single", 203 ] 204 205 defines = [ "private=public" ] 206 207 use_exceptions = true 208} 209 210ohos_unittest("cloud_download_callback_client_test") { 211 module_out_path = "filemanagement/dfs_service" 212 213 sources = [ "cloud_download_callback_client_test.cpp" ] 214 215 include_dirs = [ 216 "${services_path}/cloudsyncservice/include/ipc", 217 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 218 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 219 "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner", 220 "${distributedfile_path}/utils/log/include", 221 ] 222 223 deps = [ 224 "//third_party/googletest:gmock_main", 225 "//third_party/googletest:gtest_main", 226 ] 227 228 external_deps = [ 229 "c_utils:utils", 230 "dfs_service:cloudsync_kit_inner", 231 "hilog:libhilog", 232 "ipc:ipc_single", 233 ] 234 235 defines = [ 236 "private=public", 237 "LOG_DOMAIN=0xD004307", 238 "LOG_TAG=\"CLOUDSYNC_TEST\"", 239 ] 240 241 use_exceptions = true 242} 243 244ohos_unittest("cloud_download_callback_stub_test") { 245 module_out_path = "filemanagement/dfs_service" 246 247 sources = [ 248 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_download_callback_stub.cpp", 249 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_optimize_callback_stub.cpp", 250 "../../../mock/cloud_download_uri_manager_hook.cpp", 251 "cloud_download_callback_stub_test.cpp", 252 ] 253 254 include_dirs = [ 255 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 256 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 257 "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner", 258 "${distributedfile_path}/utils/log/include", 259 ] 260 261 deps = [ 262 "//third_party/googletest:gmock_main", 263 "//third_party/googletest:gtest_main", 264 ] 265 266 external_deps = [ 267 "c_utils:utils", 268 "dfs_service:cloudsync_kit_inner", 269 "hilog:libhilog", 270 "ipc:ipc_single", 271 ] 272 273 defines = [ 274 "private=public", 275 "protected=public", 276 "LOG_DOMAIN=0xD004307", 277 "LOG_TAG=\"CLOUDSYNC_TEST\"", 278 ] 279 280 use_exceptions = true 281} 282 283ohos_unittest("cloud_download_uri_manager_test") { 284 module_out_path = "filemanagement/dfs_service" 285 286 sources = [ 287 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_download_uri_manager.cpp", 288 "cloud_download_uri_manager_test.cpp", 289 ] 290 291 include_dirs = [ 292 "${services_path}/cloudsyncservice/include/ipc", 293 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 294 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 295 ] 296 297 deps = [ 298 "${utils_path}:libdistributedfileutils", 299 "//third_party/googletest:gmock_main", 300 "//third_party/googletest:gtest_main", 301 ] 302 303 external_deps = [ 304 "c_utils:utils", 305 "dfs_service:cloudsync_kit_inner", 306 "hilog:libhilog", 307 "ipc:ipc_single", 308 ] 309 310 defines = [ "private=public" ] 311 312 use_exceptions = true 313} 314 315ohos_unittest("cloud_sync_common_test") { 316 module_out_path = "filemanagement/dfs_service" 317 318 sources = [ 319 "cloud_sync_common_test.cpp", 320 "file_hook/parcel.cpp", 321 ] 322 323 include_dirs = [ 324 "${services_path}/cloudsyncservice/include/ipc", 325 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 326 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 327 ] 328 329 deps = [ 330 "${utils_path}:libdistributedfileutils", 331 "//third_party/googletest:gmock_main", 332 "//third_party/googletest:gtest_main", 333 ] 334 335 external_deps = [ 336 "c_utils:utils", 337 "dfs_service:cloudsync_kit_inner", 338 "ipc:ipc_single", 339 ] 340 341 defines = [ "private=public" ] 342 343 use_exceptions = true 344} 345 346ohos_unittest("cloud_sync_asset_manager_impl_test") { 347 module_out_path = "filemanagement/dfs_service" 348 349 sources = [ 350 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_asset_manager_impl.cpp", 351 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_client.cpp", 352 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_stub.cpp", 353 "cloud_sync_asset_manager_impl_test.cpp", 354 ] 355 356 include_dirs = [ 357 "${services_path}/cloudsyncservice/include/ipc", 358 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 359 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 360 "${distributedfile_path}/utils/log/include", 361 ] 362 363 deps = [ 364 "//third_party/googletest:gmock_main", 365 "//third_party/googletest:gtest_main", 366 ] 367 368 external_deps = [ 369 "c_utils:utils", 370 "dfs_service:cloudsync_kit_inner", 371 "hilog:libhilog", 372 "ipc:ipc_single", 373 ] 374 375 defines = [ "private=public" ] 376 377 use_exceptions = true 378} 379 380ohos_unittest("cloud_sync_asset_manager_impl_unnomal_test") { 381 module_out_path = "filemanagement/dfs_service" 382 383 sources = [ 384 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_asset_manager_impl.cpp", 385 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_client.cpp", 386 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_stub.cpp", 387 "${distributedfile_path}/test/mock/ipc/cloud_sync_service_proxy_unnomal_mock.cpp", 388 "cloud_sync_asset_manager_impl_unnomal_test.cpp", 389 ] 390 391 include_dirs = [ 392 "${services_path}/cloudsyncservice/include/ipc", 393 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 394 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 395 ] 396 397 deps = [ 398 "${utils_path}:libdistributedfileutils", 399 "//third_party/googletest:gmock_main", 400 "//third_party/googletest:gtest_main", 401 ] 402 403 external_deps = [ 404 "c_utils:utils", 405 "dfs_service:cloudsync_asset_kit_inner", 406 "hilog:libhilog", 407 "ipc:ipc_single", 408 ] 409 410 defines = [ "private=public" ] 411 412 use_exceptions = true 413} 414 415ohos_unittest("cloud_sync_asset_manager_test") { 416 module_out_path = "filemanagement/dfs_service" 417 418 sources = [ "cloud_sync_asset_manager_test.cpp" ] 419 420 include_dirs = [ 421 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 422 "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner", 423 ] 424 425 deps = [ 426 "${utils_path}:libdistributedfileutils", 427 "//third_party/googletest:gmock_main", 428 "//third_party/googletest:gtest_main", 429 ] 430 431 external_deps = [ 432 "c_utils:utils", 433 "dfs_service:cloudsync_asset_kit_inner", 434 "hilog:libhilog", 435 "ipc:ipc_single", 436 ] 437 438 defines = [ "private=public" ] 439 440 use_exceptions = true 441} 442 443ohos_unittest("download_asset_callback_client_test") { 444 module_out_path = "filemanagement/dfs_service" 445 446 sources = [ 447 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_client.cpp", 448 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_stub.cpp", 449 "download_asset_callback_client_test.cpp", 450 ] 451 452 include_dirs = [ 453 "${services_path}/cloudsyncservice/include/ipc", 454 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 455 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 456 "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner", 457 ] 458 459 deps = [ 460 "${utils_path}:libdistributedfileutils", 461 "//third_party/googletest:gmock_main", 462 "//third_party/googletest:gtest_main", 463 ] 464 465 external_deps = [ 466 "c_utils:utils", 467 "dfs_service:cloudsync_kit_inner", 468 "hilog:libhilog", 469 "ipc:ipc_single", 470 ] 471 472 defines = [ 473 "private=public", 474 "LOG_DOMAIN=0xD004307", 475 "LOG_TAG=\"CLOUDSYNC_TEST\"", 476 ] 477 478 use_exceptions = true 479} 480 481ohos_unittest("download_asset_callback_stub_test") { 482 module_out_path = "filemanagement/dfs_service" 483 484 sources = [ 485 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_stub.cpp", 486 "../../../mock/cloud_download_uri_manager_hook.cpp", 487 "download_asset_callback_stub_test.cpp", 488 ] 489 490 include_dirs = [ 491 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 492 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 493 "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner", 494 ] 495 496 deps = [ 497 "${utils_path}:libdistributedfileutils", 498 "//third_party/googletest:gmock_main", 499 "//third_party/googletest:gtest_main", 500 ] 501 502 external_deps = [ 503 "c_utils:utils", 504 "dfs_service:cloudsync_kit_inner", 505 "hilog:libhilog", 506 "ipc:ipc_single", 507 ] 508 509 defines = [ 510 "private=public", 511 "protected=public", 512 "LOG_DOMAIN=0xD004307", 513 "LOG_TAG=\"CLOUDSYNC_TEST\"", 514 ] 515 516 use_exceptions = true 517} 518 519ohos_unittest("cloud_sync_service_proxy_lite_test") { 520 module_out_path = "filemanagement/dfs_service" 521 522 sources = [ 523 "${distributedfile_path}/test/mock/system_ability_manager_client_mock.cpp", 524 "cloud_sync_service_proxy_lite_test.cpp", 525 ] 526 527 include_dirs = [ 528 "${services_path}/cloudsyncservice/include/ipc", 529 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 530 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner_lite/include", 531 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include", 532 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner_lite/src", 533 "${distributedfile_path}/utils/log/include", 534 "${distributedfile_path}/test/mock", 535 ] 536 537 deps = [ 538 "${innerkits_native_path}/cloudsync_kit_inner:cloudsync_kit_inner_lite", 539 "//third_party/googletest:gmock_main", 540 "//third_party/googletest:gtest_main", 541 ] 542 543 external_deps = [ 544 "c_utils:utils", 545 "dfs_service:cloudsync_kit_inner", 546 "hilog:libhilog", 547 "ipc:ipc_single", 548 "samgr:samgr_proxy", 549 ] 550 551 defines = [ "private=public" ] 552 553 use_exceptions = true 554} 555 556group("cloudsync_impl_test") { 557 testonly = true 558 559 deps = [ 560 ":cloud_download_callback_client_test", 561 ":cloud_download_callback_stub_test", 562 ":cloud_download_uri_manager_test", 563 ":cloud_sync_asset_manager_impl_test", 564 ":cloud_sync_asset_manager_impl_unnomal_test", 565 ":cloud_sync_asset_manager_test", 566 ":cloud_sync_callback_client_test", 567 ":cloud_sync_callback_stub_test", 568 ":cloud_sync_common_test", 569 ":cloud_sync_manager_impl_test", 570 ":cloud_sync_manager_impl_unnomal_test", 571 ":cloud_sync_manager_test", 572 ":cloud_sync_service_proxy_lite_test", 573 ":cloud_sync_service_proxy_test", 574 ":download_asset_callback_client_test", 575 ":download_asset_callback_stub_test", 576 ] 577} 578