1cb7eb8c9Sopenharmony_ci# Copyright (C) 2024 Huawei Device Co., Ltd.
2cb7eb8c9Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3cb7eb8c9Sopenharmony_ci# you may not use this file except in compliance with the License.
4cb7eb8c9Sopenharmony_ci# You may obtain a copy of the License at
5cb7eb8c9Sopenharmony_ci#
6cb7eb8c9Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7cb7eb8c9Sopenharmony_ci#
8cb7eb8c9Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9cb7eb8c9Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10cb7eb8c9Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11cb7eb8c9Sopenharmony_ci# See the License for the specific language governing permissions and
12cb7eb8c9Sopenharmony_ci# limitations under the License.
13cb7eb8c9Sopenharmony_ci
14cb7eb8c9Sopenharmony_ciimport("//build/test.gni")
15cb7eb8c9Sopenharmony_ciimport("//foundation/filemanagement/dfs_service/distributedfile.gni")
16cb7eb8c9Sopenharmony_ci
17cb7eb8c9Sopenharmony_ciohos_unittest("cloud_sync_service_stub_test") {
18cb7eb8c9Sopenharmony_ci  module_out_path = "filemanagement/dfs_service"
19cb7eb8c9Sopenharmony_ci
20cb7eb8c9Sopenharmony_ci  sources = [
21cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_sa/mock/dfsu_access_token_helper_mock.cpp",
22cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/ipc/cloud_sync_service_stub.cpp",
23cb7eb8c9Sopenharmony_ci    "cloud_sync_service_stub_test.cpp",
24cb7eb8c9Sopenharmony_ci  ]
25cb7eb8c9Sopenharmony_ci
26cb7eb8c9Sopenharmony_ci  include_dirs = [
27cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/ipc",
28cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include",
29cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
30cb7eb8c9Sopenharmony_ci  ]
31cb7eb8c9Sopenharmony_ci
32cb7eb8c9Sopenharmony_ci  deps = [
33cb7eb8c9Sopenharmony_ci    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
34cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice:cloudsync_sa_static",
35cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfileutils",
36cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gmock_main",
37cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gtest_main",
38cb7eb8c9Sopenharmony_ci  ]
39cb7eb8c9Sopenharmony_ci
40cb7eb8c9Sopenharmony_ci  external_deps = [
41cb7eb8c9Sopenharmony_ci    "ability_base:want",
42cb7eb8c9Sopenharmony_ci    "ability_base:zuri",
43cb7eb8c9Sopenharmony_ci    "ability_runtime:dataobs_manager",
44cb7eb8c9Sopenharmony_ci    "c_utils:utils",
45cb7eb8c9Sopenharmony_ci    "dfs_service:cloudsync_kit_inner",
46cb7eb8c9Sopenharmony_ci    "ffrt:libffrt",
47cb7eb8c9Sopenharmony_ci    "hilog:libhilog",
48cb7eb8c9Sopenharmony_ci    "hisysevent:libhisysevent",
49cb7eb8c9Sopenharmony_ci    "ipc:ipc_single",
50cb7eb8c9Sopenharmony_ci    "safwk:system_ability_fwk",
51cb7eb8c9Sopenharmony_ci    "samgr:samgr_proxy",
52cb7eb8c9Sopenharmony_ci  ]
53cb7eb8c9Sopenharmony_ci
54cb7eb8c9Sopenharmony_ci  defines = [ "private=public" ]
55cb7eb8c9Sopenharmony_ci
56cb7eb8c9Sopenharmony_ci  use_exceptions = true
57cb7eb8c9Sopenharmony_ci}
58cb7eb8c9Sopenharmony_ci
59cb7eb8c9Sopenharmony_ciohos_unittest("cloud_sync_service_test") {
60cb7eb8c9Sopenharmony_ci  module_out_path = "filemanagement/dfs_service"
61cb7eb8c9Sopenharmony_ci
62cb7eb8c9Sopenharmony_ci  sources = [
63cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp",
64cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_sa/mock/battery_status_mock.cpp",
65cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_sa/mock/cloud_status_mock.cpp",
66cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_sa/mock/network_status_mock.cpp",
67cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_sa/mock/parameters.cpp",
68cb7eb8c9Sopenharmony_ci    "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/src/base_column.cpp",
69cb7eb8c9Sopenharmony_ci    "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/src/media_column.cpp",
70cb7eb8c9Sopenharmony_ci    "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/src/medialibrary_business_record_column.cpp",
71cb7eb8c9Sopenharmony_ci    "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/src/photo_album_column.cpp",
72cb7eb8c9Sopenharmony_ci    "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/src/photo_map_column.cpp",
73cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/cycle_task/cycle_task.cpp",
74cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/cycle_task/cycle_task_runner.cpp",
75cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/cycle_task/tasks/database_backup_task.cpp",
76cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/cycle_task/tasks/optimize_storage_task.cpp",
77cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/cycle_task/tasks/periodic_check_task.cpp",
78cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/cycle_task/tasks/report_statistics_task.cpp",
79cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/cycle_task/tasks/save_subscription_task.cpp",
80cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/ipc/cloud_sync_service.cpp",
81cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/ipc/cloud_sync_service_stub.cpp",
82cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/ipc/download_asset_callback_manager.cpp",
83cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/ipc/download_asset_callback_proxy.cpp",
84cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/sync_rule/battery_status_listener.cpp",
85cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/sync_rule/screen_status_listener.cpp",
86cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/sync_rule/user_status_listener.cpp",
87cb7eb8c9Sopenharmony_ci    "cloud_sync_service_test.cpp",
88cb7eb8c9Sopenharmony_ci  ]
89cb7eb8c9Sopenharmony_ci
90cb7eb8c9Sopenharmony_ci  include_dirs = [
91cb7eb8c9Sopenharmony_ci    "${clouddisk_database_path}/include",
92cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_sa/mock/",
93cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/ipc",
94cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include",
95cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/cycle_task",
96cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/cycle_task/tasks",
97cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/transport",
98cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/transport/softbus",
99cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/sync_rule",
100cb7eb8c9Sopenharmony_ci    "${services_path}/cloudfiledaemon/include/cloud_disk",
101cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
102cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_sa/mock",
103cb7eb8c9Sopenharmony_ci    "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/include",
104cb7eb8c9Sopenharmony_ci    "${media_library_path}/interfaces/inner_api/media_library_helper/include",
105cb7eb8c9Sopenharmony_ci    "${media_library_path}/frameworks/services/media_thumbnail/include",
106cb7eb8c9Sopenharmony_ci    "${media_library_path}/frameworks/utils/include",
107cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/adapter/cloud_adapter_example/include",
108cb7eb8c9Sopenharmony_ci    "//third_party/e2fsprogs/e2fsprogs/lib",
109cb7eb8c9Sopenharmony_ci  ]
110cb7eb8c9Sopenharmony_ci
111cb7eb8c9Sopenharmony_ci  transport = [
112cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/transport/file_transfer_manager.cpp",
113cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/transport/message_handler.cpp",
114cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/transport/softbus/session_manager.cpp",
115cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/transport/softbus/softbus_adapter.cpp",
116cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/transport/softbus/softbus_session.cpp",
117cb7eb8c9Sopenharmony_ci  ]
118cb7eb8c9Sopenharmony_ci
119cb7eb8c9Sopenharmony_ci  sources += transport
120cb7eb8c9Sopenharmony_ci
121cb7eb8c9Sopenharmony_ci  deps = [
122cb7eb8c9Sopenharmony_ci    "${clouddisk_database_path}:clouddisk_database",
123cb7eb8c9Sopenharmony_ci    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
124cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfiledentry",
125cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfileutils",
126cb7eb8c9Sopenharmony_ci    "//third_party/e2fsprogs:libext2_uuid",
127cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gmock_main",
128cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gtest_main",
129cb7eb8c9Sopenharmony_ci  ]
130cb7eb8c9Sopenharmony_ci
131cb7eb8c9Sopenharmony_ci  external_deps = [
132cb7eb8c9Sopenharmony_ci    "ability_base:want",
133cb7eb8c9Sopenharmony_ci    "ability_base:zuri",
134cb7eb8c9Sopenharmony_ci    "ability_runtime:dataobs_manager",
135cb7eb8c9Sopenharmony_ci    "app_file_service:sandbox_helper_native",
136cb7eb8c9Sopenharmony_ci    "app_file_service:sandbox_helper_native",
137cb7eb8c9Sopenharmony_ci    "c_utils:utils",
138cb7eb8c9Sopenharmony_ci    "common_event_service:cesfwk_innerkits",
139cb7eb8c9Sopenharmony_ci    "dfs_service:cloudsync_kit_inner",
140cb7eb8c9Sopenharmony_ci    "dsoftbus:softbus_client",
141cb7eb8c9Sopenharmony_ci    "eventhandler:libeventhandler",
142cb7eb8c9Sopenharmony_ci    "ffrt:libffrt",
143cb7eb8c9Sopenharmony_ci    "hilog:libhilog",
144cb7eb8c9Sopenharmony_ci    "hisysevent:libhisysevent",
145cb7eb8c9Sopenharmony_ci    "hitrace:hitrace_meter",
146cb7eb8c9Sopenharmony_ci    "ipc:ipc_single",
147cb7eb8c9Sopenharmony_ci    "libfuse:libfuse",
148cb7eb8c9Sopenharmony_ci    "netmanager_base:net_conn_manager_if",
149cb7eb8c9Sopenharmony_ci    "os_account:os_account_innerkits",
150cb7eb8c9Sopenharmony_ci    "power_manager:powermgr_client",
151cb7eb8c9Sopenharmony_ci    "relational_store:native_rdb",
152cb7eb8c9Sopenharmony_ci    "safwk:system_ability_fwk",
153cb7eb8c9Sopenharmony_ci    "samgr:samgr_proxy",
154cb7eb8c9Sopenharmony_ci  ]
155cb7eb8c9Sopenharmony_ci
156cb7eb8c9Sopenharmony_ci  defines = [
157cb7eb8c9Sopenharmony_ci    "private=public",
158cb7eb8c9Sopenharmony_ci    "LOG_DOMAIN=0xD004307",
159cb7eb8c9Sopenharmony_ci    "LOG_TAG=\"CLOUDSYNC_TEST\"",
160cb7eb8c9Sopenharmony_ci  ]
161cb7eb8c9Sopenharmony_ci
162cb7eb8c9Sopenharmony_ci  if (cloudsync_service_hicollie_enable) {
163cb7eb8c9Sopenharmony_ci    external_deps += [ "hicollie:libhicollie" ]
164cb7eb8c9Sopenharmony_ci    defines += [ "HICOLLIE_ENABLE" ]
165cb7eb8c9Sopenharmony_ci  }
166cb7eb8c9Sopenharmony_ci  if (cloudsync_service_resource_schedule) {
167cb7eb8c9Sopenharmony_ci    external_deps += [ "resource_schedule_service:ressched_client" ]
168cb7eb8c9Sopenharmony_ci    defines += [ "CLOUDSYNC_SERVICE_RESOURCE_SCHEDULE" ]
169cb7eb8c9Sopenharmony_ci  }
170cb7eb8c9Sopenharmony_ci  use_exceptions = true
171cb7eb8c9Sopenharmony_ci}
172cb7eb8c9Sopenharmony_ci
173cb7eb8c9Sopenharmony_ciohos_unittest("download_asset_callback_manager_test") {
174cb7eb8c9Sopenharmony_ci  module_out_path = "filemanagement/dfs_service"
175cb7eb8c9Sopenharmony_ci
176cb7eb8c9Sopenharmony_ci  sources = [
177cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/ipc/download_asset_callback_manager.cpp",
178cb7eb8c9Sopenharmony_ci    "download_asset_callback_manager_test.cpp",
179cb7eb8c9Sopenharmony_ci  ]
180cb7eb8c9Sopenharmony_ci
181cb7eb8c9Sopenharmony_ci  include_dirs = [
182cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include",
183cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/ipc",
184cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
185cb7eb8c9Sopenharmony_ci  ]
186cb7eb8c9Sopenharmony_ci
187cb7eb8c9Sopenharmony_ci  deps = [
188cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice:cloudsync_sa_static",
189cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfiledentry",
190cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfileutils",
191cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gmock_main",
192cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gtest_main",
193cb7eb8c9Sopenharmony_ci  ]
194cb7eb8c9Sopenharmony_ci
195cb7eb8c9Sopenharmony_ci  external_deps = [
196cb7eb8c9Sopenharmony_ci    "ability_base:want",
197cb7eb8c9Sopenharmony_ci    "c_utils:utils",
198cb7eb8c9Sopenharmony_ci    "dfs_service:cloudsync_kit_inner",
199cb7eb8c9Sopenharmony_ci    "hilog:libhilog",
200cb7eb8c9Sopenharmony_ci    "hisysevent:libhisysevent",
201cb7eb8c9Sopenharmony_ci    "init:libbegetutil",
202cb7eb8c9Sopenharmony_ci    "ipc:ipc_single",
203cb7eb8c9Sopenharmony_ci    "netmanager_base:net_conn_manager_if",
204cb7eb8c9Sopenharmony_ci    "relational_store:native_rdb",
205cb7eb8c9Sopenharmony_ci    "safwk:system_ability_fwk",
206cb7eb8c9Sopenharmony_ci    "samgr:samgr_proxy",
207cb7eb8c9Sopenharmony_ci  ]
208cb7eb8c9Sopenharmony_ci
209cb7eb8c9Sopenharmony_ci  defines = [ "private=public" ]
210cb7eb8c9Sopenharmony_ci
211cb7eb8c9Sopenharmony_ci  use_exceptions = true
212cb7eb8c9Sopenharmony_ci}
213cb7eb8c9Sopenharmony_ci
214cb7eb8c9Sopenharmony_ciohos_unittest("download_asset_callback_proxy_test") {
215cb7eb8c9Sopenharmony_ci  module_out_path = "filemanagement/dfs_service"
216cb7eb8c9Sopenharmony_ci
217cb7eb8c9Sopenharmony_ci  sources = [
218cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/src/ipc/download_asset_callback_proxy.cpp",
219cb7eb8c9Sopenharmony_ci    "download_asset_callback_proxy_test.cpp",
220cb7eb8c9Sopenharmony_ci  ]
221cb7eb8c9Sopenharmony_ci
222cb7eb8c9Sopenharmony_ci  include_dirs = [
223cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include",
224cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/ipc",
225cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
226cb7eb8c9Sopenharmony_ci  ]
227cb7eb8c9Sopenharmony_ci
228cb7eb8c9Sopenharmony_ci  deps = [
229cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice:cloudsync_sa_static",
230cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfiledentry",
231cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfileutils",
232cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gmock_main",
233cb7eb8c9Sopenharmony_ci    "//third_party/googletest:gtest_main",
234cb7eb8c9Sopenharmony_ci  ]
235cb7eb8c9Sopenharmony_ci
236cb7eb8c9Sopenharmony_ci  external_deps = [
237cb7eb8c9Sopenharmony_ci    "ability_base:want",
238cb7eb8c9Sopenharmony_ci    "c_utils:utils",
239cb7eb8c9Sopenharmony_ci    "dfs_service:cloudsync_kit_inner",
240cb7eb8c9Sopenharmony_ci    "hilog:libhilog",
241cb7eb8c9Sopenharmony_ci    "hisysevent:libhisysevent",
242cb7eb8c9Sopenharmony_ci    "init:libbegetutil",
243cb7eb8c9Sopenharmony_ci    "ipc:ipc_single",
244cb7eb8c9Sopenharmony_ci    "netmanager_base:net_conn_manager_if",
245cb7eb8c9Sopenharmony_ci    "relational_store:native_rdb",
246cb7eb8c9Sopenharmony_ci    "safwk:system_ability_fwk",
247cb7eb8c9Sopenharmony_ci    "samgr:samgr_proxy",
248cb7eb8c9Sopenharmony_ci  ]
249cb7eb8c9Sopenharmony_ci
250cb7eb8c9Sopenharmony_ci  defines = [ "private=public" ]
251cb7eb8c9Sopenharmony_ci
252cb7eb8c9Sopenharmony_ci  use_exceptions = true
253cb7eb8c9Sopenharmony_ci}
254cb7eb8c9Sopenharmony_ci
255cb7eb8c9Sopenharmony_cigroup("cloudsync_sa_ipc_test") {
256cb7eb8c9Sopenharmony_ci  testonly = true
257cb7eb8c9Sopenharmony_ci  deps = [
258cb7eb8c9Sopenharmony_ci    ":cloud_sync_service_stub_test",
259cb7eb8c9Sopenharmony_ci    ":cloud_sync_service_test",
260cb7eb8c9Sopenharmony_ci    ":download_asset_callback_manager_test",
261cb7eb8c9Sopenharmony_ci    ":download_asset_callback_proxy_test",
262cb7eb8c9Sopenharmony_ci  ]
263cb7eb8c9Sopenharmony_ci}
264