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