• 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/ohos.gni")
15import("//build/test.gni")
16import("//foundation/resourceschedule/device_standby/standby_service.gni")
17
18module_output_path = "${standby_service_part_name}/unittest"
19
20ohos_unittest("standby_plugin_unit_test") {
21  module_out_path = module_output_path
22  cflags_cc = [
23    "-Dprivate=public",
24    "-Dprotected=public",
25  ]
26
27  include_dirs = [
28    "${standby_plugins_path}/ext/include",
29    "${standby_service_constraints_path}/include",
30    "${standby_service_message_listener_path}/include",
31    "${standby_service_standby_state_path}/include",
32    "${standby_service_strategy_path}/include",
33    "${standby_utils_common_path}/include",
34    "${standby_utils_policy_path}/include",
35  ]
36
37  sources = [
38    "${standby_plugins_path}/test/unittest/standby_plugin_unit_test.cpp",
39    "${standby_service_path}/test/unittest/mock/mock_helper.cpp",
40    "${standby_service_path}/test/unittest/mock/mock_ipc.cpp",
41  ]
42
43  deps = [
44    "${standby_innerkits_path}:standby_innerkits",
45    "${standby_plugins_path}:standby_plugin_static",
46    "${standby_service_frameworks_path}:standby_fwk",
47    "${standby_service_path}:standby_service_static",
48    "${standby_utils_common_path}:standby_utils_common",
49    "${standby_utils_policy_path}:standby_utils_policy",
50  ]
51
52  external_deps = [
53    "ability_base:base",
54    "ability_base:want",
55    "ability_base:zuri",
56    "ability_runtime:app_manager",
57    "ability_runtime:wantagent_innerkits",
58    "access_token:libaccesstoken_sdk",
59    "access_token:libtokenid_sdk",
60    "battery_manager:batterysrv_client",
61    "bundle_framework:appexecfwk_core",
62    "c_utils:utils",
63    "common_event_service:cesfwk_innerkits",
64    "eventhandler:libeventhandler",
65    "hilog:libhilog",
66    "init:libbegetutil",
67    "input:libmmi-client",
68    "ipc:ipc_single",
69    "power_manager:powermgr_client",
70    "sensor:sensor_interface_native",
71    "time_service:time_client",
72  ]
73
74  defines = []
75  if (enable_background_task_mgr) {
76    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
77    defines += [ "ENABLE_BACKGROUND_TASK_MGR" ]
78  }
79
80  subsystem_name = "resourceschedule"
81  part_name = "${standby_service_part_name}"
82}
83
84ohos_unittest("standby_plugin_strategy_test") {
85  module_out_path = module_output_path
86
87  include_dirs = [
88    "${standby_plugins_path}/ext/include",
89    "${standby_service_constraints_path}/include",
90    "${standby_service_message_listener_path}/include",
91    "${standby_service_standby_state_path}/include",
92    "${standby_service_strategy_path}/include",
93    "${standby_utils_common_path}/include",
94    "${standby_utils_policy_path}/include",
95  ]
96
97  sources = [
98    "${standby_plugins_path}/test/unittest/standby_plugin_unit_test.cpp",
99    "${standby_service_path}/test/unittest/mock/mock_helper.cpp",
100    "${standby_service_path}/test/unittest/mock/mock_ipc.cpp",
101  ]
102
103  deps = [
104    "${standby_innerkits_path}:standby_innerkits",
105    "${standby_plugins_path}:standby_plugin_static",
106    "${standby_service_frameworks_path}:standby_fwk",
107    "${standby_service_path}:standby_service_static",
108    "${standby_utils_common_path}:standby_utils_common",
109    "${standby_utils_policy_path}:standby_utils_policy",
110  ]
111
112  external_deps = [
113    "ability_base:base",
114    "ability_base:want",
115    "ability_base:zuri",
116    "ability_runtime:app_manager",
117    "ability_runtime:wantagent_innerkits",
118    "access_token:libaccesstoken_sdk",
119    "access_token:libtokenid_sdk",
120    "battery_manager:batterysrv_client",
121    "bundle_framework:appexecfwk_core",
122    "c_utils:utils",
123    "common_event_service:cesfwk_innerkits",
124    "eventhandler:libeventhandler",
125    "hilog:libhilog",
126    "init:libbegetutil",
127    "input:libmmi-client",
128    "ipc:ipc_single",
129    "power_manager:powermgr_client",
130    "sensor:sensor_interface_native",
131    "time_service:time_client",
132  ]
133
134  defines = []
135  if (enable_background_task_mgr) {
136    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
137    defines += [ "ENABLE_BACKGROUND_TASK_MGR" ]
138  }
139
140  subsystem_name = "resourceschedule"
141  part_name = "${standby_service_part_name}"
142}
143
144group("unittest") {
145  testonly = true
146
147  deps = [
148    ":standby_plugin_strategy_test",
149    ":standby_plugin_unit_test",
150  ]
151}
152