15ccb8f90Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
25ccb8f90Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
35ccb8f90Sopenharmony_ci# you may not use this file except in compliance with the License.
45ccb8f90Sopenharmony_ci# You may obtain a copy of the License at
55ccb8f90Sopenharmony_ci#
65ccb8f90Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
75ccb8f90Sopenharmony_ci#
85ccb8f90Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
95ccb8f90Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
105ccb8f90Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115ccb8f90Sopenharmony_ci# See the License for the specific language governing permissions and
125ccb8f90Sopenharmony_ci# limitations under the License.
135ccb8f90Sopenharmony_ci
145ccb8f90Sopenharmony_ciimport("//build/test.gni")
155ccb8f90Sopenharmony_ciimport("../../../../powermgr.gni")
165ccb8f90Sopenharmony_ciimport("../../../powermgr_test.gni")
175ccb8f90Sopenharmony_ci
185ccb8f90Sopenharmony_ciconfig("module_private_config") {
195ccb8f90Sopenharmony_ci  visibility = [ ":*" ]
205ccb8f90Sopenharmony_ci
215ccb8f90Sopenharmony_ci  include_dirs = [
225ccb8f90Sopenharmony_ci    "include",
235ccb8f90Sopenharmony_ci    "include/utils",
245ccb8f90Sopenharmony_ci    "${powermgr_service_zidl}/include",
255ccb8f90Sopenharmony_ci    "${powermgr_service_zidl}/src/shutdown",
265ccb8f90Sopenharmony_ci    "${powermgr_service_path}/native/src/",
275ccb8f90Sopenharmony_ci    "${powermgr_service_path}/native/src/actions/",
285ccb8f90Sopenharmony_ci    "${powermgr_service_path}/native/src/actions/default",
295ccb8f90Sopenharmony_ci    "${powermgr_service_path}/native/src/hibernate",
305ccb8f90Sopenharmony_ci    "${powermgr_service_path}/native/src/runninglock",
315ccb8f90Sopenharmony_ci    "${powermgr_service_path}/native/src/shutdown",
325ccb8f90Sopenharmony_ci    "${powermgr_service_path}/native/src/suspend",
335ccb8f90Sopenharmony_ci    "${powermgr_service_path}/native/src/wakeup",
345ccb8f90Sopenharmony_ci    "${powermgr_service_path}/native/src/screenoffpre",
355ccb8f90Sopenharmony_ci    "${powermgr_test_path}/mock/action",
365ccb8f90Sopenharmony_ci  ]
375ccb8f90Sopenharmony_ci
385ccb8f90Sopenharmony_ci  if (power_manager_feature_wakeup_action) {
395ccb8f90Sopenharmony_ci    include_dirs += [ "${powermgr_service_path}/native/src/wakeup_action" ]
405ccb8f90Sopenharmony_ci  }
415ccb8f90Sopenharmony_ci}
425ccb8f90Sopenharmony_ci
435ccb8f90Sopenharmony_cideps_ex = [
445ccb8f90Sopenharmony_ci  "ability_base:base",
455ccb8f90Sopenharmony_ci  "ability_base:want",
465ccb8f90Sopenharmony_ci  "ability_runtime:ability_manager",
475ccb8f90Sopenharmony_ci  "c_utils:utils",
485ccb8f90Sopenharmony_ci  "common_event_service:cesfwk_innerkits",
495ccb8f90Sopenharmony_ci  "ffrt:libffrt",
505ccb8f90Sopenharmony_ci  "hilog:libhilog",
515ccb8f90Sopenharmony_ci  "input:libmmi-client",
525ccb8f90Sopenharmony_ci  "ipc:ipc_core",
535ccb8f90Sopenharmony_ci  "power_manager:power_ffrt",
545ccb8f90Sopenharmony_ci  "safwk:system_ability_fwk",
555ccb8f90Sopenharmony_ci  "samgr:samgr_proxy",
565ccb8f90Sopenharmony_ci]
575ccb8f90Sopenharmony_ci
585ccb8f90Sopenharmony_ciif (has_sensors_sensor_part) {
595ccb8f90Sopenharmony_ci  deps_ex += [ "sensor:sensor_interface_native" ]
605ccb8f90Sopenharmony_ci}
615ccb8f90Sopenharmony_ci
625ccb8f90Sopenharmony_ciohos_unittest("takeover_shutdown_callback_test") {
635ccb8f90Sopenharmony_ci  sources = [ "takeover_shutdown_callback_test.cpp" ]
645ccb8f90Sopenharmony_ci  configs = [
655ccb8f90Sopenharmony_ci    "${powermgr_utils_path}:utils_config",
665ccb8f90Sopenharmony_ci    ":module_private_config",
675ccb8f90Sopenharmony_ci    "${powermgr_utils_path}:coverage_flags",
685ccb8f90Sopenharmony_ci  ]
695ccb8f90Sopenharmony_ci  deps = [
705ccb8f90Sopenharmony_ci    "${powermgr_inner_api}:powermgr_client",
715ccb8f90Sopenharmony_ci    "${powermgr_service_path}:powermgrservice",
725ccb8f90Sopenharmony_ci    "//third_party/googletest:gmock_main",
735ccb8f90Sopenharmony_ci    "//third_party/googletest:gtest_main",
745ccb8f90Sopenharmony_ci  ]
755ccb8f90Sopenharmony_ci  external_deps = deps_ex
765ccb8f90Sopenharmony_ci  module_out_path = module_output_path
775ccb8f90Sopenharmony_ci}
785ccb8f90Sopenharmony_ci
795ccb8f90Sopenharmony_ciohos_unittest("async_shutdown_callback_test") {
805ccb8f90Sopenharmony_ci  sources = [ "async_shutdown_callback_test.cpp" ]
815ccb8f90Sopenharmony_ci  configs = [
825ccb8f90Sopenharmony_ci    "${powermgr_utils_path}:utils_config",
835ccb8f90Sopenharmony_ci    ":module_private_config",
845ccb8f90Sopenharmony_ci    "${powermgr_utils_path}:coverage_flags",
855ccb8f90Sopenharmony_ci  ]
865ccb8f90Sopenharmony_ci  deps = [
875ccb8f90Sopenharmony_ci    "${powermgr_inner_api}:powermgr_client",
885ccb8f90Sopenharmony_ci    "${powermgr_service_path}:powermgrservice",
895ccb8f90Sopenharmony_ci    "//third_party/googletest:gmock_main",
905ccb8f90Sopenharmony_ci    "//third_party/googletest:gtest_main",
915ccb8f90Sopenharmony_ci  ]
925ccb8f90Sopenharmony_ci  external_deps = deps_ex
935ccb8f90Sopenharmony_ci  module_out_path = module_output_path
945ccb8f90Sopenharmony_ci}
955ccb8f90Sopenharmony_ci
965ccb8f90Sopenharmony_ciohos_unittest("sync_shutdown_callback_test") {
975ccb8f90Sopenharmony_ci  sources = [ "sync_shutdown_callback_test.cpp" ]
985ccb8f90Sopenharmony_ci  configs = [
995ccb8f90Sopenharmony_ci    "${powermgr_utils_path}:utils_config",
1005ccb8f90Sopenharmony_ci    ":module_private_config",
1015ccb8f90Sopenharmony_ci    "${powermgr_utils_path}:coverage_flags",
1025ccb8f90Sopenharmony_ci  ]
1035ccb8f90Sopenharmony_ci  deps = [
1045ccb8f90Sopenharmony_ci    "${powermgr_inner_api}:powermgr_client",
1055ccb8f90Sopenharmony_ci    "${powermgr_service_path}:powermgrservice",
1065ccb8f90Sopenharmony_ci    "//third_party/googletest:gmock_main",
1075ccb8f90Sopenharmony_ci    "//third_party/googletest:gtest_main",
1085ccb8f90Sopenharmony_ci  ]
1095ccb8f90Sopenharmony_ci  external_deps = deps_ex
1105ccb8f90Sopenharmony_ci  module_out_path = module_output_path
1115ccb8f90Sopenharmony_ci}
1125ccb8f90Sopenharmony_ci
1135ccb8f90Sopenharmony_cigroup("unittest") {
1145ccb8f90Sopenharmony_ci  testonly = true
1155ccb8f90Sopenharmony_ci  deps = [
1165ccb8f90Sopenharmony_ci    ":async_shutdown_callback_test",
1175ccb8f90Sopenharmony_ci    ":sync_shutdown_callback_test",
1185ccb8f90Sopenharmony_ci    ":takeover_shutdown_callback_test",
1195ccb8f90Sopenharmony_ci  ]
1205ccb8f90Sopenharmony_ci}
121