# Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/config/features.gni") import("//build/test.gni") import("//foundation/resourceschedule/work_scheduler/workscheduler.gni") module_output_path = "work_scheduler/unittest" config("worksched_private_config") { include_dirs = [ "${worksched_service_path}/zidl/include", "${worksched_service_path}/native/include", ] } ohos_unittest("WorkScheduleServiceTest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } cflags_cc = [ "-Dprivate=public", "-Dprotected=public", ] module_out_path = module_output_path configs = [ ":worksched_private_config" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "src/conditions/network_listener_test.cpp", "src/conditions/screen_listener_test.cpp", "src/event_publisher_test.cpp", "src/policy/app_data_clear_listener_test.cpp", "src/policy/cpu_policy_test.cpp", "src/watchdog_test.cpp", "src/work_conn_manager_test.cpp", "src/work_policy_manager_test.cpp", "src/work_sched_config_test.cpp", "src/work_sched_data_manager_test.cpp", "src/work_status_test.cpp", "src/workschedulerservice_test.cpp", "src/zidl/work_scheduler_proxy_test.cpp", ] deps = [ "${worksched_frameworks_path}:workschedclient", "${worksched_frameworks_path}/extension:workschedextension", "${worksched_service_path}:workschedservice_static", "${worksched_utils_path}:workschedutils", "//third_party/jsoncpp", ] external_deps = [ "ability_base:want", "ability_runtime:ability_manager", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "hisysevent:libhisysevent", "ipc:ipc_single", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] defines = [] if (bundle_active_enable) { external_deps += [ "device_usage_statistics:usagestatsinner" ] defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] } if (device_standby_enable) { external_deps += [ "device_standby:standby_innerkits" ] defines += [ "DEVICE_STANDBY_ENABLE" ] } if (resourceschedule_bgtaskmgr_enable) { external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] defines += [ "RESOURCESCHEDULE_BGTASKMGR_ENABLE" ] } if (powermgr_battery_manager_enable) { external_deps += [ "battery_manager:batterysrv_client" ] defines += [ "POWERMGR_BATTERY_MANAGER_ENABLE" ] } if (powermgr_thermal_manager_enable) { external_deps += [ "thermal_manager:thermalsrv_client" ] defines += [ "POWERMGR_THERMAL_MANAGER_ENABLE" ] } if (powermgr_power_manager_enable) { external_deps += [ "power_manager:powermgr_client" ] defines += [ "POWERMGR_POWER_MANAGER_ENABLE" ] } if (workscheduler_with_communication_netmanager_base_enable) { defines += [ "COMMUNICATION_NETMANAGER_BASE_ENABLE" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] } } group("unittest") { testonly = true deps = [] deps += [ # deps file ":WorkScheduleServiceTest", ] }