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/test.gni") 15import("//drivers/hdf_core/adapter/uhdf/uhdf.gni") 16 17module_output_path = "drivers_peripheral_battery/battery" 18 19############################################################################### 20config("module_private_config") { 21 visibility = [ ":*" ] 22 23 include_dirs = [ 24 "include", 25 "//drivers/peripheral/battery/charger/ui/include", 26 "//drivers/peripheral/battery/charger/led", 27 "//drivers/peripheral/battery/charger/backlight", 28 "//drivers/peripheral/battery/charger/vibrate", 29 "//drivers/peripheral/battery/charger/include", 30 "//drivers/peripheral/battery/interfaces/include", 31 "//drivers/peripheral/battery/include", 32 "//drivers/peripheral/battery/interfaces/hdi_service/include", 33 "//drivers/peripheral/battery/utils/include", 34 ] 35} 36 37##############################unittest########################################## 38ohos_unittest("test_hdisrv") { 39 module_out_path = module_output_path 40 41 sources = [ 42 "//drivers/peripheral/battery/charger/backlight/battery_backlight.cpp", 43 "//drivers/peripheral/battery/charger/led/battery_led.cpp", 44 "//drivers/peripheral/battery/charger/src/charger_thread.cpp", 45 "//drivers/peripheral/battery/charger/vibrate/battery_vibrate.cpp", 46 "//drivers/peripheral/battery/interfaces/hdi_service/src/battery_config.cpp", 47 "//drivers/peripheral/battery/interfaces/hdi_service/src/battery_thread.cpp", 48 "//drivers/peripheral/battery/interfaces/hdi_service/src/power_supply_provider.cpp", 49 "src/battery_config_test.cpp", 50 "src/battery_led_test.cpp", 51 "src/hdi_service_test.cpp", 52 ] 53 54 configs = [ ":module_private_config" ] 55 56 deps = [ 57 "//drivers/interface/battery/v1_1:libbattery_stub_1.1", 58 "//drivers/peripheral/battery/charger/ui:libminui", 59 "//third_party/googletest:gmock_main", 60 "//third_party/googletest:gtest_main", 61 "//third_party/jsoncpp:jsoncpp", 62 "//third_party/libpng:libpng", 63 ] 64 65 external_deps = [ 66 "c_utils:utils", 67 "drivers_interface_light:liblight_proxy_1.0", 68 "drivers_peripheral_input:hdi_input", 69 "hdf_core:libhdf_host", 70 "hdf_core:libhdf_ipc_adapter", 71 "hdf_core:libhdf_utils", 72 "hiviewdfx_hilog_native:libhilog", 73 "init:libbegetutil", 74 "ipc:ipc_single", 75 ] 76} 77 78##############################unittest########################################## 79ohos_unittest("test_capacity_shutdown") { 80 module_out_path = module_output_path 81 82 sources = [ 83 "//drivers/peripheral/battery/charger/backlight/battery_backlight.cpp", 84 "//drivers/peripheral/battery/charger/led/battery_led.cpp", 85 "//drivers/peripheral/battery/charger/src/charger_thread.cpp", 86 "//drivers/peripheral/battery/charger/vibrate/battery_vibrate.cpp", 87 "//drivers/peripheral/battery/interfaces/hdi_service/src/battery_config.cpp", 88 "//drivers/peripheral/battery/interfaces/hdi_service/src/battery_thread.cpp", 89 "//drivers/peripheral/battery/interfaces/hdi_service/src/power_supply_provider.cpp", 90 "src/capacity_shutdown_test.cpp", 91 ] 92 93 configs = [ ":module_private_config" ] 94 95 deps = [ 96 "//drivers/interface/battery/v1_1:libbattery_stub_1.1", 97 "//drivers/peripheral/battery/charger/ui:libminui", 98 "//third_party/googletest:gmock_main", 99 "//third_party/googletest:gtest_main", 100 "//third_party/jsoncpp:jsoncpp", 101 "//third_party/libpng:libpng", 102 ] 103 104 external_deps = [ 105 "c_utils:utils", 106 "drivers_interface_light:liblight_proxy_1.0", 107 "drivers_peripheral_input:hdi_input", 108 "hdf_core:libhdf_host", 109 "hdf_core:libhdf_ipc_adapter", 110 "hdf_core:libhdf_utils", 111 "hiviewdfx_hilog_native:libhilog", 112 "init:libbegetutil", 113 "ipc:ipc_single", 114 ] 115} 116 117ohos_unittest("hdi_unittest_battery") { 118 module_out_path = module_output_path 119 sources = [ "src/hdi_interface_test.cpp" ] 120 121 configs = [ ":module_private_config" ] 122 123 if (is_standard_system) { 124 external_deps = [ 125 "c_utils:utils", 126 "drivers_interface_battery:libbattery_proxy_1.1", 127 "hdf_core:libhdf_utils", 128 "hiviewdfx_hilog_native:libhilog", 129 "ipc:ipc_single", 130 ] 131 } else { 132 external_deps = [ "hilog:libhilog" ] 133 } 134} 135 136group("unittest") { 137 testonly = true 138 deps = [] 139 140 deps += [ 141 ":hdi_unittest_battery", 142 ":test_capacity_shutdown", 143 ":test_hdisrv", 144 ] 145} 146