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