1# Copyright (c) 2021 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/distributeddatamgr/datamgr_service/datamgr_service.gni") 15 16module_output_path = "datamgr_service/distributeddataservice" 17 18############################################################################### 19config("module_private_config") { 20 visibility = [ ":*" ] 21 include_dirs = [ 22 "//foundation/distributeddatamgr/kv_store/frameworks/common", 23 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/distributeddatafwk/include", 24 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/distributeddatafwk/src", 25 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/kvdb/include", 26 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata/include", 27 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include/permission", 28 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include/account", 29 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include", 30 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include/dfx", 31 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include/broadcaster", 32 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include/utils", 33 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework/include", 34 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/bootstrap/include", 35 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/config/include", 36 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/crypto/include", 37 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/directory/include", 38 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/permission/include", 39 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/matrix/include", 40 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/session_manager", 41 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/kvdb", 42 "//foundation/distributeddatamgr/distributedfile/interfaces/kits/js/src/mod_securitylabel", 43 "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include", 44 "//commonlibrary/c_utils/base/include", 45 "//utils/system/safwk/native/include", 46 "../include", 47 "../src", 48 "../src/security", 49 "unittest", 50 "../src/uninstaller", 51 "../src/flowctrl_manager", 52 "../../../../interfaces/innerkits/distributeddata", 53 "//third_party/json/single_include", 54 ] 55 56 if (datamgr_service_power) { 57 include_dirs += 58 [ "//base/powermgr/power_manager/interfaces/innerkits/native/include" ] 59 } 60 ldflags = [ "-Wl,--whole-archive" ] 61} 62 63ohos_unittest("KvStoreDataServiceTest") { 64 module_out_path = module_output_path 65 sources = [ 66 "../src/dump_helper.cpp", 67 "../src/feature_stub_impl.cpp", 68 "../src/kvstore_account_observer.cpp", 69 "../src/kvstore_app_accessor.cpp", 70 "../src/kvstore_data_service.cpp", 71 "../src/kvstore_device_listener.cpp", 72 "../src/kvstore_meta_manager.cpp", 73 "../src/security/security.cpp", 74 "../src/security/sensitive.cpp", 75 "../src/session_manager/route_head_handler_impl.cpp", 76 "../src/session_manager/session_manager.cpp", 77 "../src/session_manager/upgrade_manager.cpp", 78 "unittest/kvstore_data_service_test.cpp", 79 ] 80 81 configs = [ ":module_private_config" ] 82 83 external_deps = [ 84 "access_token:libaccesstoken_sdk", 85 "c_utils:utils", 86 "dataclassification:data_transit_mgr", 87 "device_auth:deviceauth_sdk", 88 "hisysevent_native:libhisysevent", 89 "hitrace_native:hitrace_meter", 90 "hitrace_native:libhitracechain", 91 "hiviewdfx_hilog_native:libhilog", 92 "ipc:ipc_core", 93 "safwk:system_ability_fwk", 94 "samgr:samgr_proxy", 95 ] 96 97 if (datamgr_service_power) { 98 external_deps += [ 99 "battery_manager:batterysrv_client", 100 "power_manager:powermgr_client", 101 ] 102 } 103 104 deps = [ 105 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 106 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/broadcaster:distributeddata_broadcaster_static", 107 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/utils:distributeddata_utils_static", 108 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/checker:distributeddata_checker_static", 109 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/flowctrl_manager:distributeddata_flowctrl_static", 110 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/uninstaller:distributeddata_uninstaller_static", 111 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 112 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", 113 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb", 114 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 115 "//third_party/googletest:gtest_main", 116 ] 117 part_name = "datamgr_service" 118} 119 120ohos_unittest("KvStoreBackupTest") { 121 module_out_path = module_output_path 122 123 sources = [ 124 "../src/dump_helper.cpp", 125 "../src/feature_stub_impl.cpp", 126 "../src/kvstore_account_observer.cpp", 127 "../src/kvstore_app_accessor.cpp", 128 "../src/kvstore_data_service.cpp", 129 "../src/kvstore_device_listener.cpp", 130 "../src/kvstore_meta_manager.cpp", 131 "../src/security/security.cpp", 132 "../src/security/sensitive.cpp", 133 "../src/session_manager/route_head_handler_impl.cpp", 134 "../src/session_manager/session_manager.cpp", 135 "unittest/kvstore_backup_test.cpp", 136 ] 137 138 cflags_cc = [ "-DUT_TEST" ] 139 configs = [ ":module_private_config" ] 140 141 external_deps = [ 142 "access_token:libaccesstoken_sdk", 143 "c_utils:utils", 144 "dataclassification:data_transit_mgr", 145 "device_auth:deviceauth_sdk", 146 "hiviewdfx_hilog_native:libhilog", 147 "ipc:ipc_core", 148 "safwk:system_ability_fwk", 149 "samgr:samgr_proxy", 150 ] 151 152 if (datamgr_service_power) { 153 external_deps += [ 154 "battery_manager:batterysrv_client", 155 "power_manager:powermgr_client", 156 ] 157 } 158 159 deps = [ 160 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 161 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/broadcaster:distributeddata_broadcaster_static", 162 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/utils:distributeddata_utils_static", 163 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/checker:distributeddata_checker_static", 164 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/flowctrl_manager:distributeddata_flowctrl_static", 165 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/uninstaller:distributeddata_uninstaller_static", 166 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 167 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", 168 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb", 169 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 170 "//third_party/googletest:gtest_main", 171 ] 172 173 part_name = "datamgr_service" 174} 175 176ohos_unittest("KvStoreFlowCtrlManagerTest") { 177 module_out_path = module_output_path 178 sources = [ "unittest/kvstore_flowctrl_manager_test.cpp" ] 179 180 configs = [ ":module_private_config" ] 181 182 external_deps = [ 183 "access_token:libaccesstoken_sdk", 184 "c_utils:utils", 185 "dataclassification:data_transit_mgr", 186 "device_auth:deviceauth_sdk", 187 "hiviewdfx_hilog_native:libhilog", 188 "ipc:ipc_core", 189 "safwk:system_ability_fwk", 190 "samgr:samgr_proxy", 191 ] 192 193 if (datamgr_service_power) { 194 external_deps += [ 195 "battery_manager:batterysrv_client", 196 "power_manager:powermgr_client", 197 ] 198 } 199 200 deps = [ 201 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 202 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/flowctrl_manager:distributeddata_flowctrl_static", 203 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 204 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", 205 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 206 "//third_party/googletest:gtest_main", 207 ] 208 part_name = "datamgr_service" 209} 210 211ohos_unittest("KvStoreUninstallerTest") { 212 module_out_path = module_output_path 213 sources = [ 214 "../src/dump_helper.cpp", 215 "../src/feature_stub_impl.cpp", 216 "../src/kvstore_account_observer.cpp", 217 "../src/kvstore_app_accessor.cpp", 218 "../src/kvstore_data_service.cpp", 219 "../src/kvstore_device_listener.cpp", 220 "../src/kvstore_meta_manager.cpp", 221 "../src/security/security.cpp", 222 "../src/security/sensitive.cpp", 223 "../src/session_manager/route_head_handler_impl.cpp", 224 "../src/session_manager/session_manager.cpp", 225 "../src/session_manager/upgrade_manager.cpp", 226 "unittest/uninstaller_test.cpp", 227 ] 228 229 configs = [ ":module_private_config" ] 230 231 deps = [ 232 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 233 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/broadcaster:distributeddata_broadcaster_static", 234 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/utils:distributeddata_utils_static", 235 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/checker:distributeddata_checker_static", 236 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/flowctrl_manager:distributeddata_flowctrl_static", 237 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/uninstaller:distributeddata_uninstaller_static", 238 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 239 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", 240 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb", 241 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 242 "//third_party/googletest:gtest_main", 243 ] 244 245 external_deps = [ 246 "ability_base:base", 247 "ability_base:want", 248 "access_token:libaccesstoken_sdk", 249 "c_utils:utils", 250 "dataclassification:data_transit_mgr", 251 "device_auth:deviceauth_sdk", 252 "hisysevent_native:libhisysevent", 253 "hitrace_native:hitrace_meter", 254 "hitrace_native:libhitracechain", 255 "hiviewdfx_hilog_native:libhilog", 256 "ipc:ipc_core", 257 "safwk:system_ability_fwk", 258 "samgr:samgr_proxy", 259 ] 260 261 if (datamgr_service_power) { 262 external_deps += [ 263 "battery_manager:batterysrv_client", 264 "power_manager:powermgr_client", 265 ] 266 } 267 part_name = "datamgr_service" 268} 269 270############################################################################### 271 272group("unittest") { 273 testonly = true 274 deps = [] 275 276 deps += [ 277 ":KvStoreDataServiceTest", 278 ":KvStoreFlowCtrlManagerTest", 279 ":KvStoreUninstallerTest", 280 ] 281} 282 283############################################################################### 284group("moduletest") { 285 testonly = true 286 deps = [ 287 "//third_party/googletest:gmock", 288 "//third_party/googletest:gtest_main", 289 "//third_party/sqlite:sqlite", 290 ] 291 292 deps += [ 293 #":DistributedDataAccountEventModuleTest", 294 #":DistributedDataFlowCtrlManagerTest", 295 ] 296} 297############################################################################### 298