• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021-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/test.gni")
15import("../../thermalmgr.gni")
16
17module_output_path = "thermal_manager/thermal_native"
18
19###############################################################################
20config("module_private_config") {
21  visibility = [ ":*" ]
22  include_dirs = [
23    "include",
24    "${ability_runtime_services_path}/appmgr/include",
25    "${thermal_manager_path}/test/common/include",
26    "${thermal_service_zidl}/include",
27  ]
28}
29
30deps_ex = [
31  "appspawn:appspawn_socket_client",
32  "ability_base:base",
33  "ability_base:want",
34  "access_token:libaccesstoken_sdk",
35  "access_token:libnativetoken",
36  "access_token:libtoken_setproc",
37  "hdf_core:libhdi",
38  "bundle_framework:appexecfwk_base",
39  "common_event_service:cesfwk_innerkits",
40  "c_utils:utils",
41  "drivers_interface_thermal:libthermal_proxy_1.1",
42  "hilog:libhilog",
43  "ipc:ipc_core",
44  "power_manager:powermgr_client",
45  "safwk:system_ability_fwk",
46  "samgr:samgr_proxy",
47]
48
49ohos_systemtest("ThermalMgrInterfaceTest") {
50  module_out_path = "${module_output_path}"
51
52  sources = [
53    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
54    "src/thermal_mgr_interface_test.cpp",
55  ]
56
57  configs = [
58    "${utils_path}:utils_config",
59    "${utils_path}:coverage_flags",
60    ":module_private_config",
61  ]
62
63  include_dirs = [
64    "include",
65    "${thermal_manager_path}/services/native/include",
66    "${thermal_manager_path}/services/native/include/thermal_action",
67    "${thermal_manager_path}/services/native/include/thermal_observer",
68    "${thermal_manager_path}/services/native/include/thermal_policy",
69    "${thermal_manager_path}/services/native/include/thermal_observer/state_machine",
70    "${thermal_manager_path}/services/native/include/thermal_action/action",
71    "${thermal_manager_path}/test/unittest/include",
72    "${thermal_manager_path}/services/zidl/include",
73  ]
74
75  deps = [
76    "${thermal_inner_api}:thermalsrv_client",
77    "${thermal_manager_path}/services:thermalservice",
78    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
79    "${thermal_service_zidl}:thermalmgr_proxy",
80    "${thermal_service_zidl}:thermalmgr_stub",
81    "//third_party/googletest:gmock_main",
82    "//third_party/googletest:gtest_main",
83    "//third_party/libxml2:xml2",
84  ]
85  external_deps = deps_ex
86}
87
88ohos_systemtest("ThermalMgrSystemTest") {
89  resource_config_file =
90      "${thermal_manager_path}/test/resource/system_test/ohos_test.xml"
91
92  module_out_path = "${module_output_path}"
93
94  sources = [
95    "${thermal_manager_path}/test/unittest/src/thermal_config_file_parser.cpp",
96    "src/thermal_mgr_system_test.cpp",
97  ]
98
99  configs = [
100    "${utils_path}:utils_config",
101    "${utils_path}:coverage_flags",
102  ]
103
104  include_dirs = [
105    "include",
106    "${thermal_manager_path}/services/zidl/include",
107    "${thermal_manager_path}/services/native/include",
108    "${thermal_manager_path}/services/native/include/thermal_action",
109    "${thermal_manager_path}/services/native/include/thermal_observer",
110    "${thermal_manager_path}/services/native/include/thermal_policy",
111    "${thermal_manager_path}/services/native/include/thermal_observer/state_machine",
112    "${thermal_manager_path}/services/native/include/thermal_action/action",
113    "${thermal_manager_path}/test/unittest/include",
114  ]
115
116  deps = [
117    "${thermal_manager_path}/services:thermalservice",
118    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
119    "//third_party/googletest:gmock_main",
120    "//third_party/googletest:gtest_main",
121    "//third_party/libxml2:xml2",
122  ]
123  external_deps = deps_ex
124}
125
126ohos_systemtest("ThermalMgrDialogTest") {
127  module_out_path = "${module_output_path}"
128
129  sources = [ "src/thermal_mgr_dialog_test.cpp" ]
130
131  configs = [
132    "${utils_path}:utils_config",
133    "${utils_path}:coverage_flags",
134  ]
135
136  include_dirs = [
137    "include",
138    "${thermal_manager_path}/services/zidl/include",
139    "${thermal_manager_path}/services/native/include",
140    "${thermal_manager_path}/services/native/include/thermal_action",
141    "${thermal_manager_path}/services/native/include/thermal_observer",
142    "${thermal_manager_path}/services/native/include/thermal_policy",
143    "${thermal_manager_path}/services/native/include/thermal_observer/state_machine",
144    "${thermal_manager_path}/services/native/include/thermal_action/action",
145  ]
146
147  deps = [
148    "${thermal_manager_path}/services:thermalservice",
149    "${thermal_service_zidl}:thermalmgr_proxy",
150    "${thermal_service_zidl}:thermalmgr_stub",
151    "${utils_path}:thermal_utils",
152    "//third_party/googletest:gmock_main",
153    "//third_party/googletest:gtest_main",
154    "//third_party/libxml2:xml2",
155  ]
156  external_deps = deps_ex
157}
158
159ohos_systemtest("ThermalLevelEventSystemTest") {
160  module_out_path = module_output_path
161
162  sources = [
163    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
164    "src/thermal_level_event_system_test.cpp",
165  ]
166
167  configs = [
168    "${utils_path}:utils_config",
169    ":module_private_config",
170    "${utils_path}:coverage_flags",
171  ]
172
173  deps = [
174    "${thermal_inner_api}:thermalsrv_client",
175    "${thermal_manager_path}/services:thermalservice",
176    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
177    "//third_party/googletest:gtest_main",
178  ]
179  external_deps = deps_ex
180
181  defines = []
182  if (defined(global_parts_info) &&
183      defined(global_parts_info.powermgr_battery_manager)) {
184    defines += [ "BATTERY_MANAGER_ENABLE" ]
185    external_deps += [ "battery_manager:batterysrv_client" ]
186  }
187}
188
189group("systemtest") {
190  testonly = true
191
192  deps = [
193    ":ThermalLevelEventSystemTest",
194    ":ThermalMgrDialogTest",
195    ":ThermalMgrInterfaceTest",
196  ]
197}
198