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