1# Copyright (c) 2022 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/ohos.gni") 15import("//build/test.gni") 16import("../../power.gni") 17 18module_output_path = "drivers_peripheral_power/power" 19power_hdi_service_path = "../../interfaces/hdi_service" 20 21ohos_unittest("hdi_unittest_power") { 22 module_out_path = module_output_path 23 24 include_dirs = [ 25 "../../interfaces/hdi_service/include", 26 "../../utils/include", 27 ] 28 29 sources = [ "src/hdf_power_hdi_test.cpp" ] 30 31 cflags = [ 32 "-Wall", 33 "-Wextra", 34 "-Werror", 35 "-fsigned-char", 36 "-fno-common", 37 "-fno-strict-aliasing", 38 ] 39 40 external_deps = [ 41 "drivers_interface_power:libpower_stub_1.2", 42 "hdf_core:libhdf_utils", 43 "hilog:libhilog", 44 "ipc:ipc_single", 45 ] 46 if (has_power_c_utils_part) { 47 external_deps += [ "c_utils:utils" ] 48 } 49 50 if (drivers_peripheral_power_wakeup_cause_path) { 51 defines = [ "DRIVER_PERIPHERAL_POWER_WAKEUP_CAUSE_PATH" ] 52 } 53} 54 55ohos_unittest("hdi_unittest_power_runninglock") { 56 module_out_path = module_output_path 57 58 include_dirs = [ 59 "${power_hdi_service_path}/src", 60 "mock", 61 "../../utils/include", 62 ] 63 64 sources = [ 65 "${power_hdi_service_path}/src/running_lock_counter.cpp", 66 "${power_hdi_service_path}/src/running_lock_impl.cpp", 67 "${power_hdi_service_path}/src/running_lock_timer_handler.cpp", 68 "mock/mock_system_operation.cpp", 69 "mock/mock_wakelock_name.cpp", 70 "src/hdf_power_runninglock_test.cpp", 71 ] 72 73 cflags = [ 74 "-Wall", 75 "-Wextra", 76 "-Werror", 77 "-fsigned-char", 78 "-fno-common", 79 "-fno-strict-aliasing", 80 ] 81 82 external_deps = [ 83 "drivers_interface_power:power_idl_headers", 84 "hdf_core:libhdf_utils", 85 "hilog:libhilog", 86 "ipc:ipc_single", 87 ] 88 if (has_power_c_utils_part) { 89 external_deps += [ "c_utils:utils" ] 90 } 91 if (has_power_hisysevent_part) { 92 external_deps += [ "hisysevent:libhisysevent" ] 93 } 94} 95