• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2023-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.
13import("//build/test.gni")
14import("//foundation/filemanagement/dfs_service/distributedfile.gni")
15
16ohos_unittest("cloud_pref_impl_test") {
17  module_out_path = "dfs_service/dfs_service"
18
19  sources = [
20    "${distributedfile_path}/utils/preference/src/cloud_pref_impl.cpp",
21    "${distributedfile_path}/test/mock/preference_helper_mock.cpp",
22    "./preference/cloud_pref_impl_test.cpp",
23  ]
24
25  include_dirs = [
26    "${distributedfile_path}/test/mock",
27    "${distributedfile_path}/utils/log/include",
28  ]
29
30  deps = [ "${utils_path}:libdistributedfileutils" ]
31
32  external_deps = [
33    "googletest:gmock_main",
34    "googletest:gtest_main",
35    "hilog:libhilog",
36  ]
37
38  defines = [ "private=public" ]
39
40  defines += [
41    "LOG_DOMAIN=0xD004307",
42    "LOG_TAG=\"UTILS\"",
43  ]
44
45  use_exceptions = true
46}
47
48ohos_unittest("utils_directory_test") {
49  branch_protector_ret = "pac_ret"
50  sanitize = {
51    integer_overflow = true
52    cfi = true
53    cfi_cross_dso = true
54    debug = false
55    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
56  }
57
58  module_out_path = "dfs_service/dfs_service"
59
60  sources = [ "./system/utils_directory_test.cpp" ]
61
62  include_dirs = [
63    "${utils_path}/system/include",
64    "${utils_path}/log/include",
65  ]
66
67  deps = [ "${utils_path}:libdistributedfileutils" ]
68
69  external_deps = [
70    "c_utils:utils",
71    "googletest:gmock_main",
72    "googletest:gtest_main",
73    "hilog:libhilog",
74    "image_framework:image_native",
75    "json:nlohmann_json_static",
76  ]
77
78  defines = [ "private=public" ]
79  defines += [
80    "LOG_DOMAIN=0xD004307",
81    "LOG_TAG=\"CLOUDSYNC_SA\"",
82  ]
83  use_exceptions = true
84}
85
86ohos_unittest("cloud_file_utils_test") {
87  module_out_path = "dfs_service/dfs_service"
88
89  sources = [ "./cloud_disk/cloud_file_utils_test.cpp" ]
90
91  include_dirs = [
92    "${utils_path}/cloud_disk/include",
93    "${utils_path}/log/include",
94  ]
95
96  deps = [
97    "${utils_path}:libdistributedfiledentry",
98    "${utils_path}:libdistributedfileutils",
99  ]
100
101  external_deps = [
102    "c_utils:utils",
103    "googletest:gmock_main",
104    "googletest:gtest_main",
105    "hilog:libhilog",
106    "image_framework:image_native",
107    "init:libbegetutil",
108  ]
109
110  defines = [ "private=public" ]
111  defines += [
112    "LOG_DOMAIN=0xD004307",
113    "LOG_TAG=\"CLOUDSYNC_SA\"",
114  ]
115  if (dfs_service_feature_enable_cloud_adapter) {
116    defines += [ "CLOUD_ADAPTER_ENABLED" ]
117  }
118  use_exceptions = true
119}
120
121ohos_unittest("plugin_loader_test") {
122  module_out_path = "dfs_service/dfs_service"
123
124  sources = [ "./load/plugin_loader_test.cpp" ]
125
126  include_dirs = [
127    "${utils_path}/load/include",
128    "${utils_path}/load/src",
129  ]
130
131  deps = [
132    "${utils_path}:libdistributedfileutils",
133    "${utils_path}:libdistributedfileutils_lite",
134  ]
135
136  external_deps = [
137    "c_utils:utils",
138    "googletest:gmock_main",
139    "googletest:gtest_main",
140    "hilog:libhilog",
141  ]
142
143  defines = [ "private=public" ]
144  defines += [
145    "LOG_DOMAIN=0xD004307",
146    "LOG_TAG=\"UTILS\"",
147  ]
148
149  use_exceptions = true
150}
151
152ohos_unittest("async_work_test") {
153  module_out_path = "dfs_service/dfs_service"
154
155  sources = [ "./work/async_work_test.cpp" ]
156
157  include_dirs = [
158    "${utils_path}/work/include",
159    "${utils_path}/work/src",
160  ]
161
162  deps = [
163    "${utils_path}:libdistributedfileutils",
164    "${utils_path}:libdistributedfileutils_lite",
165  ]
166
167  external_deps = [
168    "ability_base:want",
169    "ability_base:zuri",
170    "ability_runtime:uri_permission_mgr",
171    "access_token:libaccesstoken_sdk",
172    "access_token:libtokenid_sdk",
173    "c_utils:utils",
174    "device_manager:devicemanagersdk",
175    "ffrt:libffrt",
176    "file_api:filemgmt_libhilog",
177    "file_api:filemgmt_libn",
178    "googletest:gmock_main",
179    "googletest:gtest_main",
180    "hilog:libhilog",
181    "hisysevent:libhisysevent",
182    "ipc:ipc_core",
183    "napi:ace_napi",
184    "preferences:native_preferences",
185  ]
186
187  defines = [ "private=public" ]
188  defines += [
189    "LOG_DOMAIN=0xD004307",
190    "LOG_TAG=\"UTILS\"",
191  ]
192
193  use_exceptions = true
194}
195
196group("utils_test") {
197  testonly = true
198
199  deps = [
200    ":async_work_test",
201    ":cloud_file_utils_test",
202    ":cloud_pref_impl_test",
203    ":plugin_loader_test",
204    ":utils_directory_test",
205  ]
206}
207