1# Copyright (c) 2021-2023 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("../../batterymgr.gni")
16
17###############################################################################
18config("module_private_config") {
19  visibility = [ ":*" ]
20
21  include_dirs = [
22    "include",
23    "${battery_inner_api}/native/include",
24    "${battery_service_zidl}/include",
25    "${battery_inner_api}/native/include",
26    "${battery_manager_path}/test/utils",
27  ]
28}
29
30##############################systemtest##########################################
31ohos_systemtest("test_systemtest") {
32  module_out_path = "${module_output_path}"
33
34  sources = [
35    "${battery_manager_path}/test/utils/test_utils.cpp",
36    "src/battery_sttest.cpp",
37  ]
38
39  configs = [
40    "${battery_utils}:utils_config",
41    ":module_private_config",
42    "${battery_utils}:coverage_flags",
43  ]
44
45  deps = [
46    "${battery_inner_api}:batterysrv_client",
47    "${battery_service}:batteryservice",
48    "//third_party/googletest:gtest_main",
49    "//third_party/jsoncpp:jsoncpp",
50  ]
51
52  external_deps = [
53    "ability_base:base",
54    "ability_base:want",
55    "c_utils:utils",
56    "common_event_service:cesfwk_innerkits",
57    "hdf_core:libhdf_utils",
58    "hdf_core:libhdi",
59    "hdf_core:libpub_utils",
60    "hilog:libhilog",
61    "init:libbegetutil",
62    "ipc:ipc_core",
63    "safwk:system_ability_fwk",
64    "samgr:samgr_proxy",
65  ]
66}
67
68##############################systemtest##########################################
69ohos_systemtest("test_charger_offline_shutdown") {
70  module_out_path = "${module_output_path}"
71
72  sources = [ "src/charger_offline_shutdown_test.cpp" ]
73
74  configs = [
75    "${battery_utils}:utils_config",
76    ":module_private_config",
77    "${battery_utils}:coverage_flags",
78  ]
79
80  deps = [
81    "//third_party/googletest:gtest_main",
82    "//third_party/jsoncpp:jsoncpp",
83  ]
84
85  external_deps = [
86    "c_utils:utils",
87    "hilog:libhilog",
88    "init:libbegetutil",
89    "ipc:ipc_core",
90  ]
91}
92
93##############################systemtest##########################################
94ohos_systemtest("test_battery_event_systemtest") {
95  module_out_path = module_output_path
96
97  sources = [
98    "${battery_manager_path}/test/utils/test_utils.cpp",
99    "src/battery_event_system_test.cpp",
100  ]
101
102  configs = [
103    "${battery_utils}:utils_config",
104    ":module_private_config",
105    "${battery_utils}:coverage_flags",
106  ]
107
108  deps = [
109    "${battery_inner_api}:batterysrv_client",
110    "${battery_manager_path}/services:batteryservice",
111    "//third_party/googletest:gtest_main",
112    "//third_party/jsoncpp:jsoncpp",
113  ]
114
115  external_deps = [
116    "ability_base:want",
117    "battery_manager:batterysrv_client",
118    "c_utils:utils",
119    "common_event_service:cesfwk_innerkits",
120    "drivers_interface_battery:libbattery_proxy_2.0",
121    "drivers_interface_input:libinput_proxy_1.0",
122    "drivers_interface_light:liblight_proxy_1.0",
123    "hilog:libhilog",
124    "init:libbegetutil",
125    "ipc:ipc_core",
126    "safwk:system_ability_fwk",
127    "samgr:samgr_proxy",
128  ]
129
130  if (build_variant == "user") {
131    defines = [ "BATTERY_USER_VERSION" ]
132  }
133}
134
135group("systemtest") {
136  testonly = true
137
138  deps = [
139    ":test_battery_event_systemtest",
140    ":test_systemtest",
141  ]
142}
143