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