• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
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_core_path}:cesfwk_core",
53    "${ces_native_path}:cesfwk_innerkits",
54    "//third_party/googletest:gmock_main",
55    "//third_party/googletest:gtest_main",
56  ]
57
58  external_deps = [
59    "ability_base:want",
60    "c_utils:utils",
61    "eventhandler:libeventhandler",
62    "hilog:libhilog",
63    "ipc:ipc_core",
64  ]
65}
66
67ohos_unittest("common_event_command_dump_test") {
68  module_out_path = module_output_path
69
70  include_dirs = []
71
72  sources = [
73    "${tools_path}/cem/src/common_event_command.cpp",
74    "${tools_path}/cem/src/shell_command.cpp",
75    "common_event_command_dump_test.cpp",
76  ]
77  sources += tools_cem_mock_sources
78
79  configs = [
80    "${tools_path}/cem:tools_cem_config",
81    ":tools_cem_config_mock",
82  ]
83
84  cflags = []
85  if (target_cpu == "arm") {
86    cflags += [ "-DBINDER_IPC_32BIT" ]
87  }
88
89  deps = [
90    "${ces_core_path}:cesfwk_core",
91    "${ces_native_path}:cesfwk_innerkits",
92    "//third_party/googletest:gmock_main",
93    "//third_party/googletest:gtest_main",
94  ]
95
96  external_deps = [
97    "ability_base:want",
98    "c_utils:utils",
99    "eventhandler:libeventhandler",
100    "hilog:libhilog",
101    "ipc:ipc_core",
102  ]
103}
104
105ohos_unittest("common_event_command_publish_test") {
106  module_out_path = module_output_path
107
108  include_dirs = []
109
110  sources = [
111    "${tools_path}/cem/src/common_event_command.cpp",
112    "${tools_path}/cem/src/shell_command.cpp",
113    "common_event_command_publish_test.cpp",
114  ]
115  sources += tools_cem_mock_sources
116
117  configs = [
118    "${tools_path}/cem:tools_cem_config",
119    ":tools_cem_config_mock",
120  ]
121
122  cflags = []
123  if (target_cpu == "arm") {
124    cflags += [ "-DBINDER_IPC_32BIT" ]
125  }
126
127  deps = [
128    "${ces_core_path}:cesfwk_core",
129    "${ces_native_path}:cesfwk_innerkits",
130    "//third_party/googletest:gmock_main",
131    "//third_party/googletest:gtest_main",
132  ]
133
134  external_deps = [
135    "ability_base:want",
136    "c_utils:utils",
137    "eventhandler:libeventhandler",
138    "hilog:libhilog",
139    "ipc:ipc_core",
140  ]
141}
142
143group("unittest") {
144  testonly = true
145
146  deps = [
147    ":common_event_command_dump_test",
148    ":common_event_command_publish_test",
149    ":common_event_command_test",
150  ]
151}
152