• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-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    "//foundation/distributeddatamgr/pasteboard/framework/framework/include",
23    "//foundation/distributeddatamgr/pasteboard/framework/tlv",
24    "${pasteboard_root_path}/framework/framework/include/serializable",
25    "${pasteboard_service_path}/load/include",
26    "include",
27    "test/include",
28  ]
29}
30
31module_output_path = "pasteboard/pasteboard"
32
33ohos_unittest("PasteboardFrameworkTest") {
34  branch_protector_ret = "pac_ret"
35  sanitize = {
36    cfi = true
37    cfi_cross_dso = true
38    debug = false
39    blocklist = "./cfi_blocklist.txt"
40  }
41  resource_config_file = "//foundation/distributeddatamgr/pasteboard/framework/test/resource/ohos_test.xml"
42  module_out_path = module_output_path
43
44  sources = [
45    "${pasteboard_root_path}/framework/framework/serializable/serializable.cpp",
46    "${pasteboard_service_path}/load/src/config.cpp",
47    "src/clip_plugin_test.cpp",
48    "src/convert_utils_test.cpp",
49    "src/dev_profile_test.cpp",
50    "src/distributed_module_config_test.cpp",
51    "src/dm_adapter_test.cpp",
52    "src/event_center_test.cpp",
53    "src/event_test.cpp",
54    "src/ffrt_utils_test.cpp",
55    "src/paste_data_entry_test.cpp",
56    "src/paste_data_record_test.cpp",
57    "src/paste_data_test.cpp",
58    "src/pasteboard_client_test.cpp",
59    "src/pasteboard_client_udmf_delay_test.cpp",
60    "src/pasteboard_event_test.cpp",
61    "src/pasteboard_multi_type_unified_data_delay_test.cpp",
62    "src/pasteboard_unified_data_test.cpp",
63    "src/pasteboard_unified_data_uri_test.cpp",
64    "src/pasteboard_utils_test.cpp",
65    "src/serializable_test.cpp",
66    "src/tlv_object_test.cpp",
67    "src/web_controller_test.cpp",
68  ]
69  configs = [ ":module_private_config" ]
70  cflags = [ "-fno-access-control" ]
71  external_deps = [
72    "ability_base:base",
73    "ability_base:want",
74    "ability_base:zuri",
75    "cJSON:cjson",
76    "c_utils:utils",
77    "ffrt:libffrt",
78    "googletest:gmock",
79    "googletest:gtest_main",
80    "hilog:libhilog",
81    "image_framework:image_native",
82    "init:libbeget_proxy",
83    "init:libbegetutil",
84    "ipc:ipc_core",
85    "samgr:samgr_proxy",
86    "udmf:udmf_client",
87  ]
88
89  deps = [
90    "${pasteboard_framework_path}:pasteboard_framework",
91    "${pasteboard_innerkits_path}:pasteboard_client",
92  ]
93
94  defines = []
95
96  if (pasteboard_device_info_manager_part_enabled) {
97    external_deps += [
98      "device_info_manager:distributed_device_profile_common",
99      "device_info_manager:distributed_device_profile_sdk",
100    ]
101    defines += [ "PB_DEVICE_INFO_MANAGER_ENABLE" ]
102  }
103
104  if (pasteboard_device_manager_part_enabled) {
105    external_deps += [ "device_manager:devicemanagersdk" ]
106    defines += [ "PB_DEVICE_MANAGER_ENABLE" ]
107  }
108}
109
110ohos_unittest("PasteboardFrameworkMockTest") {
111  branch_protector_ret = "pac_ret"
112  sanitize = {
113    cfi = true
114    cfi_cross_dso = true
115    debug = false
116    blocklist = "./cfi_blocklist.txt"
117  }
118  resource_config_file =
119      "${pasteboard_root_path}/framework/test/resource/ohos_test.xml"
120  module_out_path = module_output_path
121
122  sources = [
123    "${pasteboard_root_path}/framework/framework/serializable/serializable.cpp",
124    "${pasteboard_service_path}/load/src/config.cpp",
125    "mock/distributed_device_profile_client_mock.cpp",
126    "src/dev_profile_mock_test.cpp",
127  ]
128  configs = [ ":module_private_config" ]
129  cflags = [ "-fno-access-control" ]
130  external_deps = [
131    "ability_base:base",
132    "ability_base:want",
133    "ability_base:zuri",
134    "cJSON:cjson",
135    "c_utils:utils",
136    "ffrt:libffrt",
137    "googletest:gmock",
138    "googletest:gtest_main",
139    "hilog:libhilog",
140    "image_framework:image_native",
141    "init:libbeget_proxy",
142    "init:libbegetutil",
143    "ipc:ipc_core",
144    "samgr:samgr_proxy",
145    "udmf:udmf_client",
146  ]
147
148  deps = [
149    "${pasteboard_framework_path}:pasteboard_framework",
150    "${pasteboard_innerkits_path}:pasteboard_client",
151  ]
152
153  defines = []
154
155  if (pasteboard_device_info_manager_part_enabled) {
156    external_deps += [
157      "device_info_manager:distributed_device_profile_common",
158      "device_info_manager:distributed_device_profile_sdk",
159    ]
160    defines += [ "PB_DEVICE_INFO_MANAGER_ENABLE" ]
161  }
162
163  if (pasteboard_device_manager_part_enabled) {
164    external_deps += [ "device_manager:devicemanagersdk" ]
165    defines += [ "PB_DEVICE_MANAGER_ENABLE" ]
166  }
167}
168
169group("unittest") {
170  testonly = true
171  deps = [
172    ":PasteboardFrameworkMockTest",
173    ":PasteboardFrameworkTest",
174  ]
175}
176