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