1fc0b0055Sopenharmony_ci# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
2fc0b0055Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3fc0b0055Sopenharmony_ci# you may not use this file except in compliance with the License.
4fc0b0055Sopenharmony_ci# You may obtain a copy of the License at
5fc0b0055Sopenharmony_ci#
6fc0b0055Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7fc0b0055Sopenharmony_ci#
8fc0b0055Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9fc0b0055Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10fc0b0055Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11fc0b0055Sopenharmony_ci# See the License for the specific language governing permissions and
12fc0b0055Sopenharmony_ci# limitations under the License.
13fc0b0055Sopenharmony_ci
14fc0b0055Sopenharmony_ciimport("//build/test.gni")
15fc0b0055Sopenharmony_ciimport("../../../../access_token.gni")
16fc0b0055Sopenharmony_ci
17fc0b0055Sopenharmony_ciohos_unittest("libnativetoken_test") {
18fc0b0055Sopenharmony_ci  subsystem_name = "security"
19fc0b0055Sopenharmony_ci  part_name = "access_token"
20fc0b0055Sopenharmony_ci  module_out_path = part_name + "/" + part_name
21fc0b0055Sopenharmony_ci  sanitize = {
22fc0b0055Sopenharmony_ci    cfi = true
23fc0b0055Sopenharmony_ci    cfi_cross_dso = true
24fc0b0055Sopenharmony_ci    debug = false
25fc0b0055Sopenharmony_ci  }
26fc0b0055Sopenharmony_ci  branch_protector_ret = "pac_ret"
27fc0b0055Sopenharmony_ci
28fc0b0055Sopenharmony_ci  include_dirs = [ "../include" ]
29fc0b0055Sopenharmony_ci
30fc0b0055Sopenharmony_ci  sources = [
31fc0b0055Sopenharmony_ci    "unittest/src/nativetoken_kit_test.cpp",
32fc0b0055Sopenharmony_ci    "unittest/src/nativetoken_oper_test.cpp",
33fc0b0055Sopenharmony_ci  ]
34fc0b0055Sopenharmony_ci
35fc0b0055Sopenharmony_ci  configs = [ "${access_token_path}/config:coverage_flags" ]
36fc0b0055Sopenharmony_ci
37fc0b0055Sopenharmony_ci  deps = [ "../:libnativetoken_shared" ]
38fc0b0055Sopenharmony_ci  external_deps = [
39fc0b0055Sopenharmony_ci    "bounds_checking_function:libsec_shared",
40fc0b0055Sopenharmony_ci    "cJSON:cjson_static",
41fc0b0055Sopenharmony_ci    "googletest:gmock",
42fc0b0055Sopenharmony_ci    "googletest:gtest",
43fc0b0055Sopenharmony_ci  ]
44fc0b0055Sopenharmony_ci}
45fc0b0055Sopenharmony_ci
46fc0b0055Sopenharmony_ciohos_unittest("libnativetoken_mock_test") {
47fc0b0055Sopenharmony_ci  subsystem_name = "security"
48fc0b0055Sopenharmony_ci  part_name = "access_token"
49fc0b0055Sopenharmony_ci  module_out_path = part_name + "/" + part_name
50fc0b0055Sopenharmony_ci  sanitize = {
51fc0b0055Sopenharmony_ci    cfi = true
52fc0b0055Sopenharmony_ci    cfi_cross_dso = true
53fc0b0055Sopenharmony_ci    debug = false
54fc0b0055Sopenharmony_ci  }
55fc0b0055Sopenharmony_ci  branch_protector_ret = "pac_ret"
56fc0b0055Sopenharmony_ci
57fc0b0055Sopenharmony_ci  include_dirs = [
58fc0b0055Sopenharmony_ci    "../include",
59fc0b0055Sopenharmony_ci    "mock/include/",
60fc0b0055Sopenharmony_ci  ]
61fc0b0055Sopenharmony_ci
62fc0b0055Sopenharmony_ci  sources = [
63fc0b0055Sopenharmony_ci    "../src/nativetoken.c",
64fc0b0055Sopenharmony_ci    "../src/nativetoken_json_oper.c",
65fc0b0055Sopenharmony_ci    "../src/nativetoken_klog.c",
66fc0b0055Sopenharmony_ci    "mock/src/cJSON.c",
67fc0b0055Sopenharmony_ci    "unittest/mock/nativetoken_oper_test.cpp",
68fc0b0055Sopenharmony_ci  ]
69fc0b0055Sopenharmony_ci
70fc0b0055Sopenharmony_ci  configs = [ "${access_token_path}/config:coverage_flags" ]
71fc0b0055Sopenharmony_ci
72fc0b0055Sopenharmony_ci  external_deps = [
73fc0b0055Sopenharmony_ci    "bounds_checking_function:libsec_shared",
74fc0b0055Sopenharmony_ci    "googletest:gmock",
75fc0b0055Sopenharmony_ci    "googletest:gtest",
76fc0b0055Sopenharmony_ci    "hilog:libhilog",
77fc0b0055Sopenharmony_ci  ]
78fc0b0055Sopenharmony_ci}
79fc0b0055Sopenharmony_ci
80fc0b0055Sopenharmony_cigroup("unittest") {
81fc0b0055Sopenharmony_ci  testonly = true
82fc0b0055Sopenharmony_ci  deps = [
83fc0b0055Sopenharmony_ci    ":libnativetoken_mock_test",
84fc0b0055Sopenharmony_ci    ":libnativetoken_test",
85fc0b0055Sopenharmony_ci  ]
86fc0b0055Sopenharmony_ci}
87