# 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("../../powermgr.gni") module_output_path = "${powermgr_part_name}/powermgr_native" ############################################################################### config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "include", "mock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", "${powermgr_service_path}/native/src/wakeup", "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include/", ] } deps_ex = [ "ability_base:base", "ability_base:want", "ability_runtime:ability_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_innerkits", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", "sensor:sensor_interface_native", ] ##############################systemtest########################################## ohos_systemtest("test_power_mgr_mock_system") { module_out_path = module_output_path sources = [ "src/power_mgr_mock_system_test.cpp" ] configs = [ "${powermgr_utils_path}:utils_config", ":module_private_config", "${powermgr_utils_path}:coverage_flags", ] deps = [ "${powermgr_inner_api}:powermgr_client", "${powermgr_service_path}:powermgr_stub", "${powermgr_service_path}:powermgrservice", "${powermgr_service_path}/native/src/actions:powermgr_actions", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ################################powersavemode################################ ohos_systemtest("test_power_mgr_powersavemode") { module_out_path = module_output_path sources = [ "src/power_mgr_powersavemode_test.cpp" ] configs = [ "${powermgr_utils_path}:utils_config", ":module_private_config", "${powermgr_utils_path}:coverage_flags", ] deps = [ "${powermgr_inner_api}:powermgr_client", "${powermgr_service_path}:powermgr_stub", "${powermgr_service_path}:powermgrservice", "${powermgr_service_path}/native/src/actions:powermgr_actions", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ################################powermgrsystem################################ ohos_systemtest("test_power_mgr_system") { module_out_path = module_output_path resource_config_file = "${powermgr_root_path}/test/systemtest/resources/ohos_test.xml" sources = [ "src/power_mgr_system_test.cpp" ] configs = [ "${powermgr_utils_path}:utils_config", ":module_private_config", "${powermgr_utils_path}:coverage_flags", ] deps = [ "${powermgr_inner_api}:powermgr_client", "${powermgr_service_path}:powermgr_stub", "${powermgr_service_path}:powermgrservice", "${powermgr_service_path}/native/src/actions:powermgr_actions", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ################################fastshutdown################################ ohos_systemtest("test_power_mgr_shutdown_fast") { module_out_path = module_output_path sources = [ "src/power_mgr_shutdown_fast_test.cpp" ] configs = [ "${powermgr_utils_path}:utils_config", ":module_private_config", "${powermgr_utils_path}:coverage_flags", ] deps = [ "${powermgr_inner_api}:powermgr_client", "${powermgr_service_path}:powermgr_stub", "${powermgr_service_path}:powermgrservice", "${powermgr_service_path}/native/src/actions:powermgr_actions", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ################################powerevent################################ ohos_systemtest("test_power_level_event_system_test_off") { module_out_path = module_output_path sources = [ "src/power_level_event_system_test_off.cpp" ] configs = [ "${powermgr_utils_path}:utils_config", ":module_private_config", "${powermgr_utils_path}:coverage_flags", ] deps = [ "${powermgr_inner_api}:powermgr_client", "${powermgr_service_path}:powermgr_stub", "${powermgr_service_path}:powermgrservice", "${powermgr_service_path}/native/src/actions:powermgr_actions", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ################################powerevent################################ ohos_systemtest("test_power_level_event_system_test_on") { module_out_path = module_output_path sources = [ "src/power_level_event_system_test_on.cpp" ] configs = [ "${powermgr_utils_path}:utils_config", ":module_private_config", "${powermgr_utils_path}:coverage_flags", ] deps = [ "${powermgr_inner_api}:powermgr_client", "${powermgr_service_path}:powermgr_stub", "${powermgr_service_path}:powermgrservice", "${powermgr_service_path}/native/src/actions:powermgr_actions", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ##############################sttest########################################## ohos_systemtest("test_power_st_mgr_mock") { module_out_path = module_output_path sources = [ "src/power_mgr_st_mock_test.cpp" ] configs = [ "${powermgr_utils_path}:utils_config", ":module_private_config", "${powermgr_utils_path}:coverage_flags", ] deps = [ "${powermgr_inner_api}:powermgr_client", "${powermgr_service_path}:powermgr_stub", "${powermgr_service_path}:powermgrservice", "${powermgr_service_path}/native/src/actions:powermgr_actions", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ##############################suspendsttest########################################## ohos_systemtest("test_power_st_mgr_mock_suspend") { module_out_path = module_output_path sources = [ "src/power_mgr_st_suspend_test.cpp" ] configs = [ "${powermgr_utils_path}:utils_config", ":module_private_config", "${powermgr_utils_path}:coverage_flags", ] deps = [ "${powermgr_inner_api}:powermgr_client", "${powermgr_service_path}:powermgr_stub", "${powermgr_service_path}:powermgrservice", "${powermgr_service_path}/native/src/actions:powermgr_actions", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } group("systemtest_powermgr") { testonly = true deps = [ ":test_power_level_event_system_test_off", ":test_power_level_event_system_test_on", ":test_power_mgr_mock_system", ":test_power_mgr_powersavemode", ":test_power_mgr_shutdown_fast", ":test_power_mgr_system", ":test_power_st_mgr_mock", ":test_power_st_mgr_mock_suspend", ] }