1# Copyright (c) 2021-2025 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 = "battery_manager/battery_manager" 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 ] 49 50 external_deps = [ 51 "ability_base:base", 52 "ability_base:want", 53 "cJSON:cjson", 54 "c_utils:utils", 55 "common_event_service:cesfwk_innerkits", 56 "googletest:gtest_main", 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 defines = [] 68 if (battery_manager_feature_set_low_capacity_threshold) { 69 defines += [ "PC_TEST" ] 70 } 71} 72 73##############################systemtest########################################## 74ohos_systemtest("test_charger_offline_shutdown") { 75 module_out_path = "battery_manager/battery_manager" 76 77 sources = [ "src/charger_offline_shutdown_test.cpp" ] 78 79 configs = [ 80 "${battery_utils}:utils_config", 81 ":module_private_config", 82 "${battery_utils}:coverage_flags", 83 ] 84 85 external_deps = [ 86 "cJSON:cjson", 87 "c_utils:utils", 88 "googletest:gtest_main", 89 "hilog:libhilog", 90 "init:libbegetutil", 91 "ipc:ipc_core", 92 ] 93} 94 95##############################systemtest########################################## 96ohos_systemtest("test_battery_event_systemtest") { 97 module_out_path = module_output_path 98 99 sources = [ 100 "${battery_manager_path}/test/utils/test_utils.cpp", 101 "src/battery_event_system_test.cpp", 102 ] 103 104 configs = [ 105 "${battery_utils}:utils_config", 106 ":module_private_config", 107 "${battery_utils}:coverage_flags", 108 ] 109 110 deps = [ 111 "${battery_inner_api}:batterysrv_client", 112 "${battery_manager_path}/services:batteryservice", 113 ] 114 115 external_deps = [ 116 "ability_base:want", 117 "battery_manager:batterysrv_client", 118 "cJSON:cjson", 119 "c_utils:utils", 120 "common_event_service:cesfwk_innerkits", 121 "drivers_interface_battery:libbattery_proxy_2.0", 122 "drivers_interface_input:libinput_proxy_1.0", 123 "googletest:gtest_main", 124 "hilog:libhilog", 125 "init:libbegetutil", 126 "ipc:ipc_core", 127 "safwk:system_ability_fwk", 128 "samgr:samgr_proxy", 129 ] 130 131 if (has_drivers_interface_light_part) { 132 external_deps += [ "drivers_interface_light:liblight_proxy_1.0" ] 133 } 134 135 defines = [] 136 if (build_variant == "user") { 137 defines += [ "BATTERY_USER_VERSION" ] 138 } 139 140 if (battery_manager_feature_enable_charger) { 141 defines += [ "ENABLE_TEST" ] 142 } 143 144 if (battery_manager_feature_set_low_capacity_threshold) { 145 defines += [ "PC_TEST" ] 146 } 147} 148 149group("systemtest") { 150 testonly = true 151 152 deps = [ 153 ":test_battery_event_systemtest", 154 ":test_systemtest", 155 ] 156} 157