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