• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2024 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("../../thermalmgr.gni")
16
17module_output_path = "thermal_manager/thermal_manager"
18
19###############################################################################
20config("module_private_config") {
21  visibility = [ ":*" ]
22  include_dirs = [
23    "include",
24    "mock_action/include",
25    "mock/include",
26    "${utils_path}/native/include",
27    "${thermal_manager_path}/services/native/include/thermal_action",
28    "${thermal_manager_path}/test/common/include",
29    "${thermal_service_zidl}/include",
30    "${thermal_inner_api}/native/include",
31  ]
32}
33
34config("module_application_config") {
35  visibility = [ ":*" ]
36  include_dirs = [
37    "include",
38    "${utils_path}/native/include",
39    "${thermal_manager_path}/application/protector/include",
40    "${thermal_manager_path}/application/protector/include/action",
41    "${thermal_manager_path}/application/protector/include/policy",
42  ]
43}
44
45deps_ex = [
46  "ability_base:base",
47  "ability_base:want",
48  "ability_runtime:ability_manager",
49  "ability_runtime:app_manager",
50  "bundle_framework:appexecfwk_base",
51  "c_utils:utils",
52  "config_policy:configpolicy_util",
53  "eventhandler:libeventhandler",
54  "googletest:gmock_main",
55  "googletest:gtest_main",
56  "ipc:ipc_core",
57  "hdf_core:libhdi",
58  "hdf_core:libpub_utils",
59  "hilog:libhilog",
60  "libxml2:libxml2",
61  "power_manager:powermgr_client",
62  "safwk:system_ability_fwk",
63  "samgr:samgr_proxy",
64  "common_event_service:cesfwk_innerkits",
65  "window_manager:libwm",
66  "drivers_interface_thermal:libthermal_proxy_1.1",
67  "time_service:time_client",
68]
69
70# thermal mock action test
71ohos_unittest("ThermalMockActionTest") {
72  sanitize = {
73    cfi = true
74    cfi_cross_dso = true
75    debug = false
76  }
77
78  module_out_path = module_output_path
79
80  sources = [
81    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
82    "${thermal_manager_path}/test/unittest/mock_action/src/mock_socperf_action.cpp",
83    "src/thermal_mock_action_test.cpp",
84  ]
85
86  configs = [
87    "${utils_path}:utils_config",
88    ":module_private_config",
89    "${utils_path}:coverage_flags",
90  ]
91
92  defines = [ "THERMAL_GTEST" ]
93
94  deps = [
95    "${thermal_inner_api}:thermalsrv_client",
96    "${thermal_manager_path}/services:thermalservice",
97    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
98    "${thermal_service_zidl}:thermalmgr_stub",
99  ]
100
101  external_deps = deps_ex
102
103  if (defined(global_parts_info) &&
104      defined(global_parts_info.powermgr_battery_manager)) {
105    defines += [ "BATTERY_MANAGER_ENABLE" ]
106    external_deps += [ "battery_manager:batterysrv_client" ]
107  }
108
109  if (has_thermal_airplane_manager_part) {
110    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
111    external_deps += [ "netmanager_base:net_conn_manager_if" ]
112  }
113
114  if (defined(global_parts_info) &&
115      defined(global_parts_info.hdf_drivers_interface_battery)) {
116    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
117    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
118  }
119}
120
121# thermal policy test
122ohos_unittest("ThermalMgrPolicyTest") {
123  sanitize = {
124    cfi = true
125    cfi_cross_dso = true
126    debug = false
127  }
128
129  module_out_path = module_output_path
130
131  sources = [
132    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
133    "src/thermal_mgr_policy_test.cpp",
134  ]
135
136  configs = [
137    "${utils_path}:utils_config",
138    ":module_private_config",
139  ]
140
141  deps = [
142    "${thermal_inner_api}:thermalsrv_client",
143    "${thermal_manager_path}/services:thermalservice",
144    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
145    "${thermal_service_zidl}:thermalmgr_proxy",
146    "${thermal_service_zidl}:thermalmgr_stub",
147  ]
148
149  external_deps = deps_ex
150
151  external_deps += [ "init:libbegetutil" ]
152
153  defines = []
154  if (has_thermal_airplane_manager_part) {
155    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
156    external_deps += [ "netmanager_base:net_conn_manager_if" ]
157  }
158
159  if (defined(global_parts_info) &&
160      defined(global_parts_info.hdf_drivers_interface_battery)) {
161    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
162    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
163  }
164}
165
166# thermal level event test
167ohos_unittest("ThermalLevelEventTest") {
168  sanitize = {
169    cfi = true
170    cfi_cross_dso = true
171    debug = false
172  }
173
174  module_out_path = module_output_path
175
176  sources = [
177    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
178    "src/thermal_config_file_parser.cpp",
179    "src/thermal_level_event_test.cpp",
180  ]
181
182  configs = [
183    "${utils_path}:utils_config",
184    ":module_private_config",
185    "${utils_path}:coverage_flags",
186  ]
187
188  deps = [
189    "${thermal_inner_api}:thermalsrv_client",
190    "${thermal_manager_path}/services:thermalservice",
191    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
192    "${thermal_service_zidl}:thermalmgr_stub",
193  ]
194
195  external_deps = deps_ex
196  external_deps += [
197    "access_token:libaccesstoken_sdk",
198    "access_token:libnativetoken",
199    "access_token:libprivacy_sdk",
200    "access_token:libtoken_setproc",
201  ]
202
203  defines = []
204  if (has_thermal_airplane_manager_part) {
205    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
206    external_deps += [ "netmanager_base:net_conn_manager_if" ]
207  }
208
209  if (defined(global_parts_info) &&
210      defined(global_parts_info.hdf_drivers_interface_battery)) {
211    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
212    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
213  }
214}
215
216# thermal client api test
217ohos_unittest("ThermalClientApiTest") {
218  sanitize = {
219    cfi = true
220    cfi_cross_dso = true
221    debug = false
222  }
223
224  module_out_path = module_output_path
225
226  sources = [ "src/thermal_client_api_test.cpp" ]
227
228  configs = [
229    "${utils_path}:utils_config",
230    ":module_private_config",
231    "${utils_path}:coverage_flags",
232  ]
233
234  deps = [
235    "${thermal_inner_api}:thermalsrv_client",
236    "${thermal_manager_path}/services:thermalservice",
237    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
238    "${thermal_service_zidl}:thermalmgr_stub",
239  ]
240
241  external_deps = deps_ex
242
243  defines = []
244  if (has_thermal_airplane_manager_part) {
245    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
246    external_deps += [ "netmanager_base:net_conn_manager_if" ]
247  }
248
249  if (defined(global_parts_info) &&
250      defined(global_parts_info.hdf_drivers_interface_battery)) {
251    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
252    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
253  }
254}
255
256# thermal action hub test
257ohos_unittest("ThermalActionHubTest") {
258  sanitize = {
259    cfi = true
260    cfi_cross_dso = true
261    debug = false
262  }
263
264  module_out_path = module_output_path
265
266  sources = [
267    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
268    "src/thermal_action_hub_test.cpp",
269  ]
270
271  configs = [
272    "${utils_path}:utils_config",
273    ":module_private_config",
274    "${utils_path}:coverage_flags",
275  ]
276
277  deps = [
278    "${thermal_inner_api}:thermalsrv_client",
279    "${thermal_manager_path}/services:thermalservice",
280    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
281    "${thermal_service_zidl}:thermalmgr_proxy",
282    "${thermal_service_zidl}:thermalmgr_stub",
283  ]
284
285  external_deps = deps_ex
286
287  defines = []
288  if (has_thermal_airplane_manager_part) {
289    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
290    external_deps += [ "netmanager_base:net_conn_manager_if" ]
291  }
292
293  if (defined(global_parts_info) &&
294      defined(global_parts_info.hdf_drivers_interface_battery)) {
295    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
296    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
297  }
298}
299
300# thermal action report test
301ohos_unittest("ThermalActionReportTest") {
302  sanitize = {
303    cfi = true
304    cfi_cross_dso = true
305    debug = false
306  }
307
308  module_out_path = module_output_path
309
310  sources = [
311    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
312    "src/thermal_action_report_test.cpp",
313    "src/thermal_config_file_parser.cpp",
314  ]
315
316  configs = [
317    "${utils_path}:utils_config",
318    ":module_private_config",
319    "${utils_path}:coverage_flags",
320  ]
321
322  deps = [
323    "${thermal_inner_api}:thermalsrv_client",
324    "${thermal_manager_path}/services:thermalservice",
325    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
326    "${thermal_service_zidl}:thermalmgr_stub",
327  ]
328
329  defines = []
330  if (defined(global_parts_info) &&
331      defined(global_parts_info.powermgr_battery_statistics)) {
332    defines += [ "BATTERY_STATS_ENABLE" ]
333    external_deps = [
334      "battery_statistics:batterystats_client",
335      "battery_statistics:batterystats_utils",
336    ]
337    external_deps += deps_ex
338  } else {
339    external_deps = deps_ex
340  }
341
342  if (defined(global_parts_info) &&
343      defined(global_parts_info.powermgr_battery_manager)) {
344    defines += [ "BATTERY_MANAGER_ENABLE" ]
345    external_deps += [ "battery_manager:batterysrv_client" ]
346  }
347
348  if (has_thermal_airplane_manager_part) {
349    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
350    external_deps += [ "netmanager_base:net_conn_manager_if" ]
351  }
352
353  if (defined(global_parts_info) &&
354      defined(global_parts_info.hdf_drivers_interface_battery)) {
355    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
356    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
357  }
358}
359
360# thermal mock proxy test
361ohos_unittest("ThermalMockProxyTest") {
362  sanitize = {
363    cfi = true
364    cfi_cross_dso = true
365    debug = false
366  }
367
368  module_out_path = module_output_path
369
370  sources = [
371    "mock/src/mock_thermal_remote_object.cpp",
372    "src/thermal_mock_proxy_test.cpp",
373  ]
374
375  configs = [
376    "${utils_path}:utils_config",
377    ":module_private_config",
378    "${utils_path}:coverage_flags",
379  ]
380
381  deps = [
382    "${thermal_inner_api}:thermalsrv_client",
383    "${thermal_manager_path}/services:thermalservice",
384    "${thermal_service_zidl}:thermalmgr_proxy",
385    "${thermal_service_zidl}:thermalmgr_stub",
386  ]
387
388  external_deps = deps_ex
389
390  defines = []
391  if (has_thermal_airplane_manager_part) {
392    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
393    external_deps += [ "netmanager_base:net_conn_manager_if" ]
394  }
395
396  if (defined(global_parts_info) &&
397      defined(global_parts_info.hdf_drivers_interface_battery)) {
398    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
399    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
400  }
401}
402
403# thermal mock proxy remote test
404ohos_unittest("ThermalMockProxyRemoteTest") {
405  sanitize = {
406    cfi = true
407    cfi_cross_dso = true
408    debug = false
409  }
410
411  module_out_path = module_output_path
412
413  sources = [
414    "mock/src/mock_peer_holder.cpp",
415    "mock/src/mock_thermal_remote_object.cpp",
416    "src/thermal_mock_proxy_remote_test.cpp",
417  ]
418
419  configs = [
420    "${utils_path}:utils_config",
421    ":module_private_config",
422    "${utils_path}:coverage_flags",
423  ]
424
425  deps = [
426    "${thermal_inner_api}:thermalsrv_client",
427    "${thermal_manager_path}/services:thermalservice",
428    "${thermal_service_zidl}:thermalmgr_proxy",
429    "${thermal_service_zidl}:thermalmgr_stub",
430  ]
431
432  external_deps = deps_ex
433
434  defines = []
435  if (has_thermal_airplane_manager_part) {
436    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
437    external_deps += [ "netmanager_base:net_conn_manager_if" ]
438  }
439
440  if (defined(global_parts_info) &&
441      defined(global_parts_info.hdf_drivers_interface_battery)) {
442    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
443    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
444  }
445}
446
447# thermal mock proxy writeinterfacetoken test
448ohos_unittest("ThermalMockProxyWriteinterfacetokenTest") {
449  sanitize = {
450    cfi = true
451    cfi_cross_dso = true
452    debug = false
453  }
454
455  module_out_path = module_output_path
456
457  sources = [
458    "mock/src/mock_message_parcel.cpp",
459    "mock/src/mock_thermal_remote_object.cpp",
460    "src/thermal_mock_proxy_writeinterfacetoken_test.cpp",
461  ]
462
463  configs = [
464    "${utils_path}:utils_config",
465    ":module_private_config",
466    "${utils_path}:coverage_flags",
467  ]
468
469  defines = [ "MOCK_WRITE_INTERFACE_TOKEN_RETURN_FALSE" ]
470
471  deps = [
472    "${thermal_inner_api}:thermalsrv_client",
473    "${thermal_manager_path}/services:thermalservice",
474    "${thermal_service_zidl}:thermalmgr_proxy",
475    "${thermal_service_zidl}:thermalmgr_stub",
476  ]
477
478  external_deps = deps_ex
479
480  if (has_thermal_airplane_manager_part) {
481    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
482    external_deps += [ "netmanager_base:net_conn_manager_if" ]
483  }
484
485  if (defined(global_parts_info) &&
486      defined(global_parts_info.hdf_drivers_interface_battery)) {
487    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
488    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
489  }
490}
491
492# thermal mock proxy writeremoteobject test
493ohos_unittest("ThermalMockProxyWriteremoteobjectTest") {
494  sanitize = {
495    cfi = true
496    cfi_cross_dso = true
497    debug = false
498  }
499
500  module_out_path = module_output_path
501
502  sources = [
503    "mock/src/mock_message_parcel.cpp",
504    "mock/src/mock_parcel.cpp",
505    "mock/src/mock_thermal_remote_object.cpp",
506    "src/thermal_mock_proxy_writeremoteobject_test.cpp",
507  ]
508
509  configs = [
510    "${utils_path}:utils_config",
511    ":module_private_config",
512    "${utils_path}:coverage_flags",
513  ]
514
515  defines = [ "MOCK_WRITE_REMOTE_OBJECT_RETURN_FALSE" ]
516
517  deps = [
518    "${thermal_inner_api}:thermalsrv_client",
519    "${thermal_manager_path}/services:thermalservice",
520    "${thermal_service_zidl}:thermalmgr_proxy",
521    "${thermal_service_zidl}:thermalmgr_stub",
522  ]
523
524  external_deps = deps_ex
525
526  if (has_thermal_airplane_manager_part) {
527    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
528    external_deps += [ "netmanager_base:net_conn_manager_if" ]
529  }
530
531  if (defined(global_parts_info) &&
532      defined(global_parts_info.hdf_drivers_interface_battery)) {
533    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
534    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
535  }
536}
537
538# thermal mock proxy writevector test
539ohos_unittest("ThermalMockProxyWritevectorTest") {
540  sanitize = {
541    cfi = true
542    cfi_cross_dso = true
543    debug = false
544  }
545
546  module_out_path = module_output_path
547
548  sources = [
549    "mock/src/mock_message_parcel.cpp",
550    "mock/src/mock_parcel.cpp",
551    "mock/src/mock_thermal_remote_object.cpp",
552    "src/thermal_mock_proxy_writevector_test.cpp",
553  ]
554
555  configs = [
556    "${utils_path}:utils_config",
557    ":module_private_config",
558    "${utils_path}:coverage_flags",
559  ]
560
561  defines = [ "MOCK_WRITEVECTOR_RETURN_FALSE" ]
562
563  deps = [
564    "${thermal_inner_api}:thermalsrv_client",
565    "${thermal_manager_path}/services:thermalservice",
566    "${thermal_service_zidl}:thermalmgr_proxy",
567    "${thermal_service_zidl}:thermalmgr_stub",
568  ]
569
570  external_deps = deps_ex
571
572  if (has_thermal_airplane_manager_part) {
573    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
574    external_deps += [ "netmanager_base:net_conn_manager_if" ]
575  }
576
577  if (defined(global_parts_info) &&
578      defined(global_parts_info.hdf_drivers_interface_battery)) {
579    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
580    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
581  }
582}
583
584# thermal mock proxy sendrequest test
585ohos_unittest("ThermalMockProxySendrequestTest") {
586  sanitize = {
587    cfi = true
588    cfi_cross_dso = true
589    debug = false
590  }
591
592  module_out_path = module_output_path
593
594  sources = [
595    "mock/src/mock_message_parcel.cpp",
596    "mock/src/mock_thermal_remote_object.cpp",
597    "src/thermal_mock_proxy_sendrequest_test.cpp",
598  ]
599
600  configs = [
601    "${utils_path}:utils_config",
602    ":module_private_config",
603    "${utils_path}:coverage_flags",
604  ]
605
606  defines = [ "MOCK_SEND_REQUEST_RETURN_ONE" ]
607
608  deps = [
609    "${thermal_inner_api}:thermalsrv_client",
610    "${thermal_manager_path}/services:thermalservice",
611    "${thermal_service_zidl}:thermalmgr_proxy",
612    "${thermal_service_zidl}:thermalmgr_stub",
613  ]
614
615  external_deps = deps_ex
616
617  if (has_thermal_airplane_manager_part) {
618    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
619    external_deps += [ "netmanager_base:net_conn_manager_if" ]
620  }
621
622  if (defined(global_parts_info) &&
623      defined(global_parts_info.hdf_drivers_interface_battery)) {
624    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
625    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
626  }
627}
628
629# thermal utils test
630ohos_unittest("ThermalUtilsTest") {
631  sanitize = {
632    cfi = true
633    cfi_cross_dso = true
634    debug = false
635  }
636
637  module_out_path = module_output_path
638
639  sources = [ "src/thermal_utils_test.cpp" ]
640
641  configs = [
642    "${utils_path}:utils_config",
643    ":module_private_config",
644    "${utils_path}:coverage_flags",
645  ]
646
647  deps = [
648    "${thermal_inner_api}:thermalsrv_client",
649    "${thermal_manager_path}/services:thermalservice",
650    "${thermal_service_zidl}:thermalmgr_proxy",
651    "${thermal_service_zidl}:thermalmgr_stub",
652  ]
653
654  external_deps = deps_ex
655
656  defines = []
657  if (has_thermal_airplane_manager_part) {
658    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
659    external_deps += [ "netmanager_base:net_conn_manager_if" ]
660  }
661
662  if (defined(global_parts_info) &&
663      defined(global_parts_info.hdf_drivers_interface_battery)) {
664    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
665    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
666  }
667}
668
669# thermal application test
670ohos_unittest("ThermalApplicationTest") {
671  sanitize = {
672    cfi = true
673    cfi_cross_dso = true
674    debug = false
675  }
676
677  module_out_path = module_output_path
678
679  sources = [
680    "${thermal_manager_path}/application/protector/src/action/cpu_action.cpp",
681    "${thermal_manager_path}/application/protector/src/action/current_action.cpp",
682    "${thermal_manager_path}/application/protector/src/action/device_control_factory.cpp",
683    "${thermal_manager_path}/application/protector/src/action/thermal_device_control.cpp",
684    "${thermal_manager_path}/application/protector/src/action/voltage_action.cpp",
685    "${thermal_manager_path}/application/protector/src/policy/protector_thermal_zone_info.cpp",
686    "${thermal_manager_path}/application/protector/src/policy/thermal_kernel_config_file.cpp",
687    "${thermal_manager_path}/application/protector/src/policy/thermal_kernel_policy.cpp",
688    "${thermal_manager_path}/application/protector/src/thermal_kernel_service.cpp",
689    "${thermal_manager_path}/application/protector/src/thermal_protector_timer.cpp",
690    "${thermal_manager_path}/application/protector/src/thermal_protector_utils.cpp",
691    "${thermal_manager_path}/application/protector/src/thermal_sensor_provision.cpp",
692    "src/thermal_application_test.cpp",
693  ]
694
695  configs = [
696    "${utils_path}:utils_config",
697    ":module_application_config",
698    "${utils_path}:coverage_flags",
699  ]
700
701  deps = [ "${utils_path}:thermal_utils" ]
702
703  defines = []
704  external_deps = deps_ex
705  external_deps += [ "googletest:gtest_main" ]
706  defines += [ "THERMAL_GTEST" ]
707}
708
709# thermal service death test
710ohos_unittest("ThermalServiceDeathTest") {
711  sanitize = {
712    cfi = true
713    cfi_cross_dso = true
714    debug = false
715  }
716
717  module_out_path = module_output_path
718
719  sources = [
720    "mock/src/mock_thermal_remote_object.cpp",
721    "src/thermal_service_death_test.cpp",
722  ]
723
724  configs = [
725    "${utils_path}:utils_config",
726    ":module_private_config",
727    "${utils_path}:coverage_flags",
728  ]
729
730  defines = [ "THERMAL_SERVICE_DEATH_UT" ]
731
732  deps = [
733    "${thermal_inner_api}:thermalsrv_client",
734    "${thermal_manager_path}/services:thermalservice",
735    "${thermal_service_zidl}:thermalmgr_proxy",
736    "${thermal_service_zidl}:thermalmgr_stub",
737  ]
738
739  external_deps = deps_ex
740
741  if (has_thermal_airplane_manager_part) {
742    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
743    external_deps += [ "netmanager_base:net_conn_manager_if" ]
744  }
745
746  if (defined(global_parts_info) &&
747      defined(global_parts_info.hdf_drivers_interface_battery)) {
748    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
749    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
750  }
751}
752
753# thermal listener test
754ohos_unittest("ThermalListenerTest") {
755  sanitize = {
756    cfi = true
757    cfi_cross_dso = true
758    debug = false
759  }
760
761  module_out_path = module_output_path
762
763  sources = [
764    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
765    "src/thermal_listener_test.cpp",
766  ]
767
768  configs = [
769    "${utils_path}:utils_config",
770    ":module_private_config",
771    "${utils_path}:coverage_flags",
772  ]
773
774  deps = [
775    "${thermal_inner_api}:thermalmgr_listener",
776    "${thermal_inner_api}:thermalsrv_client",
777    "${thermal_manager_path}/services:thermalservice",
778    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
779    "${thermal_service_zidl}:thermalmgr_proxy",
780    "${thermal_service_zidl}:thermalmgr_stub",
781  ]
782
783  external_deps = deps_ex
784
785  defines = []
786  if (has_thermal_airplane_manager_part) {
787    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
788    external_deps += [ "netmanager_base:net_conn_manager_if" ]
789  }
790
791  if (defined(global_parts_info) &&
792      defined(global_parts_info.hdf_drivers_interface_battery)) {
793    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
794    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
795  }
796}
797
798# thermal client test
799ohos_unittest("ThermalClientTest") {
800  sanitize = {
801    cfi = true
802    cfi_cross_dso = true
803    debug = false
804  }
805
806  module_out_path = module_output_path
807
808  sources = [
809    "mock/src/mock_thermal_remote_object.cpp",
810    "src/thermal_client_test.cpp",
811  ]
812
813  configs = [
814    "${utils_path}:utils_config",
815    ":module_private_config",
816    "${utils_path}:coverage_flags",
817  ]
818
819  deps = [
820    "${thermal_inner_api}:thermalmgr_listener",
821    "${thermal_inner_api}:thermalsrv_client",
822    "${thermal_manager_path}/services:thermalservice",
823    "${thermal_service_zidl}:thermalmgr_proxy",
824    "${thermal_service_zidl}:thermalmgr_stub",
825  ]
826
827  external_deps = [
828    "ability_base:base",
829    "ability_base:want",
830    "bundle_framework:appexecfwk_base",
831    "c_utils:utils",
832    "common_event_service:cesfwk_innerkits",
833    "drivers_interface_thermal:libthermal_proxy_1.1",
834    "hdf_core:libhdi",
835    "hdf_core:libpub_utils",
836    "hilog:libhilog",
837    "hisysevent:libhisysevent",
838    "ipc:ipc_core",
839    "libxml2:libxml2",
840    "power_manager:powermgr_client",
841    "safwk:system_ability_fwk",
842    "samgr:samgr_proxy",
843    "window_manager:libwm",
844  ]
845
846  defines = []
847  if (has_thermal_airplane_manager_part) {
848    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
849    external_deps += [ "netmanager_base:net_conn_manager_if" ]
850  }
851
852  if (defined(global_parts_info) &&
853      defined(global_parts_info.hdf_drivers_interface_battery)) {
854    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
855    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
856  }
857}
858
859# thermal mock stub test
860ohos_unittest("ThermalMockStubTest") {
861  sanitize = {
862    cfi = true
863    cfi_cross_dso = true
864    debug = false
865  }
866
867  module_out_path = module_output_path
868  defines = [ "THERMAL_GTEST" ]
869  sources = [ "src/thermal_mock_stub_test.cpp" ]
870
871  configs = [
872    "${utils_path}:utils_config",
873    ":module_private_config",
874    "${utils_path}:coverage_flags",
875  ]
876
877  deps = [
878    "${thermal_inner_api}:thermalsrv_client",
879    "${thermal_manager_path}/services:thermalservice",
880    "${thermal_service_zidl}:thermalmgr_proxy",
881    "${thermal_service_zidl}:thermalmgr_stub",
882  ]
883
884  external_deps = deps_ex
885
886  if (has_thermal_airplane_manager_part) {
887    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
888    external_deps += [ "netmanager_base:net_conn_manager_if" ]
889  }
890
891  if (defined(global_parts_info) &&
892      defined(global_parts_info.hdf_drivers_interface_battery)) {
893    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
894    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
895  }
896}
897
898# thermal mock stub getdescriptor test
899ohos_unittest("ThermalMockStubGetdescriptorTest") {
900  sanitize = {
901    cfi = true
902    cfi_cross_dso = true
903    debug = false
904  }
905
906  module_out_path = module_output_path
907
908  sources = [ "src/thermal_mock_stub_getdescriptor_test.cpp" ]
909
910  configs = [
911    "${utils_path}:utils_config",
912    ":module_private_config",
913    "${utils_path}:coverage_flags",
914  ]
915
916  deps = [
917    "${thermal_inner_api}:thermalsrv_client",
918    "${thermal_manager_path}/services:thermalservice",
919    "${thermal_service_zidl}:thermalmgr_proxy",
920    "${thermal_service_zidl}:thermalmgr_stub",
921  ]
922
923  external_deps = deps_ex
924
925  defines = []
926  if (has_thermal_airplane_manager_part) {
927    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
928    external_deps += [ "netmanager_base:net_conn_manager_if" ]
929  }
930
931  if (defined(global_parts_info) &&
932      defined(global_parts_info.hdf_drivers_interface_battery)) {
933    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
934    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
935  }
936}
937
938# thermal action test
939ohos_unittest("ThermalActionTest") {
940  sanitize = {
941    cfi = true
942    cfi_cross_dso = true
943    debug = false
944  }
945
946  module_out_path = module_output_path
947
948  sources = [
949    "mock/src/mock_thermal_remote_object.cpp",
950    "src/thermal_action_test.cpp",
951  ]
952
953  configs = [
954    "${utils_path}:utils_config",
955    ":module_private_config",
956    "${utils_path}:coverage_flags",
957  ]
958
959  defines = [ "THERMAL_GTEST" ]
960
961  deps = [
962    "${thermal_inner_api}:thermalsrv_client",
963    "${thermal_manager_path}/services:thermalservice",
964    "${thermal_service_zidl}:thermalmgr_proxy",
965    "${thermal_service_zidl}:thermalmgr_stub",
966  ]
967
968  external_deps = deps_ex
969
970  if (has_thermal_airplane_manager_part) {
971    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
972    external_deps += [ "netmanager_base:net_conn_manager_if" ]
973  }
974
975  if (defined(global_parts_info) &&
976      defined(global_parts_info.hdf_drivers_interface_battery)) {
977    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
978    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
979  }
980}
981
982# thermal observer test
983ohos_unittest("ThermalObserverTest") {
984  module_out_path = module_output_path
985
986  sources = [
987    "mock/src/mock_thermal_remote_object.cpp",
988    "src/thermal_observer_test.cpp",
989  ]
990
991  configs = [
992    "${utils_path}:utils_config",
993    ":module_private_config",
994    "${utils_path}:coverage_flags",
995  ]
996
997  defines = [ "THERMAL_OBSERVER_UT_TEST" ]
998
999  deps = [
1000    "${thermal_inner_api}:thermalsrv_client",
1001    "${thermal_manager_path}/services:thermalservice",
1002  ]
1003
1004  external_deps = deps_ex
1005
1006  if (defined(global_parts_info) &&
1007      defined(global_parts_info.powermgr_battery_manager)) {
1008    defines += [ "BATTERY_MANAGER_ENABLE" ]
1009    external_deps += [ "battery_manager:batterysrv_client" ]
1010  }
1011
1012  if (has_thermal_airplane_manager_part) {
1013    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
1014    external_deps += [ "netmanager_base:net_conn_manager_if" ]
1015  }
1016
1017  if (defined(global_parts_info) &&
1018      defined(global_parts_info.hdf_drivers_interface_battery)) {
1019    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
1020    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
1021  }
1022}
1023
1024# thermal service test
1025ohos_unittest("ThermalServiceTest") {
1026  sanitize = {
1027    cfi = true
1028    cfi_cross_dso = true
1029    debug = false
1030  }
1031
1032  module_out_path = module_output_path
1033  defines = [ "THERMAL_GTEST" ]
1034  sources = [ "src/thermal_service_test.cpp" ]
1035
1036  configs = [
1037    "${utils_path}:utils_config",
1038    ":module_private_config",
1039    "${utils_path}:coverage_flags",
1040  ]
1041
1042  deps = [
1043    "${thermal_inner_api}:thermalsrv_client",
1044    "${thermal_manager_path}/services:thermalservice",
1045    "${thermal_service_zidl}:thermalmgr_proxy",
1046    "${thermal_service_zidl}:thermalmgr_stub",
1047  ]
1048
1049  external_deps = deps_ex
1050
1051  external_deps += [ "hicollie:libhicollie" ]
1052
1053  if (has_thermal_airplane_manager_part) {
1054    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
1055    external_deps += [ "netmanager_base:net_conn_manager_if" ]
1056  }
1057
1058  if (defined(global_parts_info) &&
1059      defined(global_parts_info.hdf_drivers_interface_battery)) {
1060    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
1061    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
1062  }
1063}
1064
1065# thermal config sensor cluster test
1066ohos_unittest("ThermalConfigSensorClusterTest") {
1067  sanitize = {
1068    cfi = true
1069    cfi_cross_dso = true
1070    debug = false
1071  }
1072
1073  module_out_path = module_output_path
1074  defines = [ "THERMAL_GTEST" ]
1075  sources = [ "src/thermal_config_sensor_cluster_test.cpp" ]
1076
1077  configs = [
1078    "${utils_path}:utils_config",
1079    ":module_private_config",
1080    "${utils_path}:coverage_flags",
1081  ]
1082
1083  deps = [
1084    "${thermal_inner_api}:thermalsrv_client",
1085    "${thermal_manager_path}/services:thermalservice",
1086    "${thermal_service_zidl}:thermalmgr_proxy",
1087    "${thermal_service_zidl}:thermalmgr_stub",
1088  ]
1089
1090  external_deps = deps_ex
1091
1092  if (has_thermal_airplane_manager_part) {
1093    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
1094    external_deps += [ "netmanager_base:net_conn_manager_if" ]
1095  }
1096
1097  if (defined(global_parts_info) &&
1098      defined(global_parts_info.hdf_drivers_interface_battery)) {
1099    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
1100    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
1101  }
1102}
1103
1104# thermal mgr dump test
1105ohos_unittest("ThermalMgrDumpTest") {
1106  sanitize = {
1107    cfi = true
1108    cfi_cross_dso = true
1109    debug = false
1110  }
1111
1112  module_out_path = module_output_path
1113  defines = [ "THERMAL_GTEST" ]
1114  sources = [ "src/thermal_mgr_dump_test.cpp" ]
1115
1116  configs = [
1117    "${utils_path}:utils_config",
1118    ":module_private_config",
1119    "${utils_path}:coverage_flags",
1120  ]
1121
1122  deps = [
1123    "${thermal_inner_api}:thermalsrv_client",
1124    "${thermal_manager_path}/services:thermalservice",
1125    "${thermal_service_zidl}:thermalmgr_proxy",
1126    "${thermal_service_zidl}:thermalmgr_stub",
1127  ]
1128
1129  external_deps = deps_ex
1130
1131  if (has_thermal_airplane_manager_part) {
1132    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
1133    external_deps += [ "netmanager_base:net_conn_manager_if" ]
1134  }
1135
1136  if (defined(global_parts_info) &&
1137      defined(global_parts_info.hdf_drivers_interface_battery)) {
1138    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
1139    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
1140  }
1141}
1142
1143# thermal policy test
1144ohos_unittest("ThermalPolicyTest") {
1145  sanitize = {
1146    cfi = true
1147    cfi_cross_dso = true
1148    debug = false
1149  }
1150
1151  module_out_path = module_output_path
1152  defines = [ "THERMAL_GTEST" ]
1153  sources = [ "src/thermal_policy_test.cpp" ]
1154
1155  configs = [
1156    "${utils_path}:utils_config",
1157    ":module_private_config",
1158    "${utils_path}:coverage_flags",
1159  ]
1160
1161  deps = [
1162    "${thermal_inner_api}:thermalsrv_client",
1163    "${thermal_manager_path}/services:thermalservice",
1164    "${thermal_service_zidl}:thermalmgr_proxy",
1165    "${thermal_service_zidl}:thermalmgr_stub",
1166  ]
1167
1168  external_deps = deps_ex
1169
1170  external_deps += [ "init:libbegetutil" ]
1171
1172  if (has_thermal_airplane_manager_part) {
1173    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
1174    external_deps += [ "netmanager_base:net_conn_manager_if" ]
1175  }
1176
1177  if (defined(global_parts_info) &&
1178      defined(global_parts_info.hdf_drivers_interface_battery)) {
1179    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
1180    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
1181  }
1182}
1183
1184# fan fault detect test
1185ohos_unittest("FanFaultDetectTest") {
1186  sanitize = {
1187    cfi = true
1188    cfi_cross_dso = true
1189    debug = false
1190  }
1191
1192  module_out_path = module_output_path
1193  defines = [ "THERMAL_GTEST" ]
1194  sources = [ "src/fan_fault_detect_test.cpp" ]
1195
1196  configs = [
1197    "${utils_path}:utils_config",
1198    ":module_private_config",
1199    "${utils_path}:coverage_flags",
1200  ]
1201
1202  deps = [
1203    "${thermal_inner_api}:thermalsrv_client",
1204    "${thermal_manager_path}/services:thermalservice",
1205    "${thermal_service_zidl}:thermalmgr_proxy",
1206    "${thermal_service_zidl}:thermalmgr_stub",
1207  ]
1208
1209  external_deps = [
1210    "hisysevent:libhisysevent",
1211    "hisysevent:libhisyseventmanager",
1212  ]
1213
1214  external_deps += deps_ex
1215
1216  if (has_thermal_airplane_manager_part) {
1217    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
1218    external_deps += [ "netmanager_base:net_conn_manager_if" ]
1219  }
1220
1221  if (defined(global_parts_info) &&
1222      defined(global_parts_info.hdf_drivers_interface_battery)) {
1223    defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ]
1224    external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ]
1225  }
1226}
1227
1228ohos_unittest("ThermalHookMgrTest") {
1229  module_out_path = module_output_path
1230  sources = [ "src/thermal_hookmgr_test.cpp" ]
1231  configs = [
1232    "${utils_path}:utils_config",
1233    "${utils_path}:coverage_flags",
1234  ]
1235  deps = [ "${utils_path}/hookmgr:thermal_hookmgr" ]
1236  external_deps = deps_ex
1237}
1238
1239group("unittest") {
1240  testonly = true
1241  deps = [
1242    ":FanFaultDetectTest",
1243    ":ThermalActionHubTest",
1244    ":ThermalActionReportTest",
1245    ":ThermalActionTest",
1246    ":ThermalApplicationTest",
1247    ":ThermalClientApiTest",
1248    ":ThermalClientTest",
1249    ":ThermalConfigSensorClusterTest",
1250    ":ThermalLevelEventTest",
1251    ":ThermalListenerTest",
1252    ":ThermalMgrDumpTest",
1253    ":ThermalMgrPolicyTest",
1254    ":ThermalMockActionTest",
1255    ":ThermalMockProxyRemoteTest",
1256    ":ThermalMockProxySendrequestTest",
1257    ":ThermalMockProxyTest",
1258    ":ThermalMockProxyWriteinterfacetokenTest",
1259    ":ThermalMockProxyWriteremoteobjectTest",
1260    ":ThermalMockProxyWritevectorTest",
1261    ":ThermalMockStubGetdescriptorTest",
1262    ":ThermalMockStubTest",
1263    ":ThermalObserverTest",
1264    ":ThermalPolicyTest",
1265    ":ThermalServiceDeathTest",
1266    ":ThermalServiceTest",
1267    ":ThermalUtilsTest",
1268    ":ThermalHookMgrTest",
1269  ]
1270}
1271