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("../../../../battery.gni") 16module_output_path = "drivers_peripheral_battery/drivers_peripheral_battery" 17 18############################################################################### 19config("module_private_config") { 20 visibility = [ ":*" ] 21 22 include_dirs = [ 23 "include", 24 "../../../include", 25 "../../include", 26 "../systemtest/include", 27 "../../../../utils/include", 28 ] 29} 30 31##############################unittest########################################## 32ohos_unittest("test_hdisrv") { 33 module_out_path = module_output_path 34 35 cflags = [ 36 "-Dprivate=public", 37 "-Dprotected=public", 38 ] 39 40 sources = [ 41 "../../src/battery_config.cpp", 42 "../../src/battery_thread.cpp", 43 "../../src/power_supply_provider.cpp", 44 "src/hdi_service_test.cpp", 45 "src/hdi_battery_config_test.cpp", 46 ] 47 48 configs = [ ":module_private_config" ] 49 50 deps = [] 51 52 external_deps = [ 53 "cJSON:cjson", 54 "drivers_interface_battery:libbattery_stub_2.0", 55 "googletest:gmock_main", 56 "googletest:gtest_main", 57 "hdf_core:libhdf_host", 58 "hdf_core:libhdf_utils", 59 "hilog:libhilog", 60 "ipc:ipc_single", 61 ] 62 if (drivers_peripheral_battery_feature_config_policy) { 63 external_deps += [ "config_policy:configpolicy_util" ] 64 } 65 if (drivers_peripheral_battery_feature_c_utils) { 66 external_deps += [ "c_utils:utils" ] 67 } 68} 69 70ohos_unittest("hdi_unittest_battery") { 71 module_out_path = module_output_path 72 sources = [ "src/hdi_interface_test.cpp" ] 73 74 configs = [ ":module_private_config" ] 75 76 if (is_standard_system) { 77 external_deps = [ 78 "drivers_interface_battery:libbattery_proxy_2.0", 79 "hdf_core:libhdf_utils", 80 "hilog:libhilog", 81 "ipc:ipc_single", 82 ] 83 if (drivers_peripheral_battery_feature_c_utils) { 84 external_deps += [ "c_utils:utils" ] 85 } 86 } else { 87 external_deps = [ "hilog:libhilog" ] 88 } 89} 90 91group("unittest") { 92 testonly = true 93 deps = [] 94 95 deps += [ 96 ":hdi_unittest_battery", 97 ":test_hdisrv", 98 ] 99} 100