# Copyright (c) 2022-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("libprivacy_sdk_test") { subsystem_name = "security" part_name = "access_token" module_out_path = part_name + "/" + part_name include_dirs = [ "../src", "${access_token_path}/frameworks/privacy/include", "${access_token_path}/interfaces/innerkits/accesstoken/include", "${access_token_path}/interfaces/innerkits/nativetoken/include", "${access_token_path}/interfaces/innerkits/privacy/include", "${access_token_path}/interfaces/innerkits/token_setproc/include", "//third_party/googletest/include", ] sources = [ "unittest/src/permission_deny_test.cpp", "unittest/src/privacy_kit_test.cpp", ] cflags_cc = [ "-DHILOG_ENABLE" ] if (security_component_enhance_enable == true) { cflags_cc += [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ] } configs = [ "${access_token_path}/config:coverage_flags" ] deps = [ "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx", "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", "${access_token_path}/interfaces/innerkits/nativetoken:libnativetoken", "${access_token_path}/interfaces/innerkits/privacy:libprivacy_sdk", "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc", ] external_deps = [ "c_utils:utils", "init:libbegetutil", "ipc:ipc_core", ] } ohos_unittest("libprivacy_mock_test") { subsystem_name = "security" part_name = "access_token" module_out_path = part_name + "/" + part_name include_dirs = [ "../include", "../src", "${access_token_path}/frameworks/privacy/include", "${access_token_path}/frameworks/common/include", "${access_token_path}/frameworks/accesstoken/include", "${access_token_path}/frameworks/tokensync/include", "${access_token_path}/interfaces/innerkits/accesstoken/include", "${access_token_path}/interfaces/innerkits/nativetoken/include", "//third_party/googletest/include", ] sources = [ "../src/on_permission_used_record_callback_stub.cpp", "../src/perm_active_status_change_callback.cpp", "../src/perm_active_status_change_callback_stub.cpp", "../src/perm_active_status_customized_cbk.cpp", "../src/privacy_death_recipient.cpp", "../src/privacy_kit.cpp", "../src/privacy_manager_client.cpp", "../src/privacy_manager_proxy.cpp", "../src/state_change_callback.cpp", "../src/state_change_callback_stub.cpp", "../src/state_customized_cbk.cpp", "mock/src/iservice_registry.cpp", "unittest/privacy_mock_test/privacy_kit_test.cpp", ] configs = [ "${access_token_path}/config:coverage_flags" ] deps = [ "${access_token_path}/frameworks/common:accesstoken_common_cxx", "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx", "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", "${access_token_path}/interfaces/innerkits/nativetoken:libnativetoken", "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc", "//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", ] cflags_cc = [ "-DHILOG_ENABLE", "-DDEBUG_API_PERFORMANCE", ] } group("unittest") { testonly = true deps = [ ":libprivacy_mock_test", ":libprivacy_sdk_test", ] }