1fc0b0055Sopenharmony_ci# Copyright (c) 2024 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_ciif (is_standard_system && ability_base_enable == true) { 18fc0b0055Sopenharmony_ci ohos_unittest("el5_filekey_manager_service_mock_unittest") { 19fc0b0055Sopenharmony_ci subsystem_name = "security" 20fc0b0055Sopenharmony_ci part_name = "access_token" 21fc0b0055Sopenharmony_ci module_out_path = part_name + "/" + part_name 22fc0b0055Sopenharmony_ci sanitize = { 23fc0b0055Sopenharmony_ci cfi = true 24fc0b0055Sopenharmony_ci cfi_cross_dso = true 25fc0b0055Sopenharmony_ci debug = false 26fc0b0055Sopenharmony_ci } 27fc0b0055Sopenharmony_ci branch_protector_ret = "pac_ret" 28fc0b0055Sopenharmony_ci 29fc0b0055Sopenharmony_ci include_dirs = [ 30fc0b0055Sopenharmony_ci "../include", 31fc0b0055Sopenharmony_ci "mock/include", 32fc0b0055Sopenharmony_ci "include", 33fc0b0055Sopenharmony_ci "${access_token_path}/frameworks/el5filekeymanager/include/", 34fc0b0055Sopenharmony_ci ] 35fc0b0055Sopenharmony_ci 36fc0b0055Sopenharmony_ci sources = [ 37fc0b0055Sopenharmony_ci "../src/el5_filekey_manager_service.cpp", 38fc0b0055Sopenharmony_ci "../src/el5_filekey_manager_stub.cpp", 39fc0b0055Sopenharmony_ci "mock/src/mock_ipc.cpp", 40fc0b0055Sopenharmony_ci "src/el5_filekey_manager_service_mock_unittest.cpp", 41fc0b0055Sopenharmony_ci ] 42fc0b0055Sopenharmony_ci 43fc0b0055Sopenharmony_ci configs = [ "${access_token_path}/config:coverage_flags" ] 44fc0b0055Sopenharmony_ci 45fc0b0055Sopenharmony_ci deps = [ 46fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", 47fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk", 48fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/el5filekeymanager:el5_filekey_manager_sdk", 49fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc", 50fc0b0055Sopenharmony_ci "//third_party/googletest:gtest_main", 51fc0b0055Sopenharmony_ci ] 52fc0b0055Sopenharmony_ci 53fc0b0055Sopenharmony_ci external_deps = [ 54fc0b0055Sopenharmony_ci "ability_base:want", 55fc0b0055Sopenharmony_ci "c_utils:utils", 56fc0b0055Sopenharmony_ci "hilog:libhilog", 57fc0b0055Sopenharmony_ci "ipc:ipc_single", 58fc0b0055Sopenharmony_ci "safwk:system_ability_fwk", 59fc0b0055Sopenharmony_ci "samgr:samgr_proxy", 60fc0b0055Sopenharmony_ci ] 61fc0b0055Sopenharmony_ci 62fc0b0055Sopenharmony_ci cflags_cc = [ 63fc0b0055Sopenharmony_ci "-DHILOG_ENABLE", 64fc0b0055Sopenharmony_ci "-DDEBUG_API_PERFORMANCE", 65fc0b0055Sopenharmony_ci ] 66fc0b0055Sopenharmony_ci 67fc0b0055Sopenharmony_ci if (common_event_service_enable) { 68fc0b0055Sopenharmony_ci cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ] 69fc0b0055Sopenharmony_ci external_deps += [ "common_event_service:cesfwk_innerkits" ] 70fc0b0055Sopenharmony_ci sources += [ "../src/el5_filekey_manager_subscriber.cpp" ] 71fc0b0055Sopenharmony_ci } 72fc0b0055Sopenharmony_ci 73fc0b0055Sopenharmony_ci if (eventhandler_enable == true) { 74fc0b0055Sopenharmony_ci cflags_cc += [ "-DEVENTHANDLER_ENABLE" ] 75fc0b0055Sopenharmony_ci external_deps += [ "eventhandler:libeventhandler" ] 76fc0b0055Sopenharmony_ci } 77fc0b0055Sopenharmony_ci 78fc0b0055Sopenharmony_ci if (theme_screenlock_mgr_enable) { 79fc0b0055Sopenharmony_ci cflags_cc += [ "-DTHEME_SCREENLOCK_MGR_ENABLE" ] 80fc0b0055Sopenharmony_ci external_deps += [ "screenlock_mgr:screenlock_client" ] 81fc0b0055Sopenharmony_ci } 82fc0b0055Sopenharmony_ci } 83fc0b0055Sopenharmony_ci 84fc0b0055Sopenharmony_ci ohos_unittest("el5_filekey_manager_service_unittest") { 85fc0b0055Sopenharmony_ci subsystem_name = "security" 86fc0b0055Sopenharmony_ci part_name = "access_token" 87fc0b0055Sopenharmony_ci module_out_path = part_name + "/" + part_name 88fc0b0055Sopenharmony_ci sanitize = { 89fc0b0055Sopenharmony_ci cfi = true 90fc0b0055Sopenharmony_ci cfi_cross_dso = true 91fc0b0055Sopenharmony_ci debug = false 92fc0b0055Sopenharmony_ci } 93fc0b0055Sopenharmony_ci branch_protector_ret = "pac_ret" 94fc0b0055Sopenharmony_ci 95fc0b0055Sopenharmony_ci include_dirs = [ 96fc0b0055Sopenharmony_ci "../include", 97fc0b0055Sopenharmony_ci "include", 98fc0b0055Sopenharmony_ci "${access_token_path}/frameworks/el5filekeymanager/include/", 99fc0b0055Sopenharmony_ci ] 100fc0b0055Sopenharmony_ci 101fc0b0055Sopenharmony_ci sources = [ 102fc0b0055Sopenharmony_ci "../src/el5_filekey_manager_service.cpp", 103fc0b0055Sopenharmony_ci "../src/el5_filekey_manager_stub.cpp", 104fc0b0055Sopenharmony_ci "src/el5_filekey_manager_service_unittest.cpp", 105fc0b0055Sopenharmony_ci ] 106fc0b0055Sopenharmony_ci 107fc0b0055Sopenharmony_ci configs = [ "${access_token_path}/config:coverage_flags" ] 108fc0b0055Sopenharmony_ci 109fc0b0055Sopenharmony_ci deps = [ 110fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", 111fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk", 112fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/el5filekeymanager:el5_filekey_manager_sdk", 113fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc", 114fc0b0055Sopenharmony_ci "//third_party/googletest:gtest_main", 115fc0b0055Sopenharmony_ci ] 116fc0b0055Sopenharmony_ci 117fc0b0055Sopenharmony_ci external_deps = [ 118fc0b0055Sopenharmony_ci "ability_base:want", 119fc0b0055Sopenharmony_ci "c_utils:utils", 120fc0b0055Sopenharmony_ci "hilog:libhilog", 121fc0b0055Sopenharmony_ci "ipc:ipc_single", 122fc0b0055Sopenharmony_ci "safwk:system_ability_fwk", 123fc0b0055Sopenharmony_ci "samgr:samgr_proxy", 124fc0b0055Sopenharmony_ci ] 125fc0b0055Sopenharmony_ci 126fc0b0055Sopenharmony_ci cflags_cc = [ 127fc0b0055Sopenharmony_ci "-DHILOG_ENABLE", 128fc0b0055Sopenharmony_ci "-DDEBUG_API_PERFORMANCE", 129fc0b0055Sopenharmony_ci ] 130fc0b0055Sopenharmony_ci 131fc0b0055Sopenharmony_ci if (common_event_service_enable) { 132fc0b0055Sopenharmony_ci cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ] 133fc0b0055Sopenharmony_ci external_deps += [ "common_event_service:cesfwk_innerkits" ] 134fc0b0055Sopenharmony_ci sources += [ "../src/el5_filekey_manager_subscriber.cpp" ] 135fc0b0055Sopenharmony_ci } 136fc0b0055Sopenharmony_ci 137fc0b0055Sopenharmony_ci if (eventhandler_enable == true) { 138fc0b0055Sopenharmony_ci cflags_cc += [ "-DEVENTHANDLER_ENABLE" ] 139fc0b0055Sopenharmony_ci external_deps += [ "eventhandler:libeventhandler" ] 140fc0b0055Sopenharmony_ci } 141fc0b0055Sopenharmony_ci 142fc0b0055Sopenharmony_ci if (theme_screenlock_mgr_enable) { 143fc0b0055Sopenharmony_ci cflags_cc += [ "-DTHEME_SCREENLOCK_MGR_ENABLE" ] 144fc0b0055Sopenharmony_ci external_deps += [ "screenlock_mgr:screenlock_client" ] 145fc0b0055Sopenharmony_ci } 146fc0b0055Sopenharmony_ci } 147fc0b0055Sopenharmony_ci 148fc0b0055Sopenharmony_ci ohos_unittest("el5_filekey_manager_stub_unittest") { 149fc0b0055Sopenharmony_ci subsystem_name = "security" 150fc0b0055Sopenharmony_ci part_name = "access_token" 151fc0b0055Sopenharmony_ci module_out_path = part_name + "/" + part_name 152fc0b0055Sopenharmony_ci sanitize = { 153fc0b0055Sopenharmony_ci cfi = true 154fc0b0055Sopenharmony_ci cfi_cross_dso = true 155fc0b0055Sopenharmony_ci debug = false 156fc0b0055Sopenharmony_ci } 157fc0b0055Sopenharmony_ci branch_protector_ret = "pac_ret" 158fc0b0055Sopenharmony_ci 159fc0b0055Sopenharmony_ci include_dirs = [ 160fc0b0055Sopenharmony_ci "../include", 161fc0b0055Sopenharmony_ci "include", 162fc0b0055Sopenharmony_ci "${access_token_path}/frameworks/el5filekeymanager/include/", 163fc0b0055Sopenharmony_ci ] 164fc0b0055Sopenharmony_ci 165fc0b0055Sopenharmony_ci sources = [ 166fc0b0055Sopenharmony_ci "../src/el5_filekey_manager_service.cpp", 167fc0b0055Sopenharmony_ci "../src/el5_filekey_manager_stub.cpp", 168fc0b0055Sopenharmony_ci "src/el5_filekey_manager_stub_unittest.cpp", 169fc0b0055Sopenharmony_ci ] 170fc0b0055Sopenharmony_ci 171fc0b0055Sopenharmony_ci configs = [ "${access_token_path}/config:coverage_flags" ] 172fc0b0055Sopenharmony_ci 173fc0b0055Sopenharmony_ci deps = [ 174fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", 175fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk", 176fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/el5filekeymanager:el5_filekey_manager_sdk", 177fc0b0055Sopenharmony_ci "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc", 178fc0b0055Sopenharmony_ci "//third_party/googletest:gtest_main", 179fc0b0055Sopenharmony_ci ] 180fc0b0055Sopenharmony_ci 181fc0b0055Sopenharmony_ci external_deps = [ 182fc0b0055Sopenharmony_ci "ability_base:want", 183fc0b0055Sopenharmony_ci "c_utils:utils", 184fc0b0055Sopenharmony_ci "hilog:libhilog", 185fc0b0055Sopenharmony_ci "ipc:ipc_single", 186fc0b0055Sopenharmony_ci "safwk:system_ability_fwk", 187fc0b0055Sopenharmony_ci "samgr:samgr_proxy", 188fc0b0055Sopenharmony_ci ] 189fc0b0055Sopenharmony_ci 190fc0b0055Sopenharmony_ci cflags_cc = [ 191fc0b0055Sopenharmony_ci "-DHILOG_ENABLE", 192fc0b0055Sopenharmony_ci "-DDEBUG_API_PERFORMANCE", 193fc0b0055Sopenharmony_ci ] 194fc0b0055Sopenharmony_ci 195fc0b0055Sopenharmony_ci if (common_event_service_enable) { 196fc0b0055Sopenharmony_ci cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ] 197fc0b0055Sopenharmony_ci external_deps += [ "common_event_service:cesfwk_innerkits" ] 198fc0b0055Sopenharmony_ci sources += [ "../src/el5_filekey_manager_subscriber.cpp" ] 199fc0b0055Sopenharmony_ci } 200fc0b0055Sopenharmony_ci 201fc0b0055Sopenharmony_ci if (eventhandler_enable == true) { 202fc0b0055Sopenharmony_ci cflags_cc += [ "-DEVENTHANDLER_ENABLE" ] 203fc0b0055Sopenharmony_ci external_deps += [ "eventhandler:libeventhandler" ] 204fc0b0055Sopenharmony_ci } 205fc0b0055Sopenharmony_ci 206fc0b0055Sopenharmony_ci if (theme_screenlock_mgr_enable) { 207fc0b0055Sopenharmony_ci cflags_cc += [ "-DTHEME_SCREENLOCK_MGR_ENABLE" ] 208fc0b0055Sopenharmony_ci external_deps += [ "screenlock_mgr:screenlock_client" ] 209fc0b0055Sopenharmony_ci } 210fc0b0055Sopenharmony_ci } 211fc0b0055Sopenharmony_ci 212fc0b0055Sopenharmony_ci group("unittest") { 213fc0b0055Sopenharmony_ci testonly = true 214fc0b0055Sopenharmony_ci deps = [ 215fc0b0055Sopenharmony_ci ":el5_filekey_manager_service_mock_unittest", 216fc0b0055Sopenharmony_ci ":el5_filekey_manager_service_unittest", 217fc0b0055Sopenharmony_ci ":el5_filekey_manager_stub_unittest", 218fc0b0055Sopenharmony_ci ] 219fc0b0055Sopenharmony_ci } 220fc0b0055Sopenharmony_ci} 221