• 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_service_unit_test") {
21  module_out_path = module_output_path
22  cflags_cc = [
23    "-Dprivate=public",
24    "-Dprotected=public",
25  ]
26
27  sources = [
28    "mock/mock_common_event.cpp",
29    "mock/mock_helper.cpp",
30    "mock/mock_ipc.cpp",
31    "standby_service_unit_test.cpp",
32  ]
33
34  deps = [
35    "${standby_innerkits_path}:standby_innerkits",
36    "${standby_plugins_path}:standby_plugin_static",
37    "${standby_service_frameworks_path}:standby_fwk",
38    "${standby_service_path}:standby_service_static",
39    "${standby_utils_common_path}:standby_utils_common",
40    "${standby_utils_policy_path}:standby_utils_policy_static",
41  ]
42
43  external_deps = [
44    "ability_base:base",
45    "ability_base:want",
46    "ability_base:zuri",
47    "ability_runtime:app_manager",
48    "ability_runtime:wantagent_innerkits",
49    "access_token:libaccesstoken_sdk",
50    "access_token:libtokenid_sdk",
51    "bundle_framework:appexecfwk_base",
52    "c_utils:utils",
53    "common_event_service:cesfwk_innerkits",
54    "eventhandler:libeventhandler",
55    "hilog:libhilog",
56    "init:libbegetutil",
57    "ipc:ipc_single",
58    "power_manager:powermgr_client",
59    "safwk:system_ability_fwk",
60    "samgr:samgr_proxy",
61    "time_service:time_client",
62  ]
63
64  defines = []
65  if (enable_background_task_mgr) {
66    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
67    defines += [ "ENABLE_BACKGROUND_TASK_MGR" ]
68  }
69
70  subsystem_name = "resourceschedule"
71  part_name = "${standby_service_part_name}"
72}
73
74ohos_unittest("standby_utils_unit_test") {
75  module_out_path = module_output_path
76  cflags_cc = [
77    "-Dprivate=public",
78    "-Dprotected=public",
79  ]
80
81  sources = [ "standby_utils_unit_test.cpp" ]
82
83  deps = [
84    "${standby_service_path}:standby_service_static",
85    "${standby_utils_common_path}:standby_utils_common",
86    "${standby_utils_policy_path}:standby_utils_policy_static",
87  ]
88
89  external_deps = [
90    "ability_base:base",
91    "ability_base:want",
92    "ability_base:zuri",
93    "ability_runtime:app_manager",
94    "ability_runtime:wantagent_innerkits",
95    "access_token:libaccesstoken_sdk",
96    "access_token:libtokenid_sdk",
97    "bundle_framework:appexecfwk_base",
98    "c_utils:utils",
99    "common_event_service:cesfwk_innerkits",
100    "eventhandler:libeventhandler",
101    "hilog:libhilog",
102    "init:libbegetutil",
103    "ipc:ipc_single",
104    "power_manager:powermgr_client",
105    "safwk:system_ability_fwk",
106    "samgr:samgr_proxy",
107    "time_service:time_client",
108  ]
109
110  defines = []
111  if (enable_background_task_mgr) {
112    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
113    defines += [ "ENABLE_BACKGROUND_TASK_MGR" ]
114  }
115
116  subsystem_name = "resourceschedule"
117  part_name = "${standby_service_part_name}"
118}
119
120ohos_unittest("standby_helper_unit_test") {
121  module_out_path = module_output_path
122  cflags_cc = [
123    "-Dprivate=public",
124    "-Dprotected=public",
125  ]
126
127  sources = [ "standby_helper_unit_test.cpp" ]
128
129  deps = [
130    "${standby_service_path}:standby_service_static",
131    "${standby_utils_common_path}:standby_utils_common",
132    "${standby_utils_policy_path}:standby_utils_policy_static",
133  ]
134
135  external_deps = [
136    "ability_base:base",
137    "ability_base:want",
138    "ability_base:zuri",
139    "ability_runtime:app_manager",
140    "ability_runtime:wantagent_innerkits",
141    "access_token:libaccesstoken_sdk",
142    "access_token:libtokenid_sdk",
143    "bundle_framework:appexecfwk_base",
144    "c_utils:utils",
145    "common_event_service:cesfwk_innerkits",
146    "eventhandler:libeventhandler",
147    "hilog:libhilog",
148    "init:libbegetutil",
149    "ipc:ipc_single",
150    "power_manager:powermgr_client",
151    "safwk:system_ability_fwk",
152    "samgr:samgr_proxy",
153    "time_service:time_client",
154  ]
155
156  defines = []
157  if (enable_background_task_mgr) {
158    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
159    defines += [ "ENABLE_BACKGROUND_TASK_MGR" ]
160  }
161
162  subsystem_name = "resourceschedule"
163  part_name = "${standby_service_part_name}"
164}
165
166ohos_unittest("mock_standby_helper_unit_test") {
167  module_out_path = module_output_path
168  cflags_cc = [
169    "-Dprivate=public",
170    "-Dprotected=public",
171  ]
172
173  sources = [
174    "mock/mock_connect.cpp",
175    "mock/mock_standby_helper_unit_test.cpp",
176  ]
177
178  deps = [
179    "${standby_service_path}:standby_service_static",
180    "${standby_utils_common_path}:standby_utils_common",
181    "${standby_utils_policy_path}:standby_utils_policy_static",
182  ]
183
184  external_deps = [
185    "ability_base:base",
186    "ability_base:want",
187    "ability_base:zuri",
188    "ability_runtime:app_manager",
189    "ability_runtime:wantagent_innerkits",
190    "access_token:libaccesstoken_sdk",
191    "access_token:libtokenid_sdk",
192    "bundle_framework:appexecfwk_base",
193    "c_utils:utils",
194    "common_event_service:cesfwk_innerkits",
195    "eventhandler:libeventhandler",
196    "hilog:libhilog",
197    "init:libbegetutil",
198    "ipc:ipc_single",
199    "power_manager:powermgr_client",
200    "safwk:system_ability_fwk",
201    "samgr:samgr_proxy",
202    "time_service:time_client",
203  ]
204
205  defines = []
206  if (enable_background_task_mgr) {
207    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
208    defines += [ "ENABLE_BACKGROUND_TASK_MGR" ]
209  }
210
211  subsystem_name = "resourceschedule"
212  part_name = "${standby_service_part_name}"
213}
214
215group("unittest") {
216  testonly = true
217
218  deps = [
219    ":mock_standby_helper_unit_test",
220    ":standby_helper_unit_test",
221    ":standby_service_unit_test",
222    ":standby_utils_unit_test",
223  ]
224}
225