1# Copyright (c) 2022-2024 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.
13
14import("//build/test.gni")
15import("../../../../access_token.gni")
16
17ohos_unittest("libdatabase_test") {
18  subsystem_name = "security"
19  part_name = "access_token"
20  module_out_path = part_name + "/" + part_name
21  sanitize = {
22    cfi = true
23    cfi_cross_dso = true
24    debug = false
25  }
26  branch_protector_ret = "pac_ret"
27
28  include_dirs = [
29    "${access_token_path}/frameworks/accesstoken/include",
30    "${access_token_path}/frameworks/common/include",
31    "${access_token_path}/interfaces/innerkits/accesstoken/include",
32    "${access_token_path}/services/common/database/include",
33    "${access_token_path}/services/common/utils/include",
34    "${access_token_path}/services/accesstokenmanager/main/cpp/include/callback",
35    "${access_token_path}/services/accesstokenmanager/main/cpp/include/database",
36    "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission",
37    "${access_token_path}/services/accesstokenmanager/main/cpp/include/token",
38  ]
39
40  sources = [
41    "${access_token_path}/services/accesstokenmanager/main/cpp/src/callback/accesstoken_callback_proxys.cpp",
42    "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/access_token_db.cpp",
43    "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/access_token_db_util.cpp",
44    "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/access_token_open_callback.cpp",
45    "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/data_translator.cpp",
46    "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/token_field_const.cpp",
47    "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_validator.cpp",
48    "unittest/database_test.cpp",
49  ]
50
51  configs = [ "${access_token_path}/config:coverage_flags" ]
52
53  cflags_cc = [ "-DHILOG_ENABLE" ]
54
55  deps = [
56    "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx",
57    "${access_token_path}/frameworks/common:accesstoken_common_cxx",
58    "${access_token_path}/services/common:accesstoken_service_common",
59  ]
60
61  external_deps = [
62    "c_utils:utils",
63    "hilog:libhilog",
64    "hisysevent:libhisysevent",
65    "ipc:ipc_core",
66    "relational_store:native_rdb",
67    "sqlite:sqlite",
68  ]
69}
70
71group("unittest") {
72  testonly = true
73  deps = [ ":libdatabase_test" ]
74}
75