1# Copyright (C) 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/filemanagement/dfs_service/distributedfile.gni") 16 17ohos_unittest("account_status_listener_test") { 18 module_out_path = "filemanagement/dfs_service" 19 20 include_dirs = [ 21 "${distributedfile_path}/utils/log/include", 22 "${services_path}/cloudfiledaemon/include/cloud_disk/", 23 "${services_path}/cloudfiledaemon/include/fuse_manager/", 24 ] 25 26 sources = [ 27 "${services_path}/cloudfiledaemon/src/cloud_disk/account_status.cpp", 28 "${services_path}/cloudfiledaemon/src/cloud_disk/account_status_listener.cpp", 29 "${services_path}/cloudfiledaemon/src/fuse_manager/cloud_daemon_statistic.cpp", 30 "account_status_listener_test.cpp", 31 ] 32 33 deps = [ 34 "${clouddisk_database_path}:clouddisk_database", 35 "${utils_path}:libdistributedfiledentry", 36 "${utils_path}:libdistributedfileutils", 37 "${utils_path}:libdistributedfileutils_lite", 38 "//third_party/googletest:gmock_main", 39 "//third_party/googletest:gtest_main", 40 ] 41 42 external_deps = [ 43 "ability_base:want", 44 "c_utils:utils", 45 "common_event_service:cesfwk_innerkits", 46 "hilog:libhilog", 47 ] 48 49 defines = [ 50 "private=public", 51 "LOG_DOMAIN=0xD004308", 52 "LOG_TAG=\"CLOUD_DAEMON_API\"", 53 ] 54 55 use_exceptions = true 56} 57 58ohos_unittest("file_operations_cloud_test") { 59 module_out_path = "filemanagement/dfs_service" 60 61 include_dirs = [ 62 "${distributedfile_path}/adapter/cloud_adapter_example/include", 63 "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner", 64 "${distributedfile_path}/utils/log/include", 65 "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/include", 66 "${media_library_path}/frameworks/utils/include", 67 "${media_library_path}/interfaces/inner_api/media_library_helper/include", 68 "${services_path}/clouddisk_database/include", 69 "${services_path}/cloudfiledaemon/include/cloud_disk/", 70 "mock", 71 ] 72 73 sources = [ 74 "${distributedfile_path}/test/mock/clouddisk_notify_mock.cpp", 75 "${distributedfile_path}/test/unittests/cloud_disk/mock/file_operations_helper_mock.cpp", 76 "${distributedfile_path}/test/unittests/clouddisk_database/mock/meta_file_clouddisk_mock.cpp", 77 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/cloud_file_utils_mock.cpp", 78 "${services_path}/cloudfiledaemon/src/cloud_disk/account_status.cpp", 79 "${services_path}/cloudfiledaemon/src/cloud_disk/database_manager.cpp", 80 "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_base.cpp", 81 "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp", 82 "file_operations_cloud_test.cpp", 83 "mock/clouddisk_rdbstore_mock.cpp", 84 "mock/libfuse_mock.cpp", 85 "mock/system_function_mock.cpp", 86 ] 87 88 deps = [ 89 "${clouddisk_database_path}:clouddisk_database", 90 "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit", 91 "${utils_path}:libdistributedfiledentry", 92 "${utils_path}:libdistributedfileutils", 93 "${utils_path}:libdistributedfileutils_lite", 94 "//third_party/googletest:gmock_main", 95 "//third_party/googletest:gtest_main", 96 ] 97 98 external_deps = [ 99 "ability_base:want", 100 "ability_runtime:dataobs_manager", 101 "c_utils:utils", 102 "common_event_service:cesfwk_innerkits", 103 "ffrt:libffrt", 104 "hilog:libhilog", 105 "hitrace:hitrace_meter", 106 "init:libbegetutil", 107 "libfuse:libfuse", 108 "relational_store:native_rdb", 109 ] 110 111 defines = [ 112 "private=public", 113 "LOG_DOMAIN=0xD004308", 114 "LOG_TAG=\"CLOUD_DAEMON_API\"", 115 ] 116 117 if (cloudsync_service_hicollie_enable) { 118 external_deps += [ "hicollie:libhicollie" ] 119 defines += [ "HICOLLIE_ENABLE" ] 120 } 121 122 use_exceptions = true 123} 124 125ohos_unittest("database_manager_test") { 126 module_out_path = "filemanagement/dfs_service" 127 128 include_dirs = [ 129 "${distributedfile_path}/utils/log/include", 130 "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner/", 131 "${distributedfile_path}/interfaces/inner_api/native/cloud_file_kit_inner/", 132 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include/", 133 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner_lite/include/", 134 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/", 135 "${services_path}/cloudfiledaemon/include/cloud_disk/", 136 "${services_path}/clouddisk_database/include/", 137 "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/include/", 138 "${media_library_path}/interfaces/inner_api/media_library_helper/include/", 139 "${media_library_path}/frameworks/utils/include/", 140 ] 141 142 sources = [ 143 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_manager.cpp", 144 "${services_path}/clouddisk_database/src/clouddisk_rdb_transaction.cpp", 145 "${services_path}/clouddisk_database/src/clouddisk_rdb_utils.cpp", 146 "${services_path}/clouddisk_database/src/clouddisk_rdbstore.cpp", 147 "${services_path}/clouddisk_database/src/clouddisk_sync_helper.cpp", 148 "${services_path}/clouddisk_database/src/file_column.cpp", 149 "${services_path}/cloudfiledaemon/src/cloud_disk/database_manager.cpp", 150 "database_manager_test.cpp", 151 ] 152 153 deps = [ 154 "${distributedfile_path}/adapter/cloud_adapter_example:cloud_adapter", 155 "${innerkits_native_path}/cloudsync_kit_inner:cloudsync_kit_inner_lite", 156 "${utils_path}:libdistributedfiledentry", 157 "${utils_path}:libdistributedfileutils", 158 "${utils_path}:libdistributedfileutils_lite", 159 "//third_party/googletest:gmock_main", 160 "//third_party/googletest:gtest_main", 161 ] 162 163 external_deps = [ 164 "ability_base:want", 165 "ability_base:zuri", 166 "ability_runtime:dataobs_manager", 167 "c_utils:utils", 168 "common_event_service:cesfwk_innerkits", 169 "dfs_service:cloudsync_kit_inner", 170 "ffrt:libffrt", 171 "hilog:libhilog", 172 "ipc:ipc_single", 173 "libfuse:libfuse", 174 "relational_store:native_rdb", 175 ] 176 177 defines = [ 178 "private=public", 179 "LOG_DOMAIN=0xD004308", 180 "LOG_TAG=\"CLOUD_DAEMON_API\"", 181 ] 182 183 use_exceptions = true 184} 185 186ohos_unittest("file_operations_base_test") { 187 module_out_path = "filemanagement/dfs_service" 188 189 include_dirs = [ 190 "${distributedfile_path}/utils/log/include", 191 "${services_path}/cloudfiledaemon/include/cloud_disk/", 192 "${distributedfile_path}/test/unittests/cloud_disk/mock/", 193 "//third_party/libfuse/include", 194 "//third_party/libfuse/lib", 195 "${distributedfile_path}/services/clouddisk_database/include/", 196 ] 197 198 sources = [ 199 "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_base.cpp", 200 "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_helper.cpp", 201 "file_operations_base_test.cpp", 202 "mock/clouddisk_rdbstore_mock.cpp", 203 "mock/libfuse_mock.cpp", 204 "mock/system_function_mock.cpp", 205 ] 206 207 deps = [ 208 "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit", 209 "${utils_path}:libdistributedfiledentry", 210 "${utils_path}:libdistributedfileutils", 211 "${utils_path}:libdistributedfileutils_lite", 212 "//third_party/googletest:gmock_main", 213 "//third_party/googletest:gtest_main", 214 ] 215 216 external_deps = [ 217 "ability_base:want", 218 "common_event_service:cesfwk_innerkits", 219 "hilog:libhilog", 220 "libfuse:libfuse", 221 "relational_store:native_rdb", 222 ] 223 224 defines = [ 225 "private=public", 226 "LOG_DOMAIN=0xD004308", 227 "LOG_TAG=\"CLOUD_DAEMON_API\"", 228 ] 229 230 use_exceptions = true 231} 232 233ohos_unittest("fuse_operations_test") { 234 module_out_path = "filemanagement/dfs_service" 235 236 include_dirs = [ 237 "${distributedfile_path}/utils/log/include", 238 "${services_path}/cloudfiledaemon/include/cloud_disk/", 239 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/", 240 "${distributedfile_path}/test/unittests/cloud_disk/mock/", 241 ] 242 243 sources = [ 244 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/parameters.cpp", 245 "${services_path}/cloudfiledaemon/src/cloud_disk/account_status.cpp", 246 "${services_path}/cloudfiledaemon/src/cloud_disk/database_manager.cpp", 247 "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_base.cpp", 248 "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp", 249 "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_helper.cpp", 250 "${services_path}/cloudfiledaemon/src/cloud_disk/fuse_operations.cpp", 251 "fuse_operations_test.cpp", 252 "mock/clouddisk_rdbstore_mock.cpp", 253 "mock/file_operations_local_mock.cpp", 254 "mock/libfuse_mock.cpp", 255 "mock/system_function_mock.cpp", 256 ] 257 258 deps = [ 259 "${clouddisk_database_path}:clouddisk_database", 260 "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit", 261 "${utils_path}:libdistributedfileutils", 262 "${utils_path}:libdistributedfileutils_lite", 263 "//third_party/googletest:gmock_main", 264 "//third_party/googletest:gtest_main", 265 ] 266 267 cflags = [ "--coverage" ] 268 269 ldflags = [ "--coverage" ] 270 271 cflags_cc = [ "--coverage" ] 272 273 external_deps = [ 274 "ability_runtime:dataobs_manager", 275 "c_utils:utils", 276 "common_event_service:cesfwk_innerkits", 277 "ffrt:libffrt", 278 "hilog:libhilog", 279 "hitrace:hitrace_meter", 280 "libfuse:libfuse", 281 "relational_store:native_rdb", 282 ] 283 284 defines = [ 285 "private=public", 286 "LOG_DOMAIN=0xD004308", 287 "LOG_TAG=\"CLOUD_DAEMON_API\"", 288 ] 289 290 if (cloudsync_service_hicollie_enable) { 291 external_deps += [ "hicollie:libhicollie" ] 292 defines += [ "HICOLLIE_ENABLE" ] 293 } 294 295 use_exceptions = true 296} 297 298group("cloud_disk_test") { 299 testonly = true 300 301 deps = [ 302 ":account_status_listener_test", 303 ":file_operations_base_test", 304 ":file_operations_cloud_test", 305 ":fuse_operations_test", 306 ] 307} 308