1# Copyright (c) 2024-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/appmgrservice" 18 19ohos_unittest("cache_process_manager_second_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_services_path}/appmgr/include", 32 "${ability_runtime_services_path}/appmgr/include/utils", 33 "${ability_runtime_innerkits_path}/ability_manager/include", 34 "${ability_runtime_services_path}/common/include", 35 "${ability_runtime_path}/tools/aa/include", 36 "${ability_runtime_path}/utils/global/time/include", 37 "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper", 38 "${ability_runtime_utils_path}/global/constant", 39 ] 40 41 sources = [ 42 "${ability_runtime_path}/tools/aa/src/shell_command_result.cpp", 43 "${ability_runtime_path}/tools/aa/src/test_observer_proxy.cpp", 44 "${ability_runtime_services_path}/appmgr/src/ability_running_record.cpp", 45 "${ability_runtime_services_path}/appmgr/src/advanced_security_mode_manager.cpp", 46 "${ability_runtime_services_path}/appmgr/src/ams_mgr_scheduler.cpp", 47 "${ability_runtime_services_path}/appmgr/src/app_config_data_manager.cpp", 48 "${ability_runtime_services_path}/appmgr/src/app_death_recipient.cpp", 49 "${ability_runtime_services_path}/appmgr/src/app_debug_manager.cpp", 50 "${ability_runtime_services_path}/appmgr/src/app_lifecycle_deal.cpp", 51 "${ability_runtime_services_path}/appmgr/src/app_mgr_event.cpp", 52 "${ability_runtime_services_path}/appmgr/src/app_mgr_service.cpp", 53 "${ability_runtime_services_path}/appmgr/src/app_mgr_service_event_handler.cpp", 54 "${ability_runtime_services_path}/appmgr/src/app_mgr_service_inner.cpp", 55 "${ability_runtime_services_path}/appmgr/src/app_native_spawn_manager.cpp", 56 "${ability_runtime_services_path}/appmgr/src/app_preloader.cpp", 57 "${ability_runtime_services_path}/appmgr/src/app_running_manager.cpp", 58 "${ability_runtime_services_path}/appmgr/src/app_running_status_module.cpp", 59 "${ability_runtime_services_path}/appmgr/src/app_spawn_client.cpp", 60 "${ability_runtime_services_path}/appmgr/src/app_state_observer_manager.cpp", 61 "${ability_runtime_services_path}/appmgr/src/cache_process_manager.cpp", 62 "${ability_runtime_services_path}/appmgr/src/exit_resident_process_manager.cpp", 63 "${ability_runtime_services_path}/appmgr/src/killing_process_manager.cpp", 64 "${ability_runtime_services_path}/appmgr/src/modal_system_app_freeze_uiextension.cpp", 65 "${ability_runtime_services_path}/appmgr/src/module_running_record.cpp", 66 "${ability_runtime_services_path}/appmgr/src/multi_user_config_mgr.cpp", 67 "${ability_runtime_services_path}/appmgr/src/quick_fix_callback_with_record.cpp", 68 "${ability_runtime_services_path}/appmgr/src/remote_client_manager.cpp", 69 "${ability_runtime_services_path}/appmgr/src/render_record.cpp", 70 "${ability_runtime_services_path}/appmgr/src/render_state_observer_manager.cpp", 71 "${ability_runtime_services_path}/appmgr/src/user_record_manager.cpp", 72 "${ability_runtime_services_path}/appmgr/src/window_focus_changed_listener.cpp", 73 "${ability_runtime_services_path}/appmgr/src/window_pid_visibility_changed_listener.cpp", 74 "${ability_runtime_services_path}/appmgr/src/window_visibility_changed_listener.cpp", 75 "cache_process_manager_second_test.cpp", 76 "mock/src/moc_res_sched_util.cpp", 77 "mock/src/mock_app_running_record.cpp", 78 "mock/src/mock_my_status.cpp", 79 ] 80 81 defines = [ "AMS_LOG_TAG = \"AppMgrService\"" ] 82 defines += [ "AMS_LOG_DOMAIN = 0xD001303" ] 83 defines += [ "OHOS_ACCOUNT_ENABLED" ] 84 defines += [ "INCLUDE_ZURI" ] 85 86 if (product_name != "ohcore") { 87 defines += [ "APP_MGR_SERVICE_APPMS" ] 88 } 89 90 if (ability_command_for_test) { 91 defines += [ "ABILITY_COMMAND_FOR_TEST" ] 92 } 93 94 if (ability_fault_and_exit_test) { 95 defines += [ "ABILITY_FAULT_AND_EXIT_TEST" ] 96 } 97 98 if (ability_runtime_check_internet_permission) { 99 defines += [ "ABILITY_PLATFORM_CHECK_PERMISSION" ] 100 } 101 102 configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] 103 104 cflags = [] 105 if (target_cpu == "arm") { 106 cflags += [ "-DBINDER_IPC_32BIT" ] 107 } 108 deps = [ 109 "${ability_runtime_innerkits_path}/ability_manager:ability_manager", 110 "${ability_runtime_innerkits_path}/app_manager:app_manager", 111 "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", 112 "${ability_runtime_native_path}/appkit:appkit_manager_helper", 113 "${ability_runtime_path}/utils/global/freeze:freeze_util", 114 "${ability_runtime_path}/utils/server/startup:startup_util", 115 "${ability_runtime_services_path}/common:app_util", 116 "${ability_runtime_services_path}/common:event_report", 117 "${ability_runtime_services_path}/common:record_cost_time_util", 118 "${ability_runtime_services_path}/common:perm_verification", 119 "${ability_runtime_services_path}/common:res_sched_util", 120 "${ability_runtime_services_path}/common:task_handler_wrap", 121 ] 122 123 external_deps = [ 124 "ability_base:base", 125 "ability_base:configuration", 126 "ability_base:want", 127 "ability_base:zuri", 128 "access_token:libaccesstoken_sdk", 129 "appspawn:appspawn_client", 130 "bundle_framework:appexecfwk_base", 131 "bundle_framework:appexecfwk_core", 132 "c_utils:utils", 133 "common_event_service:cesfwk_core", 134 "common_event_service:cesfwk_innerkits", 135 "eventhandler:libeventhandler", 136 "ffrt:libffrt", 137 "googletest:gmock_main", 138 "googletest:gtest_main", 139 "hicollie:libhicollie", 140 "hilog:libhilog", 141 "hisysevent:libhisysevent", 142 "hitrace:hitrace_meter", 143 "init:libbeget_proxy", 144 "init:libbegetutil", 145 "ipc:ipc_core", 146 "json:nlohmann_json_static", 147 "kv_store:distributeddata_inner", 148 "memmgr:memmgrclient", 149 "memory_utils:libmeminfo", 150 "os_account:libaccountkits", 151 "os_account:os_account_innerkits", 152 "resource_schedule_service:ressched_client", 153 "safwk:system_ability_fwk", 154 "samgr:samgr_proxy", 155 "window_manager:session_manager_lite", 156 ] 157 158 public_external_deps = [ "kv_store:distributeddata_mgr" ] 159 160 if (product_name != "ohcore") { 161 external_deps += [ "netmanager_base:net_conn_manager_if" ] 162 } 163 164 if (ability_runtime_feature_sandboxmanager) { 165 external_deps += [ "sandbox_manager:libsandbox_manager_sdk" ] 166 defines += [ "ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER" ] 167 } 168 169 if (ability_runtime_child_process) { 170 defines += [ "SUPPORT_CHILD_PROCESS" ] 171 sources += [ 172 "${ability_runtime_services_path}/appmgr/src/child_process_record.cpp", 173 ] 174 } 175 176 if (ability_runtime_graphics) { 177 defines += [ 178 "SUPPORT_GRAPHICS", 179 "SUPPORT_SCREEN", 180 ] 181 182 deps += [] 183 external_deps += [ 184 "i18n:i18n_sa_client", 185 "i18n:intl_util", 186 "window_manager:libwm", 187 "window_manager:libwsutils", 188 ] 189 } 190 if (ability_runtime_upms) { 191 defines += [ "SUPPORT_UPMS" ] 192 deps += [ 193 "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr", 194 ] 195 } 196 cflags_cc = [] 197 if (os_dlp_part_enabled) { 198 cflags_cc += [ "-DWITH_DLP" ] 199 } 200 if (background_task_mgr_continuous_task_enable) { 201 defines += [ "BGTASKMGR_CONTINUOUS_TASK_ENABLE" ] 202 } 203 204 if (is_asan || asan_detector) { 205 defines += [ "SUPPORT_ASAN" ] 206 } 207 208 if (ability_runtime_app_no_response_dialog) { 209 defines += [ "APP_NO_RESPONSE_DIALOG" ] 210 } 211 if (app_mgr_service_hicollie_enable) { 212 defines += [ "APP_MGR_SERVICE_HICOLLIE_ENABLE" ] 213 } 214 cflags += [ "-DAPP_NO_RESPONSE_BUNDLENAME=\"${ability_runtime_app_no_response_bundlename}\"" ] 215} 216 217group("unittest") { 218 testonly = true 219 deps = [ ":cache_process_manager_second_test" ] 220} 221