1# Copyright (c) 2021 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("//base/notification/ces_standard/event.gni") 15import("//build/test.gni") 16 17module_output_path = "ces_standard/tools" 18 19config("tools_cem_config_mock") { 20 include_dirs = [ 21 "//third_party/googletest/googlemock/include", 22 "${tools_path}/test/mock", 23 ] 24} 25 26tools_cem_mock_sources = 27 [ "${tools_path}/test/mock/mock_common_event_stub.cpp" ] 28 29ohos_unittest("common_event_command_test") { 30 module_out_path = module_output_path 31 32 include_dirs = [] 33 34 sources = [ 35 "${tools_path}/cem/src/common_event_command.cpp", 36 "${tools_path}/cem/src/shell_command.cpp", 37 "common_event_command_test.cpp", 38 ] 39 sources += tools_cem_mock_sources 40 41 configs = [ 42 "${tools_path}/cem:tools_cem_config", 43 ":tools_cem_config_mock", 44 ] 45 46 cflags = [] 47 if (target_cpu == "arm") { 48 cflags += [ "-DBINDER_IPC_32BIT" ] 49 } 50 51 deps = [ 52 "${ces_common_path}:libevent_common", 53 "${ces_core_path}:cesfwk_core", 54 "${ces_native_path}:cesfwk_innerkits", 55 "//third_party/googletest:gmock_main", 56 "//third_party/googletest:gtest_main", 57 "//utils/native/base:utils", 58 ] 59 60 external_deps = [ 61 "ability_base:want", 62 "eventhandler:libeventhandler", 63 "hiviewdfx_hilog_native:libhilog", 64 "ipc:ipc_core", 65 ] 66} 67 68ohos_unittest("common_event_command_dump_test") { 69 module_out_path = module_output_path 70 71 include_dirs = [] 72 73 sources = [ 74 "${tools_path}/cem/src/common_event_command.cpp", 75 "${tools_path}/cem/src/shell_command.cpp", 76 "common_event_command_dump_test.cpp", 77 ] 78 sources += tools_cem_mock_sources 79 80 configs = [ 81 "${tools_path}/cem:tools_cem_config", 82 ":tools_cem_config_mock", 83 ] 84 85 cflags = [] 86 if (target_cpu == "arm") { 87 cflags += [ "-DBINDER_IPC_32BIT" ] 88 } 89 90 deps = [ 91 "${ces_common_path}:libevent_common", 92 "${ces_core_path}:cesfwk_core", 93 "${ces_native_path}:cesfwk_innerkits", 94 "//third_party/googletest:gmock_main", 95 "//third_party/googletest:gtest_main", 96 "//utils/native/base:utils", 97 ] 98 99 external_deps = [ 100 "ability_base:want", 101 "eventhandler:libeventhandler", 102 "hiviewdfx_hilog_native:libhilog", 103 "ipc:ipc_core", 104 ] 105} 106 107ohos_unittest("common_event_command_publish_test") { 108 module_out_path = module_output_path 109 110 include_dirs = [] 111 112 sources = [ 113 "${tools_path}/cem/src/common_event_command.cpp", 114 "${tools_path}/cem/src/shell_command.cpp", 115 "common_event_command_publish_test.cpp", 116 ] 117 sources += tools_cem_mock_sources 118 119 configs = [ 120 "${tools_path}/cem:tools_cem_config", 121 ":tools_cem_config_mock", 122 ] 123 124 cflags = [] 125 if (target_cpu == "arm") { 126 cflags += [ "-DBINDER_IPC_32BIT" ] 127 } 128 129 deps = [ 130 "${ces_common_path}:libevent_common", 131 "${ces_core_path}:cesfwk_core", 132 "${ces_native_path}:cesfwk_innerkits", 133 "//third_party/googletest:gmock_main", 134 "//third_party/googletest:gtest_main", 135 "//utils/native/base:utils", 136 ] 137 138 external_deps = [ 139 "ability_base:want", 140 "eventhandler:libeventhandler", 141 "hiviewdfx_hilog_native:libhilog", 142 "ipc:ipc_core", 143 ] 144} 145 146group("unittest") { 147 testonly = true 148 149 deps = [ 150 ":common_event_command_dump_test", 151 ":common_event_command_publish_test", 152 ":common_event_command_test", 153 ] 154} 155