• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 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("../../../powermgr.gni")
16
17module_output_path = "power_manager/power_manager"
18
19##############################fuzztest##########################################
20ohos_fuzztest("LockScreenAfterTimingOutFuzzTest") {
21  module_out_path = module_output_path
22  fuzz_config_file =
23      "${powermgr_root_path}/test/fuzztest/lockscreenaftertimingout_fuzzer"
24
25  include_dirs = [
26    "${powermgr_service_path}/native/src/hibernate",
27    "${powermgr_service_path}/native/src/proximity_sensor_controller",
28    "${powermgr_service_path}/native/src/runninglock",
29    "${powermgr_service_path}/native/src/shutdown",
30    "${powermgr_service_path}/native/src/suspend",
31    "${powermgr_service_path}/native/src/wakeup",
32    "${powermgr_service_path}/native/src/screenoffpre",
33    "../power_utils",
34  ]
35
36  if (power_manager_feature_wakeup_action) {
37    include_dirs += [ "${powermgr_service_path}/native/src/wakeup_action" ]
38  }
39
40  configs = [
41    "${powermgr_utils_path}:coverage_flags",
42    "${powermgr_utils_path}:utils_config",
43  ]
44
45  cflags = [
46    "-g",
47    "-O0",
48    "-Wno-unused-variable",
49    "-fno-omit-frame-pointer",
50  ]
51  sources = [
52    "../power_utils/power_fuzzer.cpp",
53    "./lockscreenaftertimingout_fuzzer_test.cpp",
54  ]
55  deps = [
56    "${powermgr_service_path}:powermgr_stub",
57    "${powermgr_service_path}:powermgrservice",
58    "${powermgr_service_path}/native/src/actions:powermgr_actions",
59  ]
60
61  external_deps = [
62    "ability_runtime:ability_manager",
63    "c_utils:utils",
64    "ffrt:libffrt",
65    "hilog:libhilog",
66    "input:libmmi-client",
67    "ipc:ipc_core",
68    "jsoncpp:jsoncpp",
69    "power_manager:power_ffrt",
70  ]
71  defines = []
72
73  if (has_hiviewdfx_hisysevent_part) {
74    external_deps += [ "hisysevent:libhisysevent" ]
75  }
76
77  if (has_hiviewdfx_hitrace_part) {
78    external_deps += [ "hitrace:hitrace_meter" ]
79  }
80
81  if (power_manager_feature_movement) {
82    defines += [ "MSDP_MOVEMENT_ENABLE" ]
83  }
84
85  if (use_libfuzzer) {
86    defines += [ "FUZZ_TEST" ]
87  }
88
89  if (power_manager_feature_screen_on_timeout_check) {
90    defines += [ "SCREEN_ON_TIMEOUT_CHECK" ]
91    external_deps += [
92      "ability_runtime:app_manager",
93      "window_manager:libwm",
94    ]
95  }
96
97  if (has_display_manager_part) {
98    defines += [ "HAS_DISPLAY_MANAGER" ]
99    external_deps += [
100      "display_manager:displaymgr",
101      "window_manager:libdm_lite",
102    ]
103  }
104
105  if (has_device_standby_part) {
106    external_deps += [ "device_standby:standby_innerkits" ]
107  }
108
109  if (has_multimodalinput_input_part) {
110    external_deps += [ "input:libmmi-client" ]
111  }
112
113  if (has_sensors_sensor_part) {
114    external_deps += [ "sensor:sensor_interface_native" ]
115  }
116
117  if (power_manager_feature_poweroff_charge && defined(global_parts_info) &&
118      defined(global_parts_info.powermgr_battery_manager)) {
119    defines += [ "POWER_MANAGER_POWEROFF_CHARGE" ]
120    external_deps += [ "battery_manager:batterysrv_client" ]
121  }
122
123  if (power_manager_feature_doubleclick) {
124    defines += [ "POWER_DOUBLECLICK_ENABLE" ]
125  }
126
127  if (power_manager_feature_pickup) {
128    defines += [ "POWER_PICKUP_ENABLE" ]
129  }
130
131  if (power_manager_feature_power_dialog) {
132    defines += [ "POWER_MANAGER_POWER_DIALOG" ]
133  }
134
135  if (power_manager_feature_force_sleep_broadcast) {
136    defines += [ "POWER_MANAGER_ENABLE_FORCE_SLEEP_BROADCAST" ]
137  }
138
139  if (power_manager_feature_charging_type_setting &&
140      defined(global_parts_info) &&
141      defined(global_parts_info.powermgr_battery_manager)) {
142    defines += [ "POWER_MANAGER_ENABLE_CHARGING_TYPE_SETTING" ]
143    external_deps += [ "battery_manager:batterysrv_client" ]
144  }
145
146  if (power_manager_feature_external_screen_management) {
147    defines += [ "POWER_MANAGER_ENABLE_EXTERNAL_SCREEN_MANAGEMENT" ]
148  }
149
150  if (factory == true) {
151    defines += [ "CONFIG_FACTORY_MODE" ]
152  }
153}
154