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_innerkits_path}:pasteboard_client", 66 "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", 67 "//third_party/googletest:gtest_main", 68 ] 69} 70 71ohos_unittest("PasteboardDialogNormalTest") { 72 module_out_path = module_output_path 73 sources = [ 74 "${pasteboard_service_path}/core/src/pasteboard_dialog.cpp", 75 "unittest/src/pasteboard_dialog_normal_branch_test.cpp", 76 ] 77 configs = [ ":module_private_config" ] 78 external_deps = [ 79 "ability_base:want", 80 "ability_runtime:ability_manager", 81 "c_utils:utils", 82 "hilog:libhilog", 83 "ipc:ipc_core", 84 "samgr:samgr_proxy", 85 ] 86 deps = [ "//third_party/googletest:gtest_main" ] 87} 88 89ohos_unittest("PasteboardDialogAbnormalTest") { 90 module_out_path = module_output_path 91 92 sources = [ 93 "${pasteboard_service_path}/core/src/pasteboard_dialog.cpp", 94 "unittest/src/pasteboard_dialog_abnormal_branch_test.cpp", 95 ] 96 configs = [ ":module_private_config" ] 97 external_deps = [ 98 "ability_base:want", 99 "ability_runtime:ability_manager", 100 "c_utils:utils", 101 "hilog:libhilog", 102 "ipc:ipc_core", 103 "samgr:samgr_proxy", 104 ] 105 deps = [ "//third_party/googletest:gtest_main" ] 106} 107 108ohos_unittest("PasteboardDeduplicateMemoryTest") { 109 module_out_path = module_output_path 110 include_dirs = [ 111 "${pasteboard_service_path}/dfx/src", 112 "${pasteboard_utils_path}/native/include", 113 ] 114 sources = [ "unittest/src/pasteboard_deduplicate_memory_test.cpp" ] 115 external_deps = [ 116 "c_utils:utils", 117 "googletest:gtest_main", 118 "hilog:libhilog", 119 ] 120} 121 122group("unittest") { 123 testonly = true 124 deps = [ 125 ":PasteboardDeduplicateMemoryTest", 126 ":PasteboardDialogAbnormalTest", 127 ":PasteboardDialogNormalTest", 128 ":PasteboardServiceTest", 129 ] 130} 131