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/tools"
18
19tools_cem_mock_sources = [
20  "${tools_path}/test/mock/mock_common_event_stub.cpp",
21  "${tools_path}/test/mock/mock_service_registry.cpp",
22]
23
24ohos_moduletest("common_event_command_dump_module_test") {
25  module_out_path = module_output_path
26
27  include_dirs = []
28
29  sources = [
30    "${tools_path}/cem/src/common_event_command.cpp",
31    "${tools_path}/cem/src/shell_command.cpp",
32    "common_event_command_dump_module_test.cpp",
33  ]
34  sources += tools_cem_mock_sources
35
36  configs = [
37    "${tools_path}/cem:tools_cem_config",
38    "${tools_path}/test/unittest/cem:tools_cem_config_mock",
39  ]
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    "//third_party/googletest:gmock_main",
50    "//third_party/googletest:gtest_main",
51  ]
52
53  external_deps = [
54    "ability_base:want",
55    "c_utils:utils",
56    "eventhandler:libeventhandler",
57    "hilog:libhilog",
58    "init:libbegetutil",
59    "ipc:ipc_core",
60    "samgr:samgr_proxy",
61  ]
62}
63
64ohos_moduletest("common_event_command_publish_module_test") {
65  module_out_path = module_output_path
66
67  include_dirs = []
68
69  sources = [
70    "${tools_path}/cem/src/common_event_command.cpp",
71    "${tools_path}/cem/src/shell_command.cpp",
72    "common_event_command_publish_module_test.cpp",
73  ]
74  sources += tools_cem_mock_sources
75
76  configs = [
77    "${tools_path}/cem:tools_cem_config",
78    "${tools_path}/test/unittest/cem:tools_cem_config_mock",
79  ]
80
81  cflags = []
82  if (target_cpu == "arm") {
83    cflags += [ "-DBINDER_IPC_32BIT" ]
84  }
85
86  deps = [
87    "${ces_core_path}:cesfwk_core",
88    "${ces_native_path}:cesfwk_innerkits",
89    "//third_party/googletest:gmock_main",
90    "//third_party/googletest:gtest_main",
91  ]
92
93  external_deps = [
94    "ability_base:want",
95    "c_utils:utils",
96    "eventhandler:libeventhandler",
97    "hilog:libhilog",
98    "init:libbegetutil",
99    "ipc:ipc_core",
100    "samgr:samgr_proxy",
101  ]
102}
103
104group("moduletest") {
105  testonly = true
106
107  deps = [
108    ":common_event_command_dump_module_test",
109    ":common_event_command_publish_module_test",
110  ]
111}
112