1# Copyright (c) 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("../../../device_status.gni")
16
17module_output_path = "${device_status_part_name}/unit_out"
18
19ohos_unittest("CooperateClientTest") {
20  sanitize = {
21    cfi = true
22    cfi_cross_dso = true
23    debug = false
24  }
25
26  branch_protector_ret = "pac_ret"
27
28  module_out_path = module_output_path
29  include_dirs = [
30    "${device_status_interfaces_path}/innerkits/interaction/include",
31    "${device_status_utils_path}",
32    "${device_status_utils_path}/include",
33    "${device_status_root_path}/intention/cooperate/client/include",
34  ]
35
36  defines = []
37
38  sources = [ "src/cooperate_client_test.cpp" ]
39
40  cflags = [
41    "-Dprivate=public",
42    "-Dprotected=public",
43  ]
44
45  configs = []
46
47  deps = [
48    "${device_status_root_path}/intention/cooperate/client:intention_cooperate_client",
49    "${device_status_root_path}/intention/cooperate/data:intention_cooperate_data",
50    "${device_status_root_path}/intention/data:intention_data",
51    "${device_status_root_path}/intention/ipc/socket:intention_socket_connection",
52    "${device_status_root_path}/intention/ipc/tunnel:intention_tunnel_client",
53    "${device_status_root_path}/intention/prototype:intention_prototype",
54    "${device_status_root_path}/utils/common:devicestatus_util",
55    "${device_status_root_path}/utils/ipc:devicestatus_ipc",
56  ]
57  external_deps = [
58    "access_token:libaccesstoken_sdk",
59    "access_token:libnativetoken_shared",
60    "access_token:libtokensetproc_shared",
61    "c_utils:utils",
62    "eventhandler:libeventhandler",
63    "hilog:libhilog",
64    "image_framework:image_native",
65    "input:libmmi-client",
66    "ipc:ipc_single",
67    "samgr:samgr_proxy",
68  ]
69
70  if (hitrace_enabled) {
71    external_deps += [ "hitrace:hitrace_meter" ]
72  }
73}
74
75ohos_unittest("CooperateServerTest") {
76  module_out_path = module_output_path
77
78  sanitize = {
79    integer_overflow = true
80    ubsan = true
81    boundary_sanitize = true
82    cfi = true
83    cfi_cross_dso = true
84    debug = false
85  }
86
87  branch_protector_ret = "pac_ret"
88
89  include_dirs = [
90    "include",
91    "${device_status_interfaces_path}/innerkits/interaction/include",
92    "${device_status_interfaces_path}/innerkits/include",
93    "${device_status_utils_path}",
94    "${device_status_utils_path}/include",
95    "${device_status_root_path}/intention/prototype/include",
96    "${device_status_root_path}/services/native/include",
97    "${device_status_root_path}/services/communication/service/include",
98    "${device_status_root_path}/services/communication/base/",
99  ]
100
101  defines = []
102
103  sources = [
104    "src/cooperate_server_test.cpp",
105    "src/test_context.cpp",
106  ]
107
108  configs = []
109
110  defines = device_status_default_defines
111
112  cflags = [ "-Dprivate=public" ]
113
114  deps = [
115    "${device_status_root_path}/intention/adapters/dsoftbus_adapter:intention_dsoftbus_adapter",
116    "${device_status_root_path}/intention/adapters/input_adapter:intention_input_adapter",
117    "${device_status_root_path}/intention/cooperate/data:intention_cooperate_data",
118    "${device_status_root_path}/intention/cooperate/server:intention_cooperate_server",
119    "${device_status_root_path}/intention/data:intention_data",
120    "${device_status_root_path}/intention/ipc/socket:intention_socket_session_manager",
121    "${device_status_root_path}/intention/prototype:intention_prototype",
122    "${device_status_root_path}/intention/scheduler/plugin_manager:intention_plugin_manager",
123    "${device_status_root_path}/intention/scheduler/timer_manager:intention_timer_manager",
124    "${device_status_root_path}/intention/services/device_manager:intention_device_manager",
125    "${device_status_root_path}/services/interaction/drag:interaction_drag",
126    "${device_status_root_path}/utils/common:devicestatus_util",
127    "${device_status_root_path}/utils/ipc:devicestatus_ipc",
128  ]
129  external_deps = [
130    "ability_runtime:app_manager",
131    "access_token:libaccesstoken_sdk",
132    "access_token:libnativetoken_shared",
133    "access_token:libtokensetproc_shared",
134    "cJSON:cjson",
135    "c_utils:utils",
136    "eventhandler:libeventhandler",
137    "graphic_2d:libcomposer",
138    "graphic_2d:librender_service_base",
139    "graphic_2d:librender_service_client",
140    "graphic_2d:window_animation",
141    "hilog:libhilog",
142    "image_framework:image_native",
143    "input:libmmi-client",
144    "ipc:ipc_single",
145    "samgr:samgr_proxy",
146  ]
147
148  if (hitrace_enabled) {
149    external_deps += [ "hitrace:hitrace_meter" ]
150  }
151}
152
153group("intention_cooperate_tests") {
154  testonly = true
155  deps = [
156    ":CooperateClientTest",
157    ":CooperateServerTest",
158  ]
159}
160