1# Copyright (c) 2022-2025 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 17if (is_standard_system && ability_base_enable == true) { 18 ohos_unittest("libprivacy_manager_service_standard_test") { 19 subsystem_name = "accesscontrol" 20 module_out_path = module_output_path_unittest_privacy 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/common/include", 30 "${access_token_path}/frameworks/privacy/include", 31 "${access_token_path}/interfaces/innerkits/accesstoken/include", 32 "${access_token_path}/interfaces/innerkits/privacy/include", 33 "${access_token_path}/interfaces/innerkits/nativetoken/include", 34 "${access_token_path}/interfaces/innerkits/privacy/test/unittest/src", 35 "${access_token_path}/interfaces/innerkits/privacy/src", 36 "${access_token_path}/interfaces/innerkits/proxy_death/include", 37 "${access_token_path}/services/common/app_manager/include", 38 "${access_token_path}/services/common/json_parse/include", 39 "${access_token_path}/services/common/database/include", 40 "${access_token_path}/services/common/handler/include", 41 "${access_token_path}/services/common/libraryloader/include", 42 "${access_token_path}/services/common/screenlock_manager/include", 43 "${access_token_path}/services/common/utils/include", 44 "${access_token_path}/services/privacymanager/include/active", 45 "${access_token_path}/services/privacymanager/include/common", 46 "${access_token_path}/services/privacymanager/include/database", 47 "${access_token_path}/services/privacymanager/include/record", 48 "${access_token_path}/services/privacymanager/include/service", 49 "${access_token_path}/services/privacymanager/include/proxy", 50 "${access_token_path}/services/privacymanager/include/sensitive/audio_manager", 51 "${access_token_path}/services/privacymanager/include/sensitive/camera_manager", 52 "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", 53 ] 54 55 sources = [ 56 "${access_token_path}/interfaces/innerkits/privacy/test/unittest/src/privacy_test_common.cpp", 57 "${access_token_path}/services/common/libraryloader/src/libraryloader.cpp", 58 "../../src/active/active_status_callback_manager.cpp", 59 "../../src/active/perm_active_status_callback_death_recipient.cpp", 60 "../../src/active/perm_active_status_change_callback_proxy.cpp", 61 "../../src/active/state_change_callback_proxy.cpp", 62 "../../src/common/access_token_helper.cpp", 63 "../../src/common/constant.cpp", 64 "../../src/database/data_translator.cpp", 65 "../../src/database/permission_used_record_db.cpp", 66 "../../src/database/privacy_field_const.cpp", 67 "../../src/proxy/privacy_manager_proxy_death_param.cpp", 68 "../../src/record/on_permission_used_record_callback_proxy.cpp", 69 "../../src/record/permission_record.cpp", 70 "../../src/record/permission_record_manager.cpp", 71 "../../src/record/permission_record_set.cpp", 72 "../../src/sensitive/audio_manager/audio_manager_adapter.cpp", 73 "../../src/sensitive/camera_manager/camera_manager_adapter.cpp", 74 "../../src/service/privacy_manager_service.cpp", 75 "active_status_callback_manager_test.cpp", 76 "permission_record_db_test.cpp", 77 "permission_record_manager_test.cpp", 78 "permission_record_set_test.cpp", 79 "privacy_manager_proxy_death_test.cpp", 80 "privacy_manager_service_test.cpp", 81 "sensitive_manager_test.cpp", 82 ] 83 84 cflags_cc = [ 85 "-DHILOG_ENABLE", 86 "-DMAX_COUNT_TEST", 87 ] 88 89 configs = [ 90 "${access_token_path}/config:coverage_flags", 91 "${access_token_path}/services/privacymanager:privacy_manager_gen_config", 92 ] 93 94 deps = [ 95 "${access_token_path}/frameworks/common:accesstoken_common_cxx", 96 "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx", 97 "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", 98 "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk", 99 "${access_token_path}/interfaces/innerkits/nativetoken:libnativetoken_shared", 100 "${access_token_path}/interfaces/innerkits/privacy:libprivacy_sdk", 101 "${access_token_path}/interfaces/innerkits/token_setproc:libtokensetproc_shared", 102 "${access_token_path}/services/common:accesstoken_service_common", 103 "${access_token_path}/services/common/proxy_death:proxy_death_handler", 104 "${access_token_path}/services/common/proxy_death:proxy_death_stub", 105 "${access_token_path}/services/privacymanager:privacy_manager_service", 106 "${access_token_path}/services/privacymanager:privacy_manager_stub", 107 ] 108 109 external_deps = [ 110 "ability_base:want", 111 "access_token:libaccesstoken_sdk", 112 "c_utils:utils", 113 "googletest:gtest_main", 114 "hilog:libhilog", 115 "hisysevent:libhisysevent", 116 "init:libbegetutil", 117 "ipc:ipc_core", 118 "safwk:system_ability_fwk", 119 "samgr:samgr_proxy", 120 "sqlite:sqlite", 121 ] 122 123 if (audio_framework_enable) { 124 cflags_cc += [ "-DAUDIO_FRAMEWORK_ENABLE" ] 125 external_deps += [ "audio_framework:audio_client" ] 126 } 127 128 if (camera_framework_enable) { 129 cflags_cc += [ "-DCAMERA_FRAMEWORK_ENABLE" ] 130 external_deps += [ "camera_framework:camera_framework" ] 131 } 132 133 if (eventhandler_enable == true) { 134 cflags_cc += [ "-DEVENTHANDLER_ENABLE" ] 135 external_deps += [ "eventhandler:libeventhandler" ] 136 } 137 if (common_event_service_enable) { 138 cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ] 139 external_deps += [ "common_event_service:cesfwk_innerkits" ] 140 sources += [ "../../src/common/privacy_common_event_subscriber.cpp" ] 141 } 142 if (theme_screenlock_mgr_enable) { 143 cflags_cc += [ "-DTHEME_SCREENLOCK_MGR_ENABLE" ] 144 external_deps += [ "screenlock_mgr:screenlock_client" ] 145 } 146 147 if (access_token_app_security_privacy_service_enable) { 148 cflags_cc += [ "-DAPP_SECURITY_PRIVACY_SERVICE" ] 149 } else { 150 include_dirs += 151 [ "${access_token_path}/services/common/ability_manager/include" ] 152 } 153 154 if (ability_runtime_enable) { 155 external_deps += [ 156 "ability_runtime:ability_manager", 157 "ability_runtime:app_manager", 158 ] 159 include_dirs += 160 [ "${access_token_path}/services/common/ability_manager/include" ] 161 sources += [ "client_code_compare_test.cpp" ] 162 } 163 } 164} 165