• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 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("//base/powermgr/thermal_manager/thermalmgr.gni")
15import("//build/test.gni")
16
17module_output_path = "thermal_manager/thermal_native"
18
19###############################################################################
20config("module_private_config") {
21  visibility = [ ":*" ]
22  include_dirs = [
23    "../mock_client/include",
24    "include",
25    "mock/include",
26    "${utils_path}/native/include",
27    "${thermal_service_zidl}/include",
28    "${ability_runtime_services_path}/appmgr/include",
29    "${thermal_innerkits}/native/include",
30  ]
31}
32
33deps_ex = [
34  "ability_base:base",
35  "ability_base:want",
36  "battery_manager:batterysrv_client",
37  "bundle_framework:appexecfwk_base",
38  "c_utils:utils",
39  "eventhandler:libeventhandler",
40  "ipc:ipc_core",
41  "hdf_core:libhdi",
42  "hiviewdfx_hilog_native:libhilog",
43  "power_manager:powermgr_client",
44  "safwk:system_ability_fwk",
45  "samgr:samgr_proxy",
46  "common_event_service:cesfwk_innerkits",
47  "appspawn:appspawn_socket_client",
48  "window_manager:libwm",
49  "drivers_interface_thermal:libthermal_proxy_1.0",
50]
51
52# thermal service test
53ohos_unittest("ThermalPolicyTest") {
54  module_out_path = module_output_path
55
56  sources = [ "src/thermal_mgr_policy_test.cpp" ]
57
58  configs = [
59    "${utils_path}:utils_config",
60    ":module_private_config",
61  ]
62
63  deps = [
64    "${ability_runtime_services_path}/appmgr:libappms",
65    "${thermal_innerkits}:thermalsrv_client",
66    "${thermal_manager_path}/services:thermalservice",
67    "${thermal_manager_path}/services/native/test/mock_client:mock_thermalsrv_client",
68    "//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr",
69    "//third_party/googletest:gtest_main",
70  ]
71
72  external_deps = deps_ex
73}
74
75# thermal level event test
76ohos_unittest("ThermalLevelEventTest") {
77  module_out_path = module_output_path
78
79  sources = [ "src/thermal_level_event_test.cpp" ]
80
81  configs = [
82    "${utils_path}:utils_config",
83    ":module_private_config",
84  ]
85
86  deps = [
87    "${ability_runtime_services_path}/appmgr:libappms",
88    "${thermal_innerkits}:thermalsrv_client",
89    "${thermal_manager_path}/services:thermalservice",
90    "${thermal_manager_path}/services/native/test/mock_client:mock_thermalsrv_client",
91    "//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr",
92    "//third_party/googletest:gtest_main",
93  ]
94
95  external_deps = deps_ex
96}
97
98# thermal client api test
99ohos_unittest("ThermalClientApiTest") {
100  module_out_path = module_output_path
101
102  sources = [ "src/thermal_client_api_test.cpp" ]
103
104  configs = [
105    "${utils_path}:utils_config",
106    ":module_private_config",
107  ]
108
109  deps = [
110    "${ability_runtime_services_path}/appmgr:libappms",
111    "${thermal_innerkits}:thermalsrv_client",
112    "${thermal_manager_path}/services:thermalservice",
113    "${thermal_manager_path}/services/native/test/mock_client:mock_thermalsrv_client",
114    "//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr",
115    "//third_party/googletest:gtest_main",
116  ]
117
118  external_deps = deps_ex
119}
120
121# thermal action hub test
122ohos_unittest("ThermalActionHubTest") {
123  module_out_path = module_output_path
124
125  sources = [ "src/thermal_action_hub_test.cpp" ]
126
127  configs = [
128    "${utils_path}:utils_config",
129    ":module_private_config",
130  ]
131
132  deps = [
133    "${ability_runtime_services_path}/appmgr:libappms",
134    "${thermal_innerkits}:thermalsrv_client",
135    "${thermal_manager_path}/services:thermalservice",
136    "${thermal_manager_path}/services/native/test/mock_client:mock_thermalsrv_client",
137    "${thermal_service_zidl}:thermalmgr_proxy",
138    "${thermal_service_zidl}:thermalmgr_stub",
139    "//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr",
140    "//third_party/googletest:gtest_main",
141  ]
142
143  external_deps = deps_ex
144}
145
146# thermal action report test
147ohos_unittest("ThermalActionReportTest") {
148  module_out_path = module_output_path
149
150  sources = [
151    "src/thermal_action_report_test.cpp",
152    "src/thermal_config_file_parser.cpp",
153  ]
154
155  configs = [
156    "${utils_path}:utils_config",
157    ":module_private_config",
158  ]
159
160  deps = [
161    "${ability_runtime_services_path}/appmgr:libappms",
162    "${thermal_innerkits}:thermalsrv_client",
163    "${thermal_manager_path}/services:thermalservice",
164    "${thermal_manager_path}/services/native/test/mock_client:mock_thermalsrv_client",
165    "//base/powermgr/battery_statistics/interfaces/innerkits:batterystats_client",
166    "//base/powermgr/battery_statistics/utils:batterystats_utils",
167    "//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr",
168    "//third_party/googletest:gtest_main",
169    "//third_party/libxml2:libxml2",
170  ]
171
172  external_deps = deps_ex
173}
174
175# thermal mock proxy test
176ohos_unittest("ThermalMockProxyTest") {
177  module_out_path = module_output_path
178
179  sources = [
180    "mock/src/mock_thermal_remote_object.cpp",
181    "src/thermal_mock_proxy_test.cpp",
182  ]
183
184  configs = [
185    "${utils_path}:utils_config",
186    ":module_private_config",
187  ]
188
189  deps = [
190    "${ability_runtime_services_path}/appmgr:libappms",
191    "${thermal_innerkits}:thermalsrv_client",
192    "${thermal_manager_path}/services:thermalservice",
193    "${thermal_service_zidl}:thermalmgr_proxy",
194    "${thermal_service_zidl}:thermalmgr_stub",
195    "//third_party/googletest:gtest_main",
196  ]
197
198  external_deps = deps_ex
199}
200
201# thermal mock proxy remote test
202ohos_unittest("ThermalMockProxyRemoteTest") {
203  module_out_path = module_output_path
204
205  sources = [
206    "mock/src/mock_peer_holder.cpp",
207    "mock/src/mock_thermal_remote_object.cpp",
208    "src/thermal_mock_proxy_remote_test.cpp",
209  ]
210
211  configs = [
212    "${utils_path}:utils_config",
213    ":module_private_config",
214  ]
215
216  deps = [
217    "${ability_runtime_services_path}/appmgr:libappms",
218    "${thermal_innerkits}:thermalsrv_client",
219    "${thermal_manager_path}/services:thermalservice",
220    "${thermal_service_zidl}:thermalmgr_proxy",
221    "${thermal_service_zidl}:thermalmgr_stub",
222    "//third_party/googletest:gtest_main",
223  ]
224
225  external_deps = deps_ex
226}
227
228# thermal mock proxy writeinterfacetoken test
229ohos_unittest("ThermalMockProxyWriteinterfacetokenTest") {
230  module_out_path = module_output_path
231
232  sources = [
233    "mock/src/mock_message_parcel.cpp",
234    "mock/src/mock_thermal_remote_object.cpp",
235    "src/thermal_mock_proxy_writeinterfacetoken_test.cpp",
236  ]
237
238  configs = [
239    "${utils_path}:utils_config",
240    ":module_private_config",
241  ]
242
243  defines = [ "MOCK_WRITE_INTERFACE_TOKEN_RETURN_FALSE" ]
244
245  deps = [
246    "${ability_runtime_services_path}/appmgr:libappms",
247    "${thermal_innerkits}:thermalsrv_client",
248    "${thermal_manager_path}/services:thermalservice",
249    "${thermal_service_zidl}:thermalmgr_proxy",
250    "${thermal_service_zidl}:thermalmgr_stub",
251    "//third_party/googletest:gtest_main",
252  ]
253
254  external_deps = deps_ex
255}
256
257# thermal mock proxy writeremoteobject test
258ohos_unittest("ThermalMockProxyWriteremoteobjectTest") {
259  module_out_path = module_output_path
260
261  sources = [
262    "mock/src/mock_message_parcel.cpp",
263    "mock/src/mock_parcel.cpp",
264    "mock/src/mock_thermal_remote_object.cpp",
265    "src/thermal_mock_proxy_writeremoteobject_test.cpp",
266  ]
267
268  configs = [
269    "${utils_path}:utils_config",
270    ":module_private_config",
271  ]
272
273  defines = [ "MOCK_WRITE_REMOTE_OBJECT_RETURN_FALSE" ]
274
275  deps = [
276    "${ability_runtime_services_path}/appmgr:libappms",
277    "${thermal_innerkits}:thermalsrv_client",
278    "${thermal_manager_path}/services:thermalservice",
279    "${thermal_service_zidl}:thermalmgr_proxy",
280    "${thermal_service_zidl}:thermalmgr_stub",
281    "//third_party/googletest:gtest_main",
282  ]
283
284  external_deps = deps_ex
285}
286
287# thermal mock proxy writevector test
288ohos_unittest("ThermalMockProxyWritevectorTest") {
289  module_out_path = module_output_path
290
291  sources = [
292    "mock/src/mock_message_parcel.cpp",
293    "mock/src/mock_parcel.cpp",
294    "mock/src/mock_thermal_remote_object.cpp",
295    "src/thermal_mock_proxy_writevector_test.cpp",
296  ]
297
298  configs = [
299    "${utils_path}:utils_config",
300    ":module_private_config",
301  ]
302
303  defines = [ "MOCK_WRITEVECTOR_RETURN_FALSE" ]
304
305  deps = [
306    "${ability_runtime_services_path}/appmgr:libappms",
307    "${thermal_innerkits}:thermalsrv_client",
308    "${thermal_manager_path}/services:thermalservice",
309    "${thermal_service_zidl}:thermalmgr_proxy",
310    "${thermal_service_zidl}:thermalmgr_stub",
311    "//third_party/googletest:gtest_main",
312  ]
313
314  external_deps = deps_ex
315}
316
317# thermal mock proxy sendrequest test
318ohos_unittest("ThermalMockProxySendrequestTest") {
319  module_out_path = module_output_path
320
321  sources = [
322    "mock/src/mock_message_parcel.cpp",
323    "mock/src/mock_thermal_remote_object.cpp",
324    "src/thermal_mock_proxy_sendrequest_test.cpp",
325  ]
326
327  configs = [
328    "${utils_path}:utils_config",
329    ":module_private_config",
330  ]
331
332  defines = [ "MOCK_SEND_REQUEST_RETURN_ONE" ]
333
334  deps = [
335    "${ability_runtime_services_path}/appmgr:libappms",
336    "${thermal_innerkits}:thermalsrv_client",
337    "${thermal_manager_path}/services:thermalservice",
338    "${thermal_service_zidl}:thermalmgr_proxy",
339    "${thermal_service_zidl}:thermalmgr_stub",
340    "//third_party/googletest:gtest_main",
341  ]
342
343  external_deps = deps_ex
344}
345
346# thermal utils test
347ohos_unittest("ThermalUtilsTest") {
348  module_out_path = module_output_path
349
350  sources = [ "src/thermal_utils_test.cpp" ]
351
352  configs = [
353    "${utils_path}:utils_config",
354    ":module_private_config",
355  ]
356
357  deps = [
358    "${ability_runtime_services_path}/appmgr:libappms",
359    "${thermal_innerkits}:thermalsrv_client",
360    "${thermal_manager_path}/services:thermalservice",
361    "${thermal_service_zidl}:thermalmgr_proxy",
362    "${thermal_service_zidl}:thermalmgr_stub",
363    "//third_party/googletest:gtest_main",
364  ]
365
366  external_deps = deps_ex
367}
368
369# thermal service death test
370ohos_unittest("ThermalServiceDeathTest") {
371  module_out_path = module_output_path
372
373  sources = [
374    "mock/src/mock_thermal_remote_object.cpp",
375    "src/thermal_service_death_test.cpp",
376  ]
377
378  configs = [
379    "${utils_path}:utils_config",
380    ":module_private_config",
381  ]
382
383  defines = [ "THERMAL_SERVICE_DEATH_UT" ]
384
385  deps = [
386    "${ability_runtime_services_path}/appmgr:libappms",
387    "${thermal_innerkits}:thermalsrv_client",
388    "${thermal_manager_path}/services:thermalservice",
389    "${thermal_service_zidl}:thermalmgr_proxy",
390    "${thermal_service_zidl}:thermalmgr_stub",
391    "//third_party/googletest:gtest_main",
392  ]
393
394  external_deps = deps_ex
395}
396
397# thermal listener test
398ohos_unittest("ThermalListenerTest") {
399  module_out_path = module_output_path
400
401  sources = [ "src/thermal_listener_test.cpp" ]
402
403  configs = [
404    "${utils_path}:utils_config",
405    ":module_private_config",
406  ]
407
408  deps = [
409    "${ability_runtime_services_path}/appmgr:libappms",
410    "${thermal_innerkits}:thermalmgr_listener",
411    "${thermal_innerkits}:thermalsrv_client",
412    "${thermal_manager_path}/services:thermalservice",
413    "${thermal_manager_path}/services/native/test/mock_client:mock_thermalsrv_client",
414    "${thermal_service_zidl}:thermalmgr_proxy",
415    "${thermal_service_zidl}:thermalmgr_stub",
416    "//third_party/googletest:gtest_main",
417  ]
418
419  external_deps = deps_ex
420}
421
422# thermal client test
423ohos_unittest("ThermalClientTest") {
424  module_out_path = module_output_path
425
426  sources = [
427    "mock/src/mock_thermal_remote_object.cpp",
428    "src/thermal_client_test.cpp",
429  ]
430
431  configs = [
432    "${utils_path}:utils_config",
433    ":module_private_config",
434  ]
435
436  deps = [
437    "${ability_runtime_services_path}/appmgr:libappms",
438    "${thermal_innerkits}:thermalmgr_listener",
439    "${thermal_innerkits}:thermalsrv_client",
440    "${thermal_manager_path}/services:thermalservice",
441    "${thermal_service_zidl}:thermalmgr_proxy",
442    "${thermal_service_zidl}:thermalmgr_stub",
443    "//third_party/googletest:gtest_main",
444    "//third_party/libxml2:libxml2",
445  ]
446
447  external_deps = [
448    "ability_base:base",
449    "ability_base:want",
450    "appspawn:appspawn_socket_client",
451    "battery_manager:batterysrv_client",
452    "bundle_framework:appexecfwk_base",
453    "c_utils:utils",
454    "common_event_service:cesfwk_innerkits",
455    "drivers_interface_thermal:libthermal_proxy_1.0",
456    "eventhandler:libeventhandler",
457    "hdf_core:libhdi",
458    "hisysevent_native:libhisysevent",
459    "hiviewdfx_hilog_native:libhilog",
460    "ipc:ipc_core",
461    "power_manager:powermgr_client",
462    "safwk:system_ability_fwk",
463    "samgr:samgr_proxy",
464    "window_manager:libwm",
465  ]
466}
467
468# thermal mock stub test
469ohos_unittest("ThermalMockStubTest") {
470  module_out_path = module_output_path
471
472  sources = [
473    "mock/src/mock_thermal_remote_object.cpp",
474    "src/thermal_mock_stub_test.cpp",
475  ]
476
477  configs = [
478    "${utils_path}:utils_config",
479    ":module_private_config",
480  ]
481
482  deps = [
483    "${ability_runtime_services_path}/appmgr:libappms",
484    "${thermal_innerkits}:thermalsrv_client",
485    "${thermal_manager_path}/services:thermalservice",
486    "${thermal_service_zidl}:thermalmgr_proxy",
487    "${thermal_service_zidl}:thermalmgr_stub",
488    "//third_party/googletest:gtest_main",
489  ]
490
491  external_deps = deps_ex
492}
493
494# thermal mock stub getdescriptor test
495ohos_unittest("ThermalMockStubGetdescriptorTest") {
496  module_out_path = module_output_path
497
498  sources = [
499    "mock/src/mock_message_parcel.cpp",
500    "mock/src/mock_parcel.cpp",
501    "mock/src/mock_thermal_remote_object.cpp",
502    "src/thermal_mock_stub_getdescriptor_test.cpp",
503  ]
504
505  configs = [
506    "${utils_path}:utils_config",
507    ":module_private_config",
508  ]
509
510  deps = [
511    "${ability_runtime_services_path}/appmgr:libappms",
512    "${thermal_innerkits}:thermalsrv_client",
513    "${thermal_manager_path}/services:thermalservice",
514    "${thermal_service_zidl}:thermalmgr_proxy",
515    "${thermal_service_zidl}:thermalmgr_stub",
516    "//third_party/googletest:gtest_main",
517  ]
518
519  external_deps = deps_ex
520}
521
522# thermal mock stub readstring test
523ohos_unittest("ThermalMockStubReadstringTest") {
524  module_out_path = module_output_path
525
526  sources = [
527    "mock/src/mock_message_parcel.cpp",
528    "mock/src/mock_parcel.cpp",
529    "mock/src/mock_thermal_remote_object.cpp",
530    "src/thermal_mock_stub_test.cpp",
531  ]
532
533  configs = [
534    "${utils_path}:utils_config",
535    ":module_private_config",
536  ]
537
538  defines = [
539    "MOCK_READ_RETURN_ZERO",
540    "MOCK_READSTRING_RETURN_TRUE",
541    "MOCK_READSTRING16_RETURN_NULL",
542    "MOCK_WRITEVECTOR_RETURN_TRUE",
543  ]
544
545  deps = [
546    "${ability_runtime_services_path}/appmgr:libappms",
547    "${thermal_innerkits}:thermalsrv_client",
548    "${thermal_manager_path}/services:thermalservice",
549    "${thermal_service_zidl}:thermalmgr_proxy",
550    "${thermal_service_zidl}:thermalmgr_stub",
551    "//third_party/googletest:gtest_main",
552  ]
553
554  external_deps = deps_ex
555}
556
557group("unittest") {
558  testonly = true
559  deps = [
560    ":ThermalActionHubTest",
561    ":ThermalActionReportTest",
562    ":ThermalClientApiTest",
563    ":ThermalClientTest",
564    ":ThermalLevelEventTest",
565    ":ThermalListenerTest",
566    ":ThermalMockProxyRemoteTest",
567    ":ThermalMockProxySendrequestTest",
568    ":ThermalMockProxyTest",
569    ":ThermalMockProxyWriteinterfacetokenTest",
570    ":ThermalMockProxyWriteremoteobjectTest",
571    ":ThermalMockProxyWritevectorTest",
572    ":ThermalMockStubGetdescriptorTest",
573    ":ThermalMockStubReadstringTest",
574    ":ThermalMockStubTest",
575    ":ThermalPolicyTest",
576    ":ThermalServiceDeathTest",
577    ":ThermalUtilsTest",
578  ]
579}
580