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. 13 14import("//build/test.gni") 15import("//foundation/filemanagement/dfs_service/distributedfile.gni") 16 17ohos_unittest("distributed_file_daemon_test") { 18 module_out_path = "filemanagement/dfs_service" 19 20 sources = [ 21 "${services_path}/distributedfiledaemon/src/device/device_info.cpp", 22 "${services_path}/distributedfiledaemon/src/device/device_manager_agent.cpp", 23 "${services_path}/distributedfiledaemon/src/ipc/connection_detector.cpp", 24 "${services_path}/distributedfiledaemon/src/ipc/daemon.cpp", 25 "${services_path}/distributedfiledaemon/src/ipc/daemon_stub.cpp", 26 "${services_path}/distributedfiledaemon/src/ipc/file_trans_listener_proxy.cpp", 27 "${services_path}/distributedfiledaemon/src/ipc/trans_mananger.cpp", 28 "${services_path}/distributedfiledaemon/src/mountpoint/mount_manager.cpp", 29 "${services_path}/distributedfiledaemon/src/mountpoint/mount_point.cpp", 30 "${services_path}/distributedfiledaemon/src/multiuser/os_account_observer.cpp", 31 "${services_path}/distributedfiledaemon/src/network/devsl_dispatcher.cpp", 32 "${services_path}/distributedfiledaemon/src/network/kernel_talker.cpp", 33 "${services_path}/distributedfiledaemon/src/network/network_agent_template.cpp", 34 "${services_path}/distributedfiledaemon/src/network/session_pool.cpp", 35 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_agent.cpp", 36 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_file_receive_listener.cpp", 37 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_file_send_listener.cpp", 38 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_handler.cpp", 39 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_session.cpp", 40 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_session_dispatcher.cpp", 41 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_session_listener.cpp", 42 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_session_pool.cpp", 43 "daemon_test.cpp", 44 ] 45 46 include_dirs = [ 47 "${distributedfile_path}/frameworks/native/distributed_file_inner/include", 48 "${distributedfile_path}/test/unittests/distributed_file_daemon/include", 49 "${services_path}/distributedfiledaemon/include", 50 "${services_path}/distributedfiledaemon/include/ipc", 51 "//third_party/libfuse/include", 52 "//third_party/libfuse/lib", 53 ] 54 55 deps = [ 56 "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", 57 "${services_path}/distributedfiledaemon:libdistributedfiledaemon", 58 "${utils_path}:libdistributedfileutils", 59 "//third_party/googletest:gmock_main", 60 "//third_party/googletest:gtest_main", 61 "//third_party/libfuse:libfuse", 62 ] 63 64 external_deps = [ 65 "ability_base:want", 66 "ability_base:zuri", 67 "access_token:libaccesstoken_sdk", 68 "app_file_service:sandbox_helper_native", 69 "common_event_service:cesfwk_innerkits", 70 "dataclassification:data_transit_mgr", 71 "device_auth:deviceauth_sdk", 72 "device_manager:devicemanagersdk", 73 "dsoftbus:softbus_client", 74 "hilog:libhilog", 75 "init:libbegetutil", 76 "ipc:ipc_core", 77 "os_account:os_account_innerkits", 78 "safwk:system_ability_fwk", 79 "samgr:samgr_proxy", 80 ] 81 82 defines = [ 83 "private=public", 84 "LOG_TAG=\"distributedfile_daemon\"", 85 ] 86 87 use_exceptions = true 88 part_name = "dfs_service" 89 subsystem_name = "filemanagement" 90} 91 92ohos_unittest("distributed_file_daemon_stub_test") { 93 module_out_path = "filemanagement/dfs_service" 94 95 sources = [ 96 "${services_path}/distributedfiledaemon/src/device/device_info.cpp", 97 "${services_path}/distributedfiledaemon/src/device/device_manager_agent.cpp", 98 "${services_path}/distributedfiledaemon/src/ipc/connection_detector.cpp", 99 "${services_path}/distributedfiledaemon/src/ipc/daemon.cpp", 100 "${services_path}/distributedfiledaemon/src/ipc/daemon_stub.cpp", 101 "${services_path}/distributedfiledaemon/src/ipc/file_trans_listener_proxy.cpp", 102 "${services_path}/distributedfiledaemon/src/ipc/trans_mananger.cpp", 103 "${services_path}/distributedfiledaemon/src/mountpoint/mount_manager.cpp", 104 "${services_path}/distributedfiledaemon/src/mountpoint/mount_point.cpp", 105 "${services_path}/distributedfiledaemon/src/multiuser/os_account_observer.cpp", 106 "${services_path}/distributedfiledaemon/src/network/devsl_dispatcher.cpp", 107 "${services_path}/distributedfiledaemon/src/network/kernel_talker.cpp", 108 "${services_path}/distributedfiledaemon/src/network/network_agent_template.cpp", 109 "${services_path}/distributedfiledaemon/src/network/session_pool.cpp", 110 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_agent.cpp", 111 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_file_receive_listener.cpp", 112 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_file_send_listener.cpp", 113 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_handler.cpp", 114 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_session.cpp", 115 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_session_dispatcher.cpp", 116 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_session_listener.cpp", 117 "${services_path}/distributedfiledaemon/src/network/softbus/softbus_session_pool.cpp", 118 "daemon_stub_test.cpp", 119 ] 120 121 include_dirs = [ 122 "${distributedfile_path}/frameworks/native/distributed_file_inner/include", 123 "${distributedfile_path}/test/unittests/distributed_file_daemon/include", 124 "${services_path}/distributedfiledaemon/include", 125 "${services_path}/distributedfiledaemon/include/ipc", 126 "//third_party/libfuse/include", 127 "//third_party/libfuse/lib", 128 ] 129 130 deps = [ 131 "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", 132 "${services_path}/distributedfiledaemon:libdistributedfiledaemon", 133 "${utils_path}:libdistributedfileutils", 134 "//third_party/googletest:gmock_main", 135 "//third_party/googletest:gtest_main", 136 "//third_party/libfuse:libfuse", 137 ] 138 139 external_deps = [ 140 "ability_base:want", 141 "ability_base:zuri", 142 "access_token:libaccesstoken_sdk", 143 "app_file_service:sandbox_helper_native", 144 "common_event_service:cesfwk_innerkits", 145 "dataclassification:data_transit_mgr", 146 "device_auth:deviceauth_sdk", 147 "device_manager:devicemanagersdk", 148 "dsoftbus:softbus_client", 149 "hilog:libhilog", 150 "init:libbegetutil", 151 "ipc:ipc_core", 152 "os_account:os_account_innerkits", 153 "safwk:system_ability_fwk", 154 "samgr:samgr_proxy", 155 ] 156 157 defines = [ 158 "private=public", 159 "LOG_TAG=\"distributedfile_daemon\"", 160 ] 161 162 use_exceptions = true 163 part_name = "dfs_service" 164 subsystem_name = "filemanagement" 165} 166 167ohos_unittest("daemon_manager_impl_test") { 168 module_out_path = "filemanagement/dfs_service" 169 170 sources = [ 171 "${distributedfile_path}/utils/log/src/utils_log.cpp", 172 "daemon_manager_impl_test.cpp", 173 ] 174 175 include_dirs = [ 176 "${distributedfile_path}/frameworks/native/distributed_file_inner/include", 177 "${distributedfile_path}/test/unittests/distributed_file_daemon/include", 178 "${services_path}/distributedfiledaemon/include", 179 "//third_party/libfuse/include", 180 "//third_party/libfuse/lib", 181 ] 182 183 deps = [ 184 "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", 185 "${utils_path}:libdistributedfileutils", 186 "//third_party/googletest:gmock_main", 187 "//third_party/googletest:gtest_main", 188 ] 189 190 external_deps = [ 191 "device_manager:devicemanagersdk", 192 "hilog:libhilog", 193 "ipc:ipc_single", 194 ] 195 196 defines = [ 197 "private=public", 198 "LOG_TAG=\"distributedfile_daemon\"", 199 ] 200 201 use_exceptions = true 202 part_name = "dfs_service" 203 subsystem_name = "filemanagement" 204} 205 206ohos_unittest("daemon_manager_test") { 207 module_out_path = "filemanagement/dfs_service" 208 209 sources = [ 210 "${distributedfile_path}/utils/log/src/utils_log.cpp", 211 "daemon_manager_test.cpp", 212 ] 213 214 include_dirs = [ 215 "${distributedfile_path}/frameworks/native/distributed_file_inner/include", 216 "${distributedfile_path}/test/unittests/distributed_file_daemon/include", 217 "${services_path}/distributedfiledaemon/include", 218 ] 219 220 deps = [ 221 "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", 222 "${utils_path}:libdistributedfileutils", 223 "//third_party/googletest:gmock_main", 224 "//third_party/googletest:gtest_main", 225 ] 226 227 external_deps = [ 228 "device_manager:devicemanagersdk", 229 "hilog:libhilog", 230 "ipc:ipc_core", 231 ] 232 233 defines = [ 234 "private=public", 235 "LOG_TAG=\"distributedfile_daemon\"", 236 ] 237 238 use_exceptions = true 239 part_name = "dfs_service" 240 subsystem_name = "filemanagement" 241} 242 243ohos_unittest("daemon_service_proxy_test") { 244 module_out_path = "filemanagement/dfs_service" 245 246 sources = [ 247 "${distributedfile_path}/utils/log/src/utils_log.cpp", 248 "daemon_service_proxy_test.cpp", 249 ] 250 251 include_dirs = [ 252 "${distributedfile_path}/frameworks/native/distributed_file_inner/include", 253 "${distributedfile_path}/test/unittests/distributed_file_daemon/include", 254 "${services_path}/distributedfiledaemon/include", 255 ] 256 257 deps = [ 258 "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", 259 "${utils_path}:libdistributedfileutils", 260 "//third_party/googletest:gmock_main", 261 "//third_party/googletest:gtest_main", 262 ] 263 264 external_deps = [ 265 "ability_base:zuri", 266 "device_manager:devicemanagersdk", 267 "hilog:libhilog", 268 "ipc:ipc_core", 269 ] 270 271 defines = [ 272 "private=public", 273 "LOG_TAG=\"distributedfile_daemon\"", 274 ] 275 276 use_exceptions = true 277 part_name = "dfs_service" 278 subsystem_name = "filemanagement" 279} 280 281ohos_unittest("connection_detector_test") { 282 module_out_path = "filemanagement/dfs_service" 283 284 sources = [ 285 "${distributedfile_path}/utils/log/src/utils_log.cpp", 286 "${services_path}/distributedfiledaemon/src/ipc/connection_detector.cpp", 287 "connection_detector_test.cpp", 288 ] 289 290 include_dirs = [ 291 "${services_path}/distributedfiledaemon/include/ipc", 292 "${services_path}/distributedfiledaemon/src/ipc", 293 ] 294 295 deps = [ 296 "${utils_path}:libdistributedfileutils", 297 "//third_party/googletest:gmock_main", 298 "//third_party/googletest:gtest_main", 299 ] 300 301 external_deps = [ 302 "ability_base:zuri", 303 "device_manager:devicemanagersdk", 304 "hilog:libhilog", 305 "ipc:ipc_core", 306 "os_account:os_account_innerkits", 307 ] 308 309 defines = [ 310 "private=public", 311 "LOG_TAG=\"distributedfile_daemon\"", 312 ] 313 314 use_exceptions = true 315 part_name = "dfs_service" 316 subsystem_name = "filemanagement" 317} 318 319ohos_unittest("trans_mananger_test") { 320 module_out_path = "filemanagement/dfs_service" 321 322 sources = [ 323 "${distributedfile_path}/utils/log/src/utils_log.cpp", 324 "${services_path}/distributedfiledaemon/src/ipc/trans_mananger.cpp", 325 "trans_mananger_test.cpp", 326 ] 327 328 include_dirs = [ 329 "${services_path}/distributedfiledaemon/include/ipc", 330 "${services_path}/distributedfiledaemon/src/ipc", 331 "${distributedfile_path}/frameworks/native/distributed_file_inner/include/", 332 ] 333 334 deps = [ 335 "${utils_path}:libdistributedfileutils", 336 "//third_party/googletest:gmock_main", 337 "//third_party/googletest:gtest_main", 338 ] 339 340 external_deps = [ 341 "ability_base:zuri", 342 "device_manager:devicemanagersdk", 343 "hilog:libhilog", 344 "ipc:ipc_core", 345 "os_account:os_account_innerkits", 346 ] 347 348 defines = [ 349 "private=public", 350 "LOG_TAG=\"distributedfile_daemon\"", 351 ] 352 353 use_exceptions = true 354 part_name = "dfs_service" 355 subsystem_name = "filemanagement" 356} 357 358group("distributed_daemon_test") { 359 testonly = true 360 361 deps = [ 362 ":connection_detector_test", 363 ":daemon_manager_impl_test", 364 ":daemon_manager_test", 365 ":daemon_service_proxy_test", 366 ":distributed_file_daemon_stub_test", 367 ":distributed_file_daemon_test", 368 ":trans_mananger_test", 369 ] 370} 371