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("cloud_sync_service_test") { 18 module_out_path = "dfs_service/dfs_service" 19 public_configs = 20 [ "${services_path}/cloudsyncservice:cloud_sync_service_public_config" ] 21 sources = [ 22 "${distributedfile_path}/test/mock/system_ability_manager_client_mock.cpp", 23 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/battery_status_mock.cpp", 24 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/cloud_status_mock.cpp", 25 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/dfsu_access_token_helper_mock.cpp", 26 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/network_status_mock.cpp", 27 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/parameters.cpp", 28 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/screen_status_mock.cpp", 29 "${services_path}/cloudsyncservice/src/cycle_task/cycle_task.cpp", 30 "${services_path}/cloudsyncservice/src/cycle_task/cycle_task_runner.cpp", 31 "${services_path}/cloudsyncservice/src/cycle_task/tasks/database_backup_task.cpp", 32 "${services_path}/cloudsyncservice/src/cycle_task/tasks/optimize_cache_task.cpp", 33 "${services_path}/cloudsyncservice/src/cycle_task/tasks/optimize_storage_task.cpp", 34 "${services_path}/cloudsyncservice/src/cycle_task/tasks/periodic_check_task.cpp", 35 "${services_path}/cloudsyncservice/src/cycle_task/tasks/report_statistics_task.cpp", 36 "${services_path}/cloudsyncservice/src/cycle_task/tasks/save_subscription_task.cpp", 37 "${services_path}/cloudsyncservice/src/ipc/cloud_sync_service.cpp", 38 "${services_path}/cloudsyncservice/src/ipc/download_asset_callback_manager.cpp", 39 "${services_path}/cloudsyncservice/src/ipc/download_asset_callback_proxy.cpp", 40 "${services_path}/cloudsyncservice/src/sync_rule/battery_status_listener.cpp", 41 "${services_path}/cloudsyncservice/src/sync_rule/package_status_listener.cpp", 42 "${services_path}/cloudsyncservice/src/sync_rule/screen_status_listener.cpp", 43 "${services_path}/cloudsyncservice/src/sync_rule/user_status_listener.cpp", 44 "cloud_sync_service_test.cpp", 45 ] 46 47 include_dirs = [ 48 "${clouddisk_database_path}/include", 49 "${services_path}/cloudsyncservice/include/ipc", 50 "${services_path}/cloudsyncservice/include", 51 "${services_path}/cloudsyncservice/include/cycle_task", 52 "${services_path}/cloudsyncservice/include/cycle_task/tasks", 53 "${services_path}/cloudsyncservice/include/transport", 54 "${services_path}/cloudsyncservice/include/transport/softbus", 55 "${services_path}/cloudsyncservice/include/sync_rule", 56 "${services_path}/cloudfiledaemon/include/cloud_disk", 57 "${distributedfile_path}/test/mock", 58 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 59 "${distributedfile_path}/test/unittests/cloudsync_sa/mock", 60 "${distributedfile_path}/adapter/cloud_adapter_example/include", 61 ] 62 63 transport = [ 64 "${services_path}/cloudsyncservice/src/transport/file_transfer_manager.cpp", 65 "${services_path}/cloudsyncservice/src/transport/message_handler.cpp", 66 "${services_path}/cloudsyncservice/src/transport/softbus/session_manager.cpp", 67 "${services_path}/cloudsyncservice/src/transport/softbus/softbus_adapter.cpp", 68 "${services_path}/cloudsyncservice/src/transport/softbus/softbus_session.cpp", 69 ] 70 71 sources += transport 72 73 deps = [ 74 "${clouddisk_database_path}:clouddisk_database", 75 "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit", 76 "${services_path}/cloudsyncservice:cloud_sync_service_stub", 77 "${utils_path}:libdistributedfiledentry", 78 "${utils_path}:libdistributedfileutils", 79 ] 80 81 external_deps = [ 82 "ability_base:want", 83 "ability_base:zuri", 84 "ability_runtime:dataobs_manager", 85 "app_file_service:sandbox_helper_native", 86 "app_file_service:sandbox_helper_native", 87 "c_utils:utils", 88 "common_event_service:cesfwk_innerkits", 89 "dfs_service:cloudsync_kit_inner", 90 "dsoftbus:softbus_client", 91 "e2fsprogs:libext2_blkid", 92 "e2fsprogs:libext2_uuid", 93 "eventhandler:libeventhandler", 94 "ffrt:libffrt", 95 "googletest:gmock_main", 96 "googletest:gtest_main", 97 "hilog:libhilog", 98 "hisysevent:libhisysevent", 99 "hitrace:hitrace_meter", 100 "ipc:ipc_single", 101 "libfuse:libfuse", 102 "memmgr:memmgrclient", 103 "netmanager_base:net_conn_manager_if", 104 "os_account:os_account_innerkits", 105 "power_manager:powermgr_client", 106 "preferences:native_preferences", 107 "relational_store:native_rdb", 108 "safwk:system_ability_fwk", 109 "samgr:samgr_proxy", 110 ] 111 112 defines = [ 113 "private=public", 114 "LOG_DOMAIN=0xD004307", 115 "LOG_TAG=\"CLOUDSYNC_TEST\"", 116 ] 117 118 if (cloudsync_service_hicollie_enable) { 119 external_deps += [ "hicollie:libhicollie" ] 120 defines += [ "HICOLLIE_ENABLE" ] 121 } 122 if (cloudsync_service_resource_schedule) { 123 external_deps += [ "resource_schedule_service:ressched_client" ] 124 defines += [ "CLOUDSYNC_SERVICE_RESOURCE_SCHEDULE" ] 125 } 126 127 if (cloudsync_service_power) { 128 external_deps += [ "battery_manager:batterysrv_client" ] 129 defines += [ "SUPPORT_POWER" ] 130 } 131 use_exceptions = true 132} 133 134ohos_unittest("download_asset_callback_manager_test") { 135 module_out_path = "dfs_service/dfs_service" 136 137 sources = [ 138 "${services_path}/cloudsyncservice/src/ipc/download_asset_callback_manager.cpp", 139 "download_asset_callback_manager_test.cpp", 140 ] 141 142 include_dirs = [ 143 "${services_path}/cloudsyncservice/include", 144 "${services_path}/cloudsyncservice/include/ipc", 145 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 146 ] 147 148 deps = [ 149 "${services_path}/cloudsyncservice:cloudsync_sa_static", 150 "${utils_path}:libdistributedfiledentry", 151 "${utils_path}:libdistributedfileutils", 152 ] 153 154 external_deps = [ 155 "ability_base:want", 156 "c_utils:utils", 157 "dfs_service:cloudsync_kit_inner", 158 "googletest:gmock_main", 159 "googletest:gtest_main", 160 "hilog:libhilog", 161 "hisysevent:libhisysevent", 162 "init:libbegetutil", 163 "ipc:ipc_single", 164 "netmanager_base:net_conn_manager_if", 165 "relational_store:native_rdb", 166 "safwk:system_ability_fwk", 167 "samgr:samgr_proxy", 168 ] 169 170 defines = [ "private=public" ] 171 172 use_exceptions = true 173} 174 175ohos_unittest("download_asset_callback_proxy_test") { 176 module_out_path = "dfs_service/dfs_service" 177 178 sources = [ 179 "${services_path}/cloudsyncservice/src/ipc/download_asset_callback_proxy.cpp", 180 "download_asset_callback_proxy_test.cpp", 181 ] 182 183 include_dirs = [ 184 "${services_path}/cloudsyncservice/include", 185 "${services_path}/cloudsyncservice/include/ipc", 186 "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include", 187 ] 188 189 deps = [ 190 "${services_path}/cloudsyncservice:cloudsync_sa_static", 191 "${utils_path}:libdistributedfiledentry", 192 "${utils_path}:libdistributedfileutils", 193 ] 194 195 external_deps = [ 196 "ability_base:want", 197 "c_utils:utils", 198 "dfs_service:cloudsync_kit_inner", 199 "googletest:gmock_main", 200 "googletest:gtest_main", 201 "hilog:libhilog", 202 "hisysevent:libhisysevent", 203 "init:libbegetutil", 204 "ipc:ipc_single", 205 "netmanager_base:net_conn_manager_if", 206 "relational_store:native_rdb", 207 "safwk:system_ability_fwk", 208 "samgr:samgr_proxy", 209 ] 210 211 defines = [ "private=public" ] 212 213 use_exceptions = true 214} 215 216group("cloudsync_sa_ipc_test") { 217 testonly = true 218 deps = [ 219 ":cloud_sync_service_test", 220 ":download_asset_callback_manager_test", 221 ":download_asset_callback_proxy_test", 222 ] 223} 224