1# Copyright (c) 2021-2022 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") 15 16ohos_unittest("libnativetoken_test") { 17 subsystem_name = "security" 18 part_name = "access_token" 19 module_out_path = part_name + "/" + part_name 20 21 include_dirs = [ 22 "//third_party/cJSON", 23 "//third_party/bounds_checking_function/include", 24 "//base/security/access_token/interfaces/innerkits/nativetoken/include", 25 ] 26 27 sources = [ 28 "unittest/src/nativetoken_kit_test.cpp", 29 "unittest/src/nativetoken_oper_test.cpp", 30 ] 31 32 configs = [ "//base/security/access_token/config:coverage_flags" ] 33 34 deps = [ 35 "//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken", 36 "//third_party/bounds_checking_function:libsec_static", 37 "//third_party/cJSON:cjson_static", 38 "//third_party/googletest:gmock", 39 "//third_party/googletest:gtest", 40 ] 41} 42 43ohos_unittest("libnativetoken_mock_test") { 44 subsystem_name = "security" 45 part_name = "access_token" 46 module_out_path = part_name + "/" + part_name 47 48 include_dirs = [ 49 "//base/security/access_token/interfaces/innerkits/nativetoken/test/mock/include/", 50 "//third_party/bounds_checking_function/include", 51 "//base/security/access_token/interfaces/innerkits/nativetoken/include", 52 ] 53 54 sources = [ 55 "//base/security/access_token/interfaces/innerkits/nativetoken/src/nativetoken.c", 56 "//base/security/access_token/interfaces/innerkits/nativetoken/src/nativetoken_json_oper.c", 57 "//base/security/access_token/interfaces/innerkits/nativetoken/test/mock/src/cJSON.c", 58 "//base/security/access_token/interfaces/innerkits/nativetoken/test/unittest/mock/nativetoken_oper_test.cpp", 59 ] 60 61 configs = [ "//base/security/access_token/config:coverage_flags" ] 62 63 deps = [ 64 "//third_party/bounds_checking_function:libsec_static", 65 "//third_party/googletest:gmock", 66 "//third_party/googletest:gtest", 67 ] 68 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 69} 70 71group("unittest") { 72 testonly = true 73 deps = [ 74 ":libnativetoken_mock_test", 75 ":libnativetoken_test", 76 ] 77} 78