1# Copyright (c) 2021-2022 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/appexecfwk/standard/appexecfwk.gni") 16import( 17 "//foundation/appexecfwk/standard/libs/libeventhandler/lib_event_handler_sources.gni") 18 19config("libeventhandler_test_private_config") { 20 defines = event_handler_log_domain_defines 21 22 configs = [ "${libs_path}/libeventhandler:libeventhandler_config" ] 23} 24 25module_output_path = "appexecfwk_standard/libeventhandler" 26 27ohos_unittest("LibEventHandlerCheckTest") { 28 module_out_path = module_output_path 29 30 sources = lib_event_handler_sources 31 32 sources += [ "unittest/lib_event_handler_checker_test.cpp" ] 33 34 configs = [ ":libeventhandler_test_private_config" ] 35 36 deps = [ "//third_party/googletest:gtest_main" ] 37 38 external_deps = [ 39 "hichecker_native:libhichecker", 40 "hitrace_native:libhitrace", 41 "hiviewdfx_hilog_native:libhilog", 42 ] 43} 44 45ohos_unittest("LibEventHandlerEventQueueTest") { 46 module_out_path = module_output_path 47 48 sources = lib_event_handler_sources 49 50 sources += [ "unittest/lib_event_handler_event_queue_test.cpp" ] 51 52 configs = [ ":libeventhandler_test_private_config" ] 53 54 deps = [ "//third_party/googletest:gtest_main" ] 55 56 external_deps = [ 57 "hichecker_native:libhichecker", 58 "hitrace_native:libhitrace", 59 "hiviewdfx_hilog_native:libhilog", 60 ] 61} 62 63ohos_unittest("LibEventHandlerEventTest") { 64 module_out_path = module_output_path 65 66 sources = lib_event_handler_sources 67 68 sources += [ "unittest/lib_event_handler_event_test.cpp" ] 69 70 configs = [ ":libeventhandler_test_private_config" ] 71 72 deps = [ "//third_party/googletest:gtest_main" ] 73 74 external_deps = [ 75 "hichecker_native:libhichecker", 76 "hitrace_native:libhitrace", 77 "hiviewdfx_hilog_native:libhilog", 78 ] 79} 80 81ohos_unittest("LibEventHandlerEventRunnerTest") { 82 module_out_path = module_output_path 83 84 sources = lib_event_handler_sources 85 86 sources += [ "unittest/lib_event_handler_event_runner_test.cpp" ] 87 88 configs = [ ":libeventhandler_test_private_config" ] 89 90 deps = [ "//third_party/googletest:gtest_main" ] 91 92 external_deps = [ 93 "hichecker_native:libhichecker", 94 "hitrace_native:libhitrace", 95 "hiviewdfx_hilog_native:libhilog", 96 ] 97} 98 99ohos_unittest("LibEventHandlerTraceTest") { 100 module_out_path = module_output_path 101 102 sources = lib_event_handler_sources 103 104 sources += [ "unittest/lib_event_handler_trace_test.cpp" ] 105 106 configs = [ ":libeventhandler_test_private_config" ] 107 108 deps = [ "//third_party/googletest:gtest_main" ] 109 110 external_deps = [ 111 "hichecker_native:libhichecker", 112 "hitrace_native:libhitrace", 113 "hiviewdfx_hilog_native:libhilog", 114 ] 115} 116 117group("unittest") { 118 testonly = true 119 120 deps = [ 121 ":LibEventHandlerCheckTest", 122 ":LibEventHandlerEventQueueTest", 123 ":LibEventHandlerEventRunnerTest", 124 ":LibEventHandlerEventTest", 125 ":LibEventHandlerTraceTest", 126 ] 127} 128