# Copyright (c) 2021-2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/test.gni") import("../../../../access_token.gni") ohos_unittest("libaccesstoken_sdk_test") { subsystem_name = "security" part_name = "access_token" module_out_path = part_name + "/" + part_name include_dirs = [ "${access_token_path}/frameworks/accesstoken/include", "${access_token_path}/frameworks/common/include", "../include", "../src", "${access_token_path}/interfaces/innerkits/nativetoken/include", "${access_token_path}/interfaces/innerkits/token_setproc/include", "//third_party/googletest/include", ] sources = [ "unittest/src/accesstoken_deny_test.cpp", "unittest/src/accesstoken_kit_extension_test.cpp", "unittest/src/accesstoken_kit_test.cpp", "unittest/src/remote_token_kit_test.cpp", "unittest/src/security_component_grant_test.cpp", ] cflags_cc = [ "-DHILOG_ENABLE" ] configs = [ "${access_token_path}/config:coverage_flags" ] deps = [ "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx", "${access_token_path}/interfaces/innerkits/nativetoken:libnativetoken", "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc", "../:libaccesstoken_sdk", "../:libtokenid_sdk", ] external_deps = [ "c_utils:utils", "dsoftbus:softbus_client", "hilog:libhilog", "ipc:ipc_single", ] if (token_sync_enable == true) { cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ] } } ohos_unittest("accesstoken_mock_test") { subsystem_name = "security" part_name = "access_token" module_out_path = part_name + "/" + part_name include_dirs = [ "${access_token_path}/frameworks/common/include", "${access_token_path}/frameworks/accesstoken/include", "${access_token_path}/frameworks/tokensync/include", "${access_token_path}/interfaces/innerkits/nativetoken/include", "../../token_setproc/include", "../include", "../src", "//third_party/googletest/include", ] sources = [ "../src/accesstoken_death_recipient.cpp", "../src/accesstoken_kit.cpp", "../src/accesstoken_manager_client.cpp", "../src/accesstoken_manager_proxy.cpp", "../src/perm_state_change_callback_customize.cpp", "../src/permission_state_change_callback.cpp", "../src/permission_state_change_callback_stub.cpp", "mock/src/iservice_registry.cpp", "unittest/accesstoken_mock_test/accesstoken_kit_test.cpp", ] cflags_cc = [ "-DHILOG_ENABLE" ] configs = [ "${access_token_path}/config:coverage_flags" ] deps = [ "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx", "${access_token_path}/frameworks/common:accesstoken_common_cxx", "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc", "../:libtokenid_sdk", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "eventhandler:libeventhandler", "hilog:libhilog", "hisysevent:libhisysevent", "init:libbeget_proxy", "init:libbegetutil", "ipc:ipc_core", "ipc:libdbinder", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (token_sync_enable == true) { cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ] } } group("unittest") { testonly = true deps = [ ":accesstoken_mock_test", ":libaccesstoken_sdk_test", ] }