# Copyright (C) 2021-2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/test.gni") import("../../thermalmgr.gni") module_output_path = "thermal_manager/thermal_native" ############################################################################### config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "include", "${ability_runtime_services_path}/appmgr/include", "${thermal_manager_path}/test/common/include", "${thermal_service_zidl}/include", ] } deps_ex = [ "ability_base:base", "ability_base:want", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "hdf_core:libhdi", "bundle_framework:appexecfwk_base", "common_event_service:cesfwk_innerkits", "c_utils:utils", "libxml2:libxml2", "drivers_interface_thermal:libthermal_proxy_1.1", "hilog:libhilog", "ipc:ipc_core", "power_manager:powermgr_client", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] ohos_systemtest("ThermalMgrInterfaceTest") { module_out_path = "${module_output_path}" sources = [ "${thermal_manager_path}/test/common/src/thermal_test.cpp", "src/thermal_mgr_interface_test.cpp", ] configs = [ "${utils_path}:utils_config", "${utils_path}:coverage_flags", ":module_private_config", ] include_dirs = [ "include", "${thermal_manager_path}/services/native/include", "${thermal_manager_path}/services/native/include/thermal_action", "${thermal_manager_path}/services/native/include/thermal_observer", "${thermal_manager_path}/services/native/include/thermal_policy", "${thermal_manager_path}/services/native/include/thermal_observer/state_machine", "${thermal_manager_path}/services/native/include/thermal_action/action", "${thermal_manager_path}/test/unittest/include", "${thermal_manager_path}/services/zidl/include", ] deps = [ "${thermal_inner_api}:thermalsrv_client", "${thermal_manager_path}/services:thermalservice", "${thermal_manager_path}/test/common:mock_thermalsrv_client", "${thermal_service_zidl}:thermalmgr_proxy", "${thermal_service_zidl}:thermalmgr_stub", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ohos_systemtest("ThermalMgrSystemTest") { resource_config_file = "${thermal_manager_path}/test/resource/system_test/ohos_test.xml" module_out_path = "${module_output_path}" sources = [ "${thermal_manager_path}/test/unittest/src/thermal_config_file_parser.cpp", "src/thermal_mgr_system_test.cpp", ] configs = [ "${utils_path}:utils_config", "${utils_path}:coverage_flags", ] include_dirs = [ "include", "${thermal_manager_path}/services/zidl/include", "${thermal_manager_path}/services/native/include", "${thermal_manager_path}/services/native/include/thermal_action", "${thermal_manager_path}/services/native/include/thermal_observer", "${thermal_manager_path}/services/native/include/thermal_policy", "${thermal_manager_path}/services/native/include/thermal_observer/state_machine", "${thermal_manager_path}/services/native/include/thermal_action/action", "${thermal_manager_path}/test/unittest/include", ] deps = [ "${thermal_manager_path}/services:thermalservice", "${thermal_manager_path}/test/common:mock_thermalsrv_client", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ohos_systemtest("ThermalMgrDialogTest") { module_out_path = "${module_output_path}" sources = [ "src/thermal_mgr_dialog_test.cpp" ] configs = [ "${utils_path}:utils_config", "${utils_path}:coverage_flags", ] include_dirs = [ "include", "${thermal_manager_path}/services/zidl/include", "${thermal_manager_path}/services/native/include", "${thermal_manager_path}/services/native/include/thermal_action", "${thermal_manager_path}/services/native/include/thermal_observer", "${thermal_manager_path}/services/native/include/thermal_policy", "${thermal_manager_path}/services/native/include/thermal_observer/state_machine", "${thermal_manager_path}/services/native/include/thermal_action/action", ] deps = [ "${thermal_manager_path}/services:thermalservice", "${thermal_service_zidl}:thermalmgr_proxy", "${thermal_service_zidl}:thermalmgr_stub", "${utils_path}:thermal_utils", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ohos_systemtest("ThermalLevelEventSystemTest") { module_out_path = module_output_path sanitize = { cfi = true cfi_cross_dso = true debug = false blocklist = "../cfi_blocklist.txt" } sources = [ "${thermal_manager_path}/test/common/src/thermal_test.cpp", "src/thermal_level_event_system_test.cpp", ] configs = [ "${utils_path}:utils_config", ":module_private_config", "${utils_path}:coverage_flags", ] deps = [ "${thermal_inner_api}:thermalsrv_client", "${thermal_manager_path}/services:thermalservice", "${thermal_manager_path}/test/common:mock_thermalsrv_client", "//third_party/googletest:gtest_main", ] external_deps = deps_ex defines = [] if (defined(global_parts_info) && defined(global_parts_info.powermgr_battery_manager)) { defines += [ "BATTERY_MANAGER_ENABLE" ] external_deps += [ "battery_manager:batterysrv_client" ] } } group("systemtest") { testonly = true deps = [ ":ThermalLevelEventSystemTest", ":ThermalMgrDialogTest", ":ThermalMgrInterfaceTest", ] }