1# Copyright (c) 2023-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/config/features.gni") 15import("//build/test.gni") 16import("//foundation/resourceschedule/work_scheduler/workscheduler.gni") 17 18module_output_path = "work_scheduler/work_scheduler" 19config("worksched_private_config") { 20 include_dirs = [ 21 "${worksched_service_path}/zidl/include", 22 "${worksched_service_path}/native/include", 23 ] 24} 25 26ohos_unittest("WorkScheduleServiceTest") { 27 sanitize = { 28 cfi = true 29 cfi_cross_dso = true 30 debug = false 31 } 32 cflags_cc = [ 33 "-Dprivate=public", 34 "-Dprotected=public", 35 ] 36 module_out_path = module_output_path 37 configs = [ ":worksched_private_config" ] 38 cflags = [ 39 "-g", 40 "-O0", 41 "-Wno-unused-variable", 42 "-fno-omit-frame-pointer", 43 ] 44 sources = [ 45 "src/conditions/group_listener_test.cpp", 46 "src/conditions/network_listener_test.cpp", 47 "src/conditions/screen_listener_test.cpp", 48 "src/conditions/storage_listener_test.cpp", 49 "src/conditions/timer_listener_test.cpp", 50 "src/event_publisher_test.cpp", 51 "src/policy/app_data_clear_listener_test.cpp", 52 "src/policy/cpu_policy_test.cpp", 53 "src/policy/memory_policy_test.cpp", 54 "src/policy/power_mode_policy_test.cpp", 55 "src/policy/thermal_policy_test.cpp", 56 "src/scheduler_bg_task_subscriber_test.cpp", 57 "src/watchdog_test.cpp", 58 "src/work_conn_manager_test.cpp", 59 "src/work_policy_manager_test.cpp", 60 "src/work_queue_manager_test.cpp", 61 "src/work_queue_test.cpp", 62 "src/work_sched_config_test.cpp", 63 "src/work_sched_data_manager_test.cpp", 64 "src/work_scheduler_connection_test.cpp", 65 "src/work_standby_state_change_callback_test.cpp", 66 "src/work_status_test.cpp", 67 "src/workschedulerservice_test.cpp", 68 "src/zidl/work_scheduler_proxy_test.cpp", 69 ] 70 71 deps = [ 72 "${worksched_frameworks_path}:workschedclient", 73 "${worksched_frameworks_path}/extension:workschedextension", 74 "${worksched_service_path}:workschedservice_static", 75 "${worksched_utils_path}:workschedutils", 76 "${worksched_zidl_path}:workschedservice_zidl_proxy", 77 ] 78 79 external_deps = [ 80 "ability_base:want", 81 "ability_runtime:ability_manager", 82 "ability_runtime:app_manager", 83 "access_token:libaccesstoken_sdk", 84 "access_token:libtoken_setproc", 85 "bundle_framework:appexecfwk_base", 86 "bundle_framework:appexecfwk_core", 87 "c_utils:utils", 88 "common_event_service:cesfwk_innerkits", 89 "eventhandler:libeventhandler", 90 "ffrt:libffrt", 91 "googletest:gmock_main", 92 "hilog:libhilog", 93 "hisysevent:libhisysevent", 94 "ipc:ipc_single", 95 "safwk:system_ability_fwk", 96 "samgr:samgr_proxy", 97 "time_service:time_client", 98 ] 99 defines = [] 100 if (bundle_active_enable) { 101 external_deps += [ "device_usage_statistics:usagestatsinner" ] 102 defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] 103 } 104 if (device_standby_enable) { 105 external_deps += [ "device_standby:standby_innerkits" ] 106 defines += [ "DEVICE_STANDBY_ENABLE" ] 107 } 108 if (resourceschedule_bgtaskmgr_enable) { 109 external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] 110 defines += [ "RESOURCESCHEDULE_BGTASKMGR_ENABLE" ] 111 } 112 if (powermgr_battery_manager_enable) { 113 external_deps += [ "battery_manager:batterysrv_client" ] 114 defines += [ "POWERMGR_BATTERY_MANAGER_ENABLE" ] 115 } 116 if (powermgr_thermal_manager_enable) { 117 external_deps += [ "thermal_manager:thermalsrv_client" ] 118 defines += [ "POWERMGR_THERMAL_MANAGER_ENABLE" ] 119 } 120 if (powermgr_power_manager_enable) { 121 external_deps += [ "power_manager:powermgr_client" ] 122 defines += [ "POWERMGR_POWER_MANAGER_ENABLE" ] 123 } 124 if (workscheduler_with_communication_netmanager_base_enable) { 125 defines += [ "COMMUNICATION_NETMANAGER_BASE_ENABLE" ] 126 external_deps += [ "netmanager_base:net_conn_manager_if" ] 127 } 128} 129 130group("unittest") { 131 testonly = true 132 deps = [] 133 deps += [ 134 # deps file 135 ":WorkScheduleServiceTest", 136 ] 137} 138