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    "//foundation/distributeddatamgr/pasteboard/framework/uri",
32  ]
33}
34
35module_output_path = "pasteboard/pasteboard_service"
36
37ohos_unittest("PasteboardServiceTest") {
38  module_out_path = module_output_path
39
40  sources = [
41    "${pasteboard_service_path}/dfx/src/behaviour/pasteboard_behaviour_reporter_impl.cpp",
42    "${pasteboard_service_path}/dfx/src/fault/pasteboard_fault_impl.cpp",
43    "${pasteboard_service_path}/dfx/src/reporter.cpp",
44    "${pasteboard_service_path}/dfx/src/statistic/time_consuming_statistic_impl.cpp",
45    "unittest/src/dfx_test.cpp",
46    "unittest/src/paste_service_test.cpp",
47  ]
48  configs = [
49    "//commonlibrary/c_utils/base:utils_config",
50    ":module_private_config",
51  ]
52  external_deps = [
53    "ability_base:want",
54    "ability_base:zuri",
55    "access_token:libaccesstoken_sdk",
56    "access_token:libtoken_setproc",
57    "c_utils:utils",
58    "hilog:libhilog",
59    "image_framework:image_native",
60    "ipc:ipc_core",
61    "os_account:os_account_innerkits",
62  ]
63
64  deps = [
65    "${pasteboard_innerkits_path}:pasteboard_client",
66    "//third_party/googletest:gtest_main",
67  ]
68}
69
70ohos_unittest("PasteboardDialogNormalTest") {
71  module_out_path = module_output_path
72  sources = [
73    "${pasteboard_service_path}/core/src/pasteboard_dialog.cpp",
74    "unittest/src/pasteboard_dialog_normal_branch_test.cpp",
75  ]
76  configs = [ ":module_private_config" ]
77  external_deps = [
78    "ability_base:want",
79    "ability_runtime:ability_manager",
80    "c_utils:utils",
81    "hilog:libhilog",
82    "ipc:ipc_core",
83    "samgr:samgr_proxy",
84  ]
85  deps = [ "//third_party/googletest:gtest_main" ]
86}
87
88ohos_unittest("PasteboardDialogAbnormalTest") {
89  module_out_path = module_output_path
90
91  sources = [
92    "${pasteboard_service_path}/core/src/pasteboard_dialog.cpp",
93    "unittest/src/pasteboard_dialog_abnormal_branch_test.cpp",
94  ]
95  configs = [ ":module_private_config" ]
96  external_deps = [
97    "ability_base:want",
98    "ability_runtime:ability_manager",
99    "c_utils:utils",
100    "hilog:libhilog",
101    "ipc:ipc_core",
102    "samgr:samgr_proxy",
103  ]
104  deps = [ "//third_party/googletest:gtest_main" ]
105}
106
107ohos_unittest("PasteboardDeduplicateMemoryTest") {
108  module_out_path = module_output_path
109  include_dirs = [
110    "${pasteboard_service_path}/dfx/src",
111    "${pasteboard_utils_path}/native/include",
112  ]
113  sources = [ "unittest/src/pasteboard_deduplicate_memory_test.cpp" ]
114  external_deps = [
115    "c_utils:utils",
116    "googletest:gtest_main",
117    "hilog:libhilog",
118  ]
119}
120
121group("unittest") {
122  testonly = true
123  deps = [
124    ":PasteboardDeduplicateMemoryTest",
125    ":PasteboardDialogAbnormalTest",
126    ":PasteboardDialogNormalTest",
127    ":PasteboardServiceTest",
128  ]
129}
130