# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos_var.gni") import("//build/test.gni") import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni") module_output_path = "datamgr_service/distributeddatafwk" ############################################################################### config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include", "../bootstrap/include/", "../config/include/", "../crypto/include/", "../directory/include/", "../matrix/include/", "../common/", "../rdb/", "../object/", "../../framework/include/", "${dataobject_path}/interfaces/innerkits", "${dataobject_path}/frameworks/innerkitsimpl/include", ] defines = [ "TEST_ON_DEVICE", "OPENSSL_SUPPRESS_DEPRECATED", ] } ohos_unittest("CloudDataTest") { module_out_path = module_output_path sources = [ "cloud_data_test.cpp", "mock/db_change_data_mock.cpp", "mock/db_store_mock.cpp", ] include_dirs = [ "../../../../../relational_store/interfaces/inner_api/rdb/include" ] configs = [ ":module_private_config" ] external_deps = [ "ability_base:base", "ability_base:want", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", ] deps = [ "${kv_store_distributeddb_path}:distributeddb", "../../adapter:distributeddata_adapter", "../../framework:distributeddatasvcfwk", "../../service:distributeddatasvc", "//third_party/googletest:gtest_main", ] } ohos_unittest("CloudTest") { module_out_path = module_output_path sources = [ "cloud_test.cpp" ] configs = [ ":module_private_config" ] external_deps = [ "ability_base:base", "ability_base:want", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", ] deps = [ "${kv_store_distributeddb_path}:distributeddb", "../../adapter:distributeddata_adapter", "../../framework:distributeddatasvcfwk", "../../service:distributeddatasvc", "//third_party/googletest:gtest_main", ] } ohos_unittest("ValueProxyTest") { module_out_path = module_output_path sources = [ "../common/value_proxy.cpp", "value_proxy_test.cpp", ] include_dirs = [ "../../../../../relational_store/interfaces/inner_api/rdb/include", "${relational_store_path}/interfaces/inner_api/common_type/include", ] configs = [ ":module_private_config" ] external_deps = [ "ability_base:base", "ability_base:want", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", ] deps = [ "${kv_store_distributeddb_path}:distributeddb", "${relational_store_inner_api_path}:native_rdb_static", "../../adapter:distributeddata_adapter", "../../framework:distributeddatasvcfwk", "../../service:distributeddatasvc", "//third_party/googletest:gtest_main", ] } ohos_unittest("ConfigFactoryTest") { module_out_path = module_output_path sources = [ "config_factory_test.cpp" ] configs = [ ":module_private_config" ] external_deps = [ "ability_base:base", "ability_base:want", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", "//third_party/googletest:gtest_main", "//third_party/openssl:libcrypto_shared", ] } ohos_unittest("DirectoryManagerTest") { module_out_path = module_output_path sources = [ "directory_manager_test.cpp" ] configs = [ ":module_private_config" ] external_deps = [ "ability_base:base", "ability_base:want", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", "//third_party/googletest:gtest_main", ] } ohos_unittest("CryptoManagerTest") { module_out_path = module_output_path sources = [ "crypto_manager_test.cpp" ] configs = [ ":module_private_config" ] external_deps = [ "ability_base:base", "ability_base:want", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", "//third_party/googletest:gtest_main", ] } ohos_unittest("DeviceMatrixTest") { module_out_path = module_output_path sources = [ "device_matrix_test.cpp", "mock/db_change_data_mock.cpp", "mock/db_store_mock.cpp", ] configs = [ ":module_private_config" ] external_deps = [ "ability_base:base", "ability_base:want", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb", "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", "//third_party/googletest:gtest_main", ] } ohos_unittest("RdbResultSetImplTest") { module_out_path = module_output_path sources = [ "${data_service_path}/service/common/value_proxy.cpp", "${data_service_path}/service/rdb/rdb_result_set_impl.cpp", "${data_service_path}/service/rdb/rdb_result_set_stub.cpp", "mock/cursor_mock.cpp", "rdb_result_set_impl_test.cpp", ] include_dirs = [ "${data_service_path}/service/rdb", "${relational_store_path}/interfaces/inner_api/cloud_data/include", "${relational_store_path}/interfaces/inner_api/rdb/include", "${relational_store_path}/interfaces/inner_api/common_type/include", ] configs = [ ":module_private_config" ] external_deps = [ "ability_base:base", "ability_base:want", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "${data_service_path}/adapter:distributeddata_adapter", "${data_service_path}/adapter/utils:distributeddata_utils_static", "${data_service_path}/framework:distributeddatasvcfwk", "${kv_store_distributeddb_path}:distributeddb", "//third_party/googletest:gtest_main", ] } ohos_unittest("CacheCursorTest") { module_out_path = module_output_path sources = [ "${data_service_path}/service/rdb/cache_cursor.cpp", "cache_cursor_test.cpp", ] include_dirs = [ "${data_service_path}/service/rdb", "${relational_store_path}/interfaces/inner_api/rdb/include", ] configs = [ ":module_private_config" ] external_deps = [ "ability_base:base", "ability_base:want", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "${data_service_path}/adapter:distributeddata_adapter", "${data_service_path}/adapter/utils:distributeddata_utils_static", "${data_service_path}/framework:distributeddatasvcfwk", "${kv_store_distributeddb_path}:distributeddb", "//third_party/googletest:gtest_main", ] } ohos_unittest("ObjectAssetMachineTest") { module_out_path = module_output_path sources = [ "../object/object_asset_loader.cpp", "../object/object_asset_machine.cpp", "object_asset_machine_test.cpp", ] include_dirs = [ "${dataobject_path}/interfaces/innerkits", "${relational_store_path}/interfaces/inner_api/common_type/include", ] configs = [ ":module_private_config" ] external_deps = [ "c_utils:utils", "dfs_service:cloudsync_asset_kit_inner", "hilog:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", ] deps = [ "${data_service_path}/adapter:distributeddata_adapter", "${data_service_path}/framework:distributeddatasvcfwk", "${data_service_path}/service:distributeddatasvc", "//third_party/googletest:gtest_main", ] } ohos_unittest("MetaDataTest") { module_out_path = module_output_path sources = [ "${data_service_path}/app/src/kvstore_meta_manager.cpp", "meta_data_test.cpp", ] include_dirs = [ "${data_service_path}/app/src", "${data_service_path}/service/kvdb", "${data_service_path}/adapter/include/account", "${kv_store_path}/frameworks/innerkitsimpl/kvdb/include", "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include", "${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include", ] configs = [ ":module_private_config" ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "c_utils:utils", "dataclassification:data_transit_mgr", "hilog:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", ] deps = [ "${data_service_path}/adapter:distributeddata_adapter", "${data_service_path}/framework:distributeddatasvcfwk", "${data_service_path}/service:distributeddatasvc", "${kv_store_path}/frameworks/libs/distributeddb:distributeddb", "//third_party/googletest:gtest_main", ] } ############################################################################### group("unittest") { testonly = true deps = [] if (datamgr_service_config) { deps += [ ":ConfigFactoryTest" ] } deps += [ ":CloudDataTest", ":CloudTest", ":CryptoManagerTest", ":DeviceMatrixTest", ":DirectoryManagerTest", ":MetaDataTest", ":ObjectAssetMachineTest", ":RdbResultSetImplTest", ":ValueProxyTest", ] } ###############################################################################