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/preferences/preferences.gni") 15 16module_output_path = "preferences/ndk_preferences" 17 18############################################################################### 19 20config("module_private_config") { 21 visibility = [ ":*" ] 22 include_dirs = [ 23 "${preferences_base_path}/frameworks/ndk/include", 24 "${preferences_base_path}/frameworks/common/include", 25 "${preferences_native_path}/include", 26 "${preferences_native_path}/platform/include/", 27 "${preferences_interfaces_path}/inner_api/include/", 28 "${preferences_interfaces_path}/ndk/include/", 29 "${preferences_base_path}/test/ndk/mock", 30 "${preferences_native_path}/mock/ability_runtime/dataobs_manager/include", 31 "${preferences_native_path}/mock/ability_base/zuri/include", 32 ] 33} 34 35ohos_unittest("NDKPreferencesTest") { 36 defines = [] 37 if (!defined(global_parts_info) || 38 defined(global_parts_info.distributeddatamgr_arkdata_database_core)) { 39 defines += [ "ARKDATA_DATABASE_CORE_ENABLE" ] 40 } 41 branch_protector_ret = "pac_ret" 42 sanitize = { 43 cfi = true 44 cfi_cross_dso = true 45 debug = false 46 } 47 module_out_path = module_output_path 48 49 sources = [ 50 "${preferences_native_path}/mock/ability_base/zuri/src/uri.cpp", 51 "${preferences_native_path}/mock/ability_runtime/dataobs_manager/src/data_ability_observer_stub.cpp", 52 "${preferences_native_path}/mock/ability_runtime/dataobs_manager/src/dataobs_mgr_client.cpp", 53 "${preferences_native_path}/platform/src/preferences_db_adapter.cpp", 54 "${preferences_native_path}/platform/src/preferences_dfx_adapter.cpp", 55 "${preferences_native_path}/platform/src/preferences_file_lock.cpp", 56 "${preferences_native_path}/platform/src/preferences_thread.cpp", 57 "${preferences_native_path}/src/base64_helper.cpp", 58 "${preferences_native_path}/src/preferences_base.cpp", 59 "${preferences_native_path}/src/preferences_enhance_impl.cpp", 60 "${preferences_native_path}/src/preferences_helper.cpp", 61 "${preferences_native_path}/src/preferences_impl.cpp", 62 "${preferences_native_path}/src/preferences_observer.cpp", 63 "${preferences_native_path}/src/preferences_utils.cpp", 64 "${preferences_native_path}/src/preferences_value.cpp", 65 "${preferences_native_path}/src/preferences_value_parcel.cpp", 66 "${preferences_native_path}/src/preferences_xml_utils.cpp", 67 "${preferences_ndk_path}/src/oh_convertor.cpp", 68 "${preferences_ndk_path}/src/oh_preferences.cpp", 69 "${preferences_ndk_path}/src/oh_preferences_option.cpp", 70 "${preferences_ndk_path}/src/oh_preferences_value.cpp", 71 "mock/application_context.cpp", 72 "unittest/preferences_ndk_storage_type_test.cpp", 73 "unittest/preferences_ndk_test.cpp", 74 "unittest/preferences_ndk_value_test.cpp", 75 "unittest/preferences_test_utils.cpp", 76 ] 77 78 configs = [ ":module_private_config" ] 79 external_deps = [ 80 "access_token:libaccesstoken_sdk", 81 "c_utils:utils", 82 "hilog:libhilog", 83 "hisysevent:libhisysevent", 84 "hitrace:hitrace_meter", 85 "ipc:ipc_core", 86 "libxml2:libxml2", 87 ] 88} 89 90############################################################################### 91group("unittest") { 92 testonly = true 93 94 deps = [ ":NDKPreferencesTest" ] 95} 96############################################################################### 97