1# Copyright (c) 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("//foundation/ability/ability_runtime/ability_runtime.gni") 16 17module_output_path = "ability_runtime/ability_runtime/appmgr" 18 19ohos_unittest("app_mgr_service_fourth_test") { 20 sanitize = { 21 cfi = true 22 cfi_cross_dso = true 23 debug = false 24 blocklist = "../../cfi_blocklist.txt" 25 } 26 branch_protector_ret = "pac_ret" 27 module_out_path = module_output_path 28 29 include_dirs = [ 30 "mock/include", 31 "${ability_runtime_test_path}/mock/services_appmgr_test/include", 32 "${ability_runtime_test_path}/mock/task_handler_wrap_mock/include", 33 "${ability_runtime_test_path}/mock/mock_appmgr_service/include", 34 "${ability_runtime_test_path}/mock/common/include", 35 "${ability_runtime_test_path}/mock/mock_sa_call", 36 ] 37 38 sources = [ 39 "${ability_runtime_services_path}/appmgr/src/cache_process_manager.cpp", 40 "app_mgr_service_fourth_test.cpp", 41 "mock/src/mock_ipc_skeleton.cpp", 42 "mock/src/mock_my_status.cpp", 43 "mock/src/mock_permission_verification.cpp", 44 "mock/src/mock_app_running_record.cpp", 45 "mock/src/mock_remote_client_manager.cpp", 46 "mock/src/mock_bundle_mgr_helper.cpp", 47 "mock/src/mock_accesstoken_kit.cpp", 48 ] 49 50 configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] 51 52 cflags = [ 53 "-Dprivate=public", 54 "-Dprotected=public", 55 ] 56 57 deps = [ 58 "${ability_runtime_innerkits_path}/runtime:runtime", 59 "${ability_runtime_native_path}/appkit:appkit_native", 60 "${ability_runtime_path}/utils/server/startup:startup_util", 61 "${ability_runtime_services_path}/common:res_sched_util", 62 "${ability_runtime_test_path}/moduletest/common/ams:appmgr_mst_source", 63 "${ability_runtime_services_path}/common:app_util", 64 "${ability_runtime_services_path}/common:record_cost_time_util", 65 "${ability_runtime_services_path}/common:task_handler_wrap", 66 ] 67 68 external_deps = [ 69 "ability_base:configuration", 70 "ability_base:want", 71 "ability_runtime:app_manager", 72 "access_token:libaccesstoken_sdk", 73 "access_token:libnativetoken", 74 "access_token:libtoken_setproc", 75 "appspawn:appspawn_client", 76 "bundle_framework:appexecfwk_base", 77 "bundle_framework:appexecfwk_core", 78 "cJSON:cjson", 79 "c_utils:utils", 80 "eventhandler:libeventhandler", 81 "ffrt:libffrt", 82 "googletest:gmock_main", 83 "googletest:gtest_main", 84 "hilog:libhilog", 85 "hisysevent:libhisysevent", 86 "hitrace:hitrace_meter", 87 "init:libbeget_proxy", 88 "init:libbegetutil", 89 "ipc:ipc_core", 90 "napi:ace_napi", 91 "safwk:system_ability_fwk", 92 "samgr:samgr_proxy", 93 "selinux_adapter:librestorecon", 94 ] 95 96 defines = [] 97 if (background_task_mgr_continuous_task_enable) { 98 defines += [ "BGTASKMGR_CONTINUOUS_TASK_ENABLE" ] 99 } 100 101 if (ability_command_for_test) { 102 defines += [ "ABILITY_COMMAND_FOR_TEST" ] 103 } 104 105 if (ability_runtime_child_process) { 106 defines += [ "SUPPORT_CHILD_PROCESS" ] 107 } 108 109 if (ability_runtime_graphics) { 110 external_deps += [ "window_manager:libwm" ] 111 } 112} 113 114group("unittest") { 115 testonly = true 116 117 deps = [ ":app_mgr_service_fourth_test" ] 118} 119