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  branch_protector_ret = "pac_ret"
37  sanitize = {
38    cfi = true
39    cfi_cross_dso = true
40    debug = false
41  }
42  module_out_path = module_output_path
43
44  sources = [
45    "${preferences_native_path}/mock/ability_base/zuri/src/uri.cpp",
46    "${preferences_native_path}/mock/ability_runtime/dataobs_manager/src/data_ability_observer_stub.cpp",
47    "${preferences_native_path}/mock/ability_runtime/dataobs_manager/src/dataobs_mgr_client.cpp",
48    "${preferences_native_path}/platform/src/preferences_db_adapter.cpp",
49    "${preferences_native_path}/platform/src/preferences_dfx_adapter.cpp",
50    "${preferences_native_path}/platform/src/preferences_file_lock.cpp",
51    "${preferences_native_path}/platform/src/preferences_thread.cpp",
52    "${preferences_native_path}/src/base64_helper.cpp",
53    "${preferences_native_path}/src/preferences_base.cpp",
54    "${preferences_native_path}/src/preferences_enhance_impl.cpp",
55    "${preferences_native_path}/src/preferences_helper.cpp",
56    "${preferences_native_path}/src/preferences_impl.cpp",
57    "${preferences_native_path}/src/preferences_observer.cpp",
58    "${preferences_native_path}/src/preferences_utils.cpp",
59    "${preferences_native_path}/src/preferences_value.cpp",
60    "${preferences_native_path}/src/preferences_value_parcel.cpp",
61    "${preferences_native_path}/src/preferences_xml_utils.cpp",
62    "${preferences_ndk_path}/src/convertor_error_code.cpp",
63    "${preferences_ndk_path}/src/oh_preferences.cpp",
64    "${preferences_ndk_path}/src/oh_preferences_option.cpp",
65    "${preferences_ndk_path}/src/oh_preferences_value.cpp",
66    "mock/application_context.cpp",
67    "unittest/preferences_ndk_test.cpp",
68    "unittest/preferences_ndk_value_test.cpp",
69    "unittest/preferences_test_utils.cpp",
70  ]
71
72  configs = [ ":module_private_config" ]
73  external_deps = [
74    "access_token:libaccesstoken_sdk",
75    "c_utils:utils",
76    "hilog:libhilog",
77    "hisysevent:libhisysevent",
78    "hitrace:hitrace_meter",
79    "ipc:ipc_core",
80    "libxml2:libxml2",
81  ]
82}
83
84###############################################################################
85group("unittest") {
86  testonly = true
87
88  deps = [ ":NDKPreferencesTest" ]
89}
90###############################################################################
91