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