1fc223305Sopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd.
2fc223305Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3fc223305Sopenharmony_ci# you may not use this file except in compliance with the License.
4fc223305Sopenharmony_ci# You may obtain a copy of the License at
5fc223305Sopenharmony_ci#
6fc223305Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7fc223305Sopenharmony_ci#
8fc223305Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9fc223305Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10fc223305Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11fc223305Sopenharmony_ci# See the License for the specific language governing permissions and
12fc223305Sopenharmony_ci# limitations under the License.
13fc223305Sopenharmony_ciimport("//build/test.gni")
14fc223305Sopenharmony_ciimport("//foundation/distributeddatamgr/preferences/preferences.gni")
15fc223305Sopenharmony_ci
16fc223305Sopenharmony_cimodule_output_path = "preferences/native_preferences"
17fc223305Sopenharmony_ci
18fc223305Sopenharmony_ci###############################################################################
19fc223305Sopenharmony_ciconfig("module_private_config") {
20fc223305Sopenharmony_ci  visibility = [ ":*" ]
21fc223305Sopenharmony_ci
22fc223305Sopenharmony_ci  include_dirs = [
23fc223305Sopenharmony_ci    "${preferences_native_path}/include/",
24fc223305Sopenharmony_ci    "${preferences_innerapi_path}/include",
25fc223305Sopenharmony_ci    "${preferences_base_path}/frameworks/common/include",
26fc223305Sopenharmony_ci  ]
27fc223305Sopenharmony_ci}
28fc223305Sopenharmony_ci
29fc223305Sopenharmony_ciohos_unittest("NativePreferencesTest") {
30fc223305Sopenharmony_ci  branch_protector_ret = "pac_ret"
31fc223305Sopenharmony_ci  sanitize = {
32fc223305Sopenharmony_ci    cfi = true
33fc223305Sopenharmony_ci    cfi_cross_dso = true
34fc223305Sopenharmony_ci    debug = false
35fc223305Sopenharmony_ci  }
36fc223305Sopenharmony_ci  module_out_path = module_output_path
37fc223305Sopenharmony_ci
38fc223305Sopenharmony_ci  sources = [
39fc223305Sopenharmony_ci    "unittest/base64_helper_test.cpp",
40fc223305Sopenharmony_ci    "unittest/preferences_file_test.cpp",
41fc223305Sopenharmony_ci    "unittest/preferences_helper_test.cpp",
42fc223305Sopenharmony_ci    "unittest/preferences_test.cpp",
43fc223305Sopenharmony_ci    "unittest/preferences_xml_utils_test.cpp",
44fc223305Sopenharmony_ci  ]
45fc223305Sopenharmony_ci
46fc223305Sopenharmony_ci  configs = [ ":module_private_config" ]
47fc223305Sopenharmony_ci
48fc223305Sopenharmony_ci  external_deps = [
49fc223305Sopenharmony_ci    "ability_base:zuri",
50fc223305Sopenharmony_ci    "ability_runtime:dataobs_manager",
51fc223305Sopenharmony_ci    "hilog:libhilog",
52fc223305Sopenharmony_ci  ]
53fc223305Sopenharmony_ci
54fc223305Sopenharmony_ci  deps = [
55fc223305Sopenharmony_ci    "${preferences_innerapi_path}:native_preferences_static",
56fc223305Sopenharmony_ci    "//third_party/googletest:gtest_main",
57fc223305Sopenharmony_ci  ]
58fc223305Sopenharmony_ci}
59fc223305Sopenharmony_ci
60fc223305Sopenharmony_ci###############################################################################
61fc223305Sopenharmony_cigroup("unittest") {
62fc223305Sopenharmony_ci  testonly = true
63fc223305Sopenharmony_ci
64fc223305Sopenharmony_ci  deps = [ ":NativePreferencesTest" ]
65fc223305Sopenharmony_ci}
66fc223305Sopenharmony_ci
67fc223305Sopenharmony_ci###############################################################################
68fc223305Sopenharmony_cigroup("fuzztest") {
69fc223305Sopenharmony_ci  testonly = true
70fc223305Sopenharmony_ci  deps = []
71fc223305Sopenharmony_ci  deps += [ "fuzztest/preferences_fuzzer:fuzztest" ]
72fc223305Sopenharmony_ci}
73fc223305Sopenharmony_ci###############################################################################
74