• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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/ohos_var.gni")
14import("//build/test.gni")
15import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni")
16
17module_output_path = "datamgr_service/distributeddatafwk"
18
19###############################################################################
20config("module_private_config") {
21  visibility = [ ":*" ]
22
23  include_dirs = [
24    "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include",
25    "../bootstrap/include/",
26    "../config/include/",
27    "../crypto/include/",
28    "../directory/include/",
29    "../matrix/include/",
30    "../rdb/",
31    "../../framework/include/",
32  ]
33
34  defines = [
35    "TEST_ON_DEVICE",
36    "OPENSSL_SUPPRESS_DEPRECATED",
37  ]
38}
39
40ohos_unittest("CloudDataTest") {
41  module_out_path = module_output_path
42  sources = [
43    "cloud_data_test.cpp",
44    "mock/db_change_data_mock.cpp",
45    "mock/db_store_mock.cpp",
46  ]
47
48  include_dirs =
49      [ "../../../../../relational_store/interfaces/inner_api/rdb/include" ]
50
51  configs = [ ":module_private_config" ]
52
53  external_deps = [
54    "ability_base:base",
55    "ability_base:want",
56    "c_utils:utils",
57    "hilog:libhilog",
58    "ipc:ipc_core",
59    "kv_store:distributeddata_inner",
60  ]
61
62  deps = [
63    "${kv_store_distributeddb_path}:distributeddb",
64    "../../adapter:distributeddata_adapter",
65    "../../framework:distributeddatasvcfwk",
66    "../../service:distributeddatasvc",
67    "//third_party/googletest:gtest_main",
68  ]
69}
70
71ohos_unittest("ValueProxyTest") {
72  module_out_path = module_output_path
73  sources = [
74    "../rdb/value_proxy.cpp",
75    "value_proxy_test.cpp",
76  ]
77
78  include_dirs =
79      [ "../../../../../relational_store/interfaces/inner_api/rdb/include" ]
80
81  configs = [ ":module_private_config" ]
82
83  external_deps = [
84    "ability_base:base",
85    "ability_base:want",
86    "c_utils:utils",
87    "hilog:libhilog",
88    "ipc:ipc_core",
89    "kv_store:distributeddata_inner",
90  ]
91
92  deps = [
93    "${kv_store_distributeddb_path}:distributeddb",
94    "${relational_store_inner_api_path}:native_rdb_static",
95    "../../adapter:distributeddata_adapter",
96    "../../framework:distributeddatasvcfwk",
97    "../../service:distributeddatasvc",
98    "//third_party/googletest:gtest_main",
99  ]
100}
101
102ohos_unittest("ConfigFactoryTest") {
103  module_out_path = module_output_path
104  sources = [ "config_factory_test.cpp" ]
105
106  configs = [ ":module_private_config" ]
107
108  external_deps = [
109    "ability_base:base",
110    "ability_base:want",
111    "c_utils:utils",
112    "hilog:libhilog",
113    "ipc:ipc_core",
114  ]
115
116  deps = [
117    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
118    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk",
119    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc",
120    "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
121    "//third_party/googletest:gtest_main",
122    "//third_party/openssl:libcrypto_shared",
123  ]
124}
125
126ohos_unittest("DirectoryManagerTest") {
127  module_out_path = module_output_path
128  sources = [ "directory_manager_test.cpp" ]
129
130  configs = [ ":module_private_config" ]
131
132  external_deps = [
133    "ability_base:base",
134    "ability_base:want",
135    "access_token:libaccesstoken_sdk",
136    "access_token:libnativetoken",
137    "c_utils:utils",
138    "hilog:libhilog",
139    "ipc:ipc_core",
140  ]
141
142  deps = [
143    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
144    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk",
145    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc",
146    "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
147    "//third_party/googletest:gtest_main",
148  ]
149}
150
151ohos_unittest("CryptoManagerTest") {
152  module_out_path = module_output_path
153  sources = [ "crypto_manager_test.cpp" ]
154
155  configs = [ ":module_private_config" ]
156
157  external_deps = [
158    "ability_base:base",
159    "ability_base:want",
160    "access_token:libaccesstoken_sdk",
161    "access_token:libnativetoken",
162    "c_utils:utils",
163    "hilog:libhilog",
164    "ipc:ipc_core",
165  ]
166
167  deps = [
168    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
169    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk",
170    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc",
171    "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
172    "//third_party/googletest:gtest_main",
173  ]
174}
175
176ohos_unittest("DeviceMatrixTest") {
177  module_out_path = module_output_path
178  sources = [
179    "device_matrix_test.cpp",
180    "mock/db_change_data_mock.cpp",
181    "mock/db_store_mock.cpp",
182  ]
183
184  configs = [ ":module_private_config" ]
185
186  external_deps = [
187    "ability_base:base",
188    "ability_base:want",
189    "access_token:libaccesstoken_sdk",
190    "access_token:libnativetoken",
191    "c_utils:utils",
192    "hilog:libhilog",
193    "ipc:ipc_core",
194  ]
195
196  deps = [
197    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
198    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk",
199    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc",
200    "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb",
201    "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
202    "//third_party/googletest:gtest_main",
203  ]
204}
205
206ohos_unittest("RdbResultSetImplTest") {
207  module_out_path = module_output_path
208  sources = [
209    "${data_service_path}/service/rdb/rdb_result_set_impl.cpp",
210    "${data_service_path}/service/rdb/rdb_result_set_stub.cpp",
211    "${data_service_path}/service/rdb/value_proxy.cpp",
212    "mock/cursor_mock.cpp",
213    "rdb_result_set_impl_test.cpp",
214  ]
215
216  include_dirs = [
217    "${data_service_path}/service/rdb",
218    "${relational_store_path}/interfaces/inner_api/cloud_data/include",
219    "${relational_store_path}/interfaces/inner_api/rdb/include",
220  ]
221
222  configs = [ ":module_private_config" ]
223
224  external_deps = [
225    "ability_base:base",
226    "ability_base:want",
227    "access_token:libaccesstoken_sdk",
228    "access_token:libnativetoken",
229    "c_utils:utils",
230    "hilog:libhilog",
231    "ipc:ipc_core",
232  ]
233
234  deps = [
235    "${data_service_path}/adapter:distributeddata_adapter",
236    "${data_service_path}/adapter/utils:distributeddata_utils_static",
237    "${data_service_path}/framework:distributeddatasvcfwk",
238    "${kv_store_distributeddb_path}:distributeddb",
239    "//third_party/googletest:gtest_main",
240  ]
241}
242
243###############################################################################
244group("unittest") {
245  testonly = true
246
247  deps = []
248
249  deps += [
250    ":CloudDataTest",
251    ":ConfigFactoryTest",
252    ":CryptoManagerTest",
253    ":DeviceMatrixTest",
254    ":DirectoryManagerTest",
255    ":RdbResultSetImplTest",
256    ":ValueProxyTest",
257  ]
258}
259###############################################################################
260