1# Copyright (c) 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("../../../../powermgr.gni")
16import("../../../powermgr_test.gni")
17
18config("module_private_config") {
19  visibility = [ ":*" ]
20
21  include_dirs = [
22    "include",
23    "include/utils",
24    "${powermgr_service_zidl}/include",
25    "${powermgr_service_zidl}/src/shutdown",
26    "${powermgr_service_path}/native/src/",
27    "${powermgr_service_path}/native/src/actions/",
28    "${powermgr_service_path}/native/src/actions/default",
29    "${powermgr_service_path}/native/src/hibernate",
30    "${powermgr_service_path}/native/src/runninglock",
31    "${powermgr_service_path}/native/src/shutdown",
32    "${powermgr_service_path}/native/src/suspend",
33    "${powermgr_service_path}/native/src/wakeup",
34    "${powermgr_service_path}/native/src/screenoffpre",
35    "${powermgr_test_path}/mock/action",
36  ]
37
38  if (power_manager_feature_wakeup_action) {
39    include_dirs += [ "${powermgr_service_path}/native/src/wakeup_action" ]
40  }
41}
42
43deps_ex = [
44  "ability_base:base",
45  "ability_base:want",
46  "ability_runtime:ability_manager",
47  "c_utils:utils",
48  "common_event_service:cesfwk_innerkits",
49  "ffrt:libffrt",
50  "hilog:libhilog",
51  "input:libmmi-client",
52  "ipc:ipc_core",
53  "power_manager:power_ffrt",
54  "safwk:system_ability_fwk",
55  "samgr:samgr_proxy",
56]
57
58if (has_sensors_sensor_part) {
59  deps_ex += [ "sensor:sensor_interface_native" ]
60}
61
62ohos_unittest("takeover_shutdown_callback_test") {
63  sources = [ "takeover_shutdown_callback_test.cpp" ]
64  configs = [
65    "${powermgr_utils_path}:utils_config",
66    ":module_private_config",
67    "${powermgr_utils_path}:coverage_flags",
68  ]
69  deps = [
70    "${powermgr_inner_api}:powermgr_client",
71    "${powermgr_service_path}:powermgrservice",
72    "//third_party/googletest:gmock_main",
73    "//third_party/googletest:gtest_main",
74  ]
75  external_deps = deps_ex
76  module_out_path = module_output_path
77}
78
79ohos_unittest("async_shutdown_callback_test") {
80  sources = [ "async_shutdown_callback_test.cpp" ]
81  configs = [
82    "${powermgr_utils_path}:utils_config",
83    ":module_private_config",
84    "${powermgr_utils_path}:coverage_flags",
85  ]
86  deps = [
87    "${powermgr_inner_api}:powermgr_client",
88    "${powermgr_service_path}:powermgrservice",
89    "//third_party/googletest:gmock_main",
90    "//third_party/googletest:gtest_main",
91  ]
92  external_deps = deps_ex
93  module_out_path = module_output_path
94}
95
96ohos_unittest("sync_shutdown_callback_test") {
97  sources = [ "sync_shutdown_callback_test.cpp" ]
98  configs = [
99    "${powermgr_utils_path}:utils_config",
100    ":module_private_config",
101    "${powermgr_utils_path}:coverage_flags",
102  ]
103  deps = [
104    "${powermgr_inner_api}:powermgr_client",
105    "${powermgr_service_path}:powermgrservice",
106    "//third_party/googletest:gmock_main",
107    "//third_party/googletest:gtest_main",
108  ]
109  external_deps = deps_ex
110  module_out_path = module_output_path
111}
112
113group("unittest") {
114  testonly = true
115  deps = [
116    ":async_shutdown_callback_test",
117    ":sync_shutdown_callback_test",
118    ":takeover_shutdown_callback_test",
119  ]
120}
121