• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 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("//foundation/distributeddatamgr/pasteboard/pasteboard.gni")
16
17config("module_private_config") {
18  visibility = [ ":*" ]
19
20  include_dirs = [
21    "${pasteboard_innerkits_path}/include",
22    "${pasteboard_utils_path}/native/include",
23    "${pasteboard_service_path}/dfx/src",
24    "${pasteboard_service_path}/dfx/src/behaviour",
25    "${pasteboard_service_path}/dfx/src/fault",
26    "${pasteboard_service_path}/dfx/src/statistic",
27    "${pasteboard_service_path}/core/include",
28    "include",
29    "unittest/include",
30    "//foundation/distributeddatamgr/pasteboard/framework/tlv",
31  ]
32}
33
34module_output_path = "pasteboard/pasteboard"
35
36ohos_unittest("PasteboardServiceTest") {
37  module_out_path = module_output_path
38
39  sources = [
40    "${pasteboard_service_path}/dfx/src/behaviour/pasteboard_behaviour_reporter_impl.cpp",
41    "${pasteboard_service_path}/dfx/src/fault/pasteboard_fault_impl.cpp",
42    "${pasteboard_service_path}/dfx/src/reporter.cpp",
43    "${pasteboard_service_path}/dfx/src/statistic/time_consuming_statistic_impl.cpp",
44    "unittest/src/dfx_test.cpp",
45    "unittest/src/paste_service_test.cpp",
46  ]
47  configs = [ ":module_private_config" ]
48  external_deps = [
49    "ability_base:want",
50    "ability_base:zuri",
51    "access_token:libaccesstoken_sdk",
52    "access_token:libtoken_setproc",
53    "c_utils:utils",
54    "ffrt:libffrt",
55    "googletest:gtest_main",
56    "hilog:libhilog",
57    "hisysevent:libhisysevent",
58    "image_framework:image_native",
59    "ipc:ipc_core",
60    "os_account:os_account_innerkits",
61    "samgr:samgr_proxy",
62  ]
63
64  deps = [
65    "${pasteboard_framework_path}:pasteboard_framework",
66    "${pasteboard_innerkits_path}:pasteboard_client",
67  ]
68}
69
70ohos_unittest("PasteServInterfaceTest") {
71  use_exceptions = true
72  module_out_path = module_output_path
73  sources = [
74    "${pasteboard_root_path}/adapter/data_share/datashare_delegate.cpp",
75    "${pasteboard_root_path}/adapter/security_level/security_level.cpp",
76    "${pasteboard_service_path}/account/src/account_manager.cpp",
77    "${pasteboard_service_path}/core/src/pasteboard_dialog.cpp",
78    "${pasteboard_service_path}/core/src/pasteboard_pattern.cpp",
79    "${pasteboard_service_path}/core/src/pasteboard_service.cpp",
80    "${pasteboard_service_path}/dfx/src/behaviour/pasteboard_behaviour_reporter_impl.cpp",
81    "${pasteboard_service_path}/dfx/src/calculate_time_consuming.cpp",
82    "${pasteboard_service_path}/dfx/src/command.cpp",
83    "${pasteboard_service_path}/dfx/src/fault/pasteboard_fault_impl.cpp",
84    "${pasteboard_service_path}/dfx/src/hiview_adapter.cpp",
85    "${pasteboard_service_path}/dfx/src/pasteboard_dump_helper.cpp",
86    "${pasteboard_service_path}/dfx/src/pasteboard_event_dfx.cpp",
87    "${pasteboard_service_path}/dfx/src/pasteboard_trace.cpp",
88    "${pasteboard_service_path}/dfx/src/reporter.cpp",
89    "${pasteboard_service_path}/dfx/src/statistic/time_consuming_statistic_impl.cpp",
90    "${pasteboard_service_path}/load/src/config.cpp",
91    "${pasteboard_service_path}/load/src/loader.cpp",
92    "${pasteboard_service_path}/switch/pasteboard_switch.cpp",
93    "${pasteboard_service_path}/zidl/src/ipasteboard_client_death_observer.cpp",
94    "${pasteboard_service_path}/zidl/src/pasteboard_delay_getter_proxy.cpp",
95    "${pasteboard_service_path}/zidl/src/pasteboard_entry_getter_proxy.cpp",
96    "${pasteboard_service_path}/zidl/src/pasteboard_observer_proxy.cpp",
97    "${pasteboard_service_path}/zidl/src/pasteboard_service_stub.cpp",
98    "unittest/src/pasteboard_service_test.cpp",
99  ]
100  defines = []
101  configs = [ ":module_private_config" ]
102  cflags = [ "-fno-access-control" ]
103  include_dirs = [
104    "${pasteboard_service_path}/dfx/src",
105    "${pasteboard_service_path}/dfx/src/behaviour",
106    "${pasteboard_service_path}/dfx/src/statistic",
107    "${pasteboard_service_path}/dfx/src/fault",
108    "${pasteboard_service_path}/zidl/include",
109    "${pasteboard_service_path}/account/include",
110    "${pasteboard_service_path}/core/include",
111    "${pasteboard_service_path}/load/include",
112    "${pasteboard_service_path}/switch",
113    "${pasteboard_root_path}/adapter/data_share",
114    "${pasteboard_root_path}/adapter/pasteboard_progress",
115    "${pasteboard_root_path}/adapter/security_level",
116    "${pasteboard_innerkits_path}/include",
117    "${pasteboard_utils_path}/mock/include",
118    "${pasteboard_utils_path}/native/include",
119    "${pasteboard_utils_path}/system/safwk/native/include",
120    "${pasteboard_framework_path}/framework/include",
121    "${pasteboard_framework_path}/framework/include/device",
122  ]
123  external_deps = [
124    "ability_base:base",
125    "ability_base:want",
126    "ability_base:zuri",
127    "ability_runtime:ability_manager",
128    "ability_runtime:uri_permission_mgr",
129    "ability_runtime:wantagent_innerkits",
130    "access_token:libaccesstoken_sdk",
131    "access_token:libprivacy_sdk",
132    "access_token:libtokenid_sdk",
133    "app_file_service:remote_file_share_native",
134    "bundle_framework:appexecfwk_base",
135    "bundle_framework:appexecfwk_core",
136    "cJSON:cjson",
137    "common_event_service:cesfwk_innerkits",
138    "data_share:datashare_consumer",
139    "dataclassification:data_transit_mgr",
140    "eventhandler:libeventhandler",
141    "ffrt:libffrt",
142    "hilog:libhilog",
143    "hisysevent:libhisysevent",
144    "hitrace:hitrace_meter",
145    "hitrace:libhitracechain",
146    "imf:inputmethod_client",
147    "input:libmmi-client",
148    "ipc:ipc_single",
149    "libxml2:libxml2",
150    "memmgr:memmgrclient",
151    "os_account:os_account_innerkits",
152    "resource_schedule_service:ressched_client",
153    "safwk:system_ability_fwk",
154    "samgr:samgr_proxy",
155    "time_service:time_client",
156    "udmf:udmf_client",
157  ]
158  deps = [
159    "${pasteboard_framework_path}:pasteboard_framework",
160    "${pasteboard_innerkits_path}:pasteboard_client",
161    "${pasteboard_service_path}:pasteboard_service",
162    "${pasteboard_tlv_path}:pasteboard_tlv",
163  ]
164  if (pasteboard_vixl_part_enabled) {
165    external_deps += [ "vixl:libvixl" ]
166    defines += [ "PB_VIXL_ENABLE" ]
167  }
168
169  if (window_manager_use_sceneboard) {
170    external_deps += [ "window_manager:libwm_lite" ]
171    defines += [ "SCENE_BOARD_ENABLE" ]
172  } else {
173    external_deps += [ "window_manager:libwm" ]
174  }
175  if (pasteboard_dlp_part_enabled) {
176    external_deps += [ "dlp_permission_service:libdlp_permission_sdk" ]
177    defines += [ "WITH_DLP" ]
178  }
179  if (pasteboard_device_info_manager_part_enabled) {
180    external_deps += [
181      "device_info_manager:distributed_device_profile_common",
182      "device_info_manager:distributed_device_profile_sdk",
183    ]
184    defines += [ "PB_DEVICE_INFO_MANAGER_ENABLE" ]
185  }
186
187  if (pasteboard_device_manager_part_enabled) {
188    external_deps += [ "device_manager:devicemanagersdk" ]
189    defines += [ "PB_DEVICE_MANAGER_ENABLE" ]
190  }
191
192  if (pasteboard_screenlock_mgr_part_enabled) {
193    external_deps += [ "screenlock_mgr:screenlock_client" ]
194    defines += [ "PB_SCREENLOCK_MGR_ENABLE" ]
195  }
196}
197
198ohos_unittest("PasteboardDialogNormalTest") {
199  module_out_path = module_output_path
200  sources = [
201    "${pasteboard_service_path}/core/src/pasteboard_dialog.cpp",
202    "unittest/src/pasteboard_dialog_normal_branch_test.cpp",
203  ]
204  configs = [ ":module_private_config" ]
205  external_deps = [
206    "ability_base:want",
207    "ability_runtime:ability_manager",
208    "c_utils:utils",
209    "googletest:gtest_main",
210    "hilog:libhilog",
211    "ipc:ipc_core",
212    "samgr:samgr_proxy",
213  ]
214}
215
216ohos_unittest("PasteboardDialogAbnormalTest") {
217  module_out_path = module_output_path
218
219  sources = [
220    "${pasteboard_service_path}/core/src/pasteboard_dialog.cpp",
221    "unittest/src/pasteboard_dialog_abnormal_branch_test.cpp",
222  ]
223  configs = [ ":module_private_config" ]
224  external_deps = [
225    "ability_base:want",
226    "ability_runtime:ability_manager",
227    "c_utils:utils",
228    "googletest:gtest_main",
229    "hilog:libhilog",
230    "ipc:ipc_core",
231    "samgr:samgr_proxy",
232  ]
233}
234
235ohos_unittest("PasteboardLinkedListTest") {
236  module_out_path = module_output_path
237  include_dirs = [ "${pasteboard_utils_path}/native/include" ]
238  sources = [ "unittest/src/pasteboard_linked_list_test.cpp" ]
239  external_deps = [ "googletest:gtest_main" ]
240}
241
242ohos_unittest("PasteboardDeduplicateMemoryTest") {
243  module_out_path = module_output_path
244  include_dirs = [
245    "${pasteboard_service_path}/dfx/src",
246    "${pasteboard_utils_path}/native/include",
247  ]
248  sources = [ "unittest/src/pasteboard_deduplicate_memory_test.cpp" ]
249  external_deps = [
250    "c_utils:utils",
251    "googletest:gtest_main",
252    "hilog:libhilog",
253  ]
254}
255
256ohos_unittest("PasteboardPatternTest") {
257  module_out_path = module_output_path
258  use_exceptions = true
259  sources = [
260    "${pasteboard_service_path}/core/src/pasteboard_pattern.cpp",
261    "unittest/src/pasteboard_pattern_test.cpp",
262  ]
263  configs = [ ":module_private_config" ]
264  external_deps = [
265    "c_utils:utils",
266    "ffrt:libffrt",
267    "googletest:gtest_main",
268    "hilog:libhilog",
269    "ipc:ipc_core",
270    "libxml2:libxml2",
271  ]
272  deps = [
273    "${pasteboard_framework_path}:pasteboard_framework",
274    "${pasteboard_innerkits_path}:pasteboard_client",
275  ]
276}
277
278group("unittest") {
279  testonly = true
280  deps = [
281    ":PasteServInterfaceTest",
282    ":PasteboardDeduplicateMemoryTest",
283    ":PasteboardDialogAbnormalTest",
284    ":PasteboardDialogNormalTest",
285    ":PasteboardLinkedListTest",
286    ":PasteboardPatternTest",
287    ":PasteboardServiceTest",
288  ]
289}
290