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("../../../../../../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 "../../../include", 26 "../../include", 27 "../systemtest/include", 28 "../../../../utils/include", 29 ] 30} 31 32##############################unittest########################################## 33ohos_unittest("test_hdisrv") { 34 module_out_path = module_output_path 35 36 sources = [ 37 "../../src/battery_config.cpp", 38 "../../src/battery_thread.cpp", 39 "../../src/power_supply_provider.cpp", 40 "src/hdi_service_test.cpp", 41 ] 42 43 configs = [ ":module_private_config" ] 44 45 deps = [ 46 "../../../../../../interface/battery/v1_2:libbattery_stub_1.2", 47 "//third_party/cJSON:cjson", 48 "//third_party/googletest:gmock_main", 49 "//third_party/googletest:gtest_main", 50 "//third_party/jsoncpp:jsoncpp", 51 ] 52 53 external_deps = [ 54 "c_utils:utils", 55 "config_policy:configpolicy_util", 56 "hdf_core:libhdf_host", 57 "hdf_core:libhdf_utils", 58 "hilog:libhilog", 59 "init:libbegetutil", 60 "ipc:ipc_single", 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 "c_utils:utils", 73 "drivers_interface_battery:libbattery_proxy_1.2", 74 "hdf_core:libhdf_utils", 75 "hilog:libhilog", 76 "ipc:ipc_single", 77 ] 78 } else { 79 external_deps = [ "hilog:libhilog" ] 80 } 81} 82 83group("unittest") { 84 testonly = true 85 deps = [] 86 87 deps += [ 88 ":hdi_unittest_battery", 89 ":test_hdisrv", 90 ] 91} 92