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/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 sources = [ 36 "../../src/battery_config.cpp", 37 "../../src/battery_thread.cpp", 38 "../../src/power_supply_provider.cpp", 39 "src/hdi_service_test.cpp", 40 ] 41 42 configs = [ ":module_private_config" ] 43 44 deps = [] 45 46 external_deps = [ 47 "cJSON:cjson", 48 "config_policy:configpolicy_util", 49 "drivers_interface_battery:libbattery_stub_2.0", 50 "googletest:gmock_main", 51 "googletest:gtest_main", 52 "hdf_core:libhdf_host", 53 "hdf_core:libhdf_utils", 54 "hilog:libhilog", 55 "init:libbegetutil", 56 "ipc:ipc_single", 57 "jsoncpp:jsoncpp", 58 ] 59 if (has_battery_c_utils_part) { 60 external_deps += [ "c_utils:utils" ] 61 } 62} 63 64ohos_unittest("hdi_unittest_battery") { 65 module_out_path = module_output_path 66 sources = [ "src/hdi_interface_test.cpp" ] 67 68 configs = [ ":module_private_config" ] 69 70 if (is_standard_system) { 71 external_deps = [ 72 "drivers_interface_battery:libbattery_proxy_2.0", 73 "hdf_core:libhdf_utils", 74 "hilog:libhilog", 75 "ipc:ipc_single", 76 ] 77 if (has_battery_c_utils_part) { 78 external_deps += [ "c_utils:utils" ] 79 } 80 } else { 81 external_deps = [ "hilog:libhilog" ] 82 } 83} 84 85group("unittest") { 86 testonly = true 87 deps = [] 88 89 deps += [ 90 ":hdi_unittest_battery", 91 ":test_hdisrv", 92 ] 93} 94