• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 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/unittest"
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_test.cpp",
61    "src/work_sched_config_test.cpp",
62    "src/work_sched_data_manager_test.cpp",
63    "src/work_status_test.cpp",
64    "src/workschedulerservice_test.cpp",
65    "src/zidl/work_scheduler_proxy_test.cpp",
66  ]
67
68  deps = [
69    "${worksched_frameworks_path}:workschedclient",
70    "${worksched_frameworks_path}/extension:workschedextension",
71    "${worksched_service_path}:workschedservice_static",
72    "${worksched_utils_path}:workschedutils",
73    "${worksched_zidl_path}:workschedservice_zidl_proxy",
74  ]
75
76  external_deps = [
77    "ability_base:want",
78    "ability_runtime:ability_manager",
79    "ability_runtime:app_manager",
80    "bundle_framework:appexecfwk_base",
81    "bundle_framework:appexecfwk_core",
82    "c_utils:utils",
83    "common_event_service:cesfwk_innerkits",
84    "eventhandler:libeventhandler",
85    "ffrt:libffrt",
86    "hilog:libhilog",
87    "hisysevent:libhisysevent",
88    "ipc:ipc_single",
89    "jsoncpp:jsoncpp",
90    "safwk:system_ability_fwk",
91    "samgr:samgr_proxy",
92  ]
93  defines = []
94  if (bundle_active_enable) {
95    external_deps += [ "device_usage_statistics:usagestatsinner" ]
96    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
97  }
98  if (device_standby_enable) {
99    external_deps += [ "device_standby:standby_innerkits" ]
100    defines += [ "DEVICE_STANDBY_ENABLE" ]
101  }
102  if (resourceschedule_bgtaskmgr_enable) {
103    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
104    defines += [ "RESOURCESCHEDULE_BGTASKMGR_ENABLE" ]
105  }
106  if (powermgr_battery_manager_enable) {
107    external_deps += [ "battery_manager:batterysrv_client" ]
108    defines += [ "POWERMGR_BATTERY_MANAGER_ENABLE" ]
109  }
110  if (powermgr_thermal_manager_enable) {
111    external_deps += [ "thermal_manager:thermalsrv_client" ]
112    defines += [ "POWERMGR_THERMAL_MANAGER_ENABLE" ]
113  }
114  if (powermgr_power_manager_enable) {
115    external_deps += [ "power_manager:powermgr_client" ]
116    defines += [ "POWERMGR_POWER_MANAGER_ENABLE" ]
117  }
118  if (workscheduler_with_communication_netmanager_base_enable) {
119    defines += [ "COMMUNICATION_NETMANAGER_BASE_ENABLE" ]
120    external_deps += [ "netmanager_base:net_conn_manager_if" ]
121  }
122}
123
124group("unittest") {
125  testonly = true
126  deps = []
127  deps += [
128    # deps file
129    ":WorkScheduleServiceTest",
130  ]
131}
132