• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2023 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.
13import("//base/hiviewdfx/hiview/build/hiview_var.gni")
14import("//base/hiviewdfx/hiview/hiview.gni")
15import("//build/test.gni")
16module_output_path = "hiview/hiview/core"
17group("unittest") {
18  testonly = true
19  deps = [
20    ":EventDispatchQueueTest",
21    ":HiviewPlatformConfigTest",
22    ":ParamUpdateTest",
23    ":PlatformConfigTest",
24    ":PluginBundleTest",
25    ":PluginPlatformTest",
26  ]
27}
28
29config("unittest_config") {
30  include_dirs = [
31    "../",
32    "unittest/common",
33  ]
34
35  cflags_cc = [
36    "-D__UNITTEST__",
37    "-D__HIVIEW_OHOS__",
38  ]
39}
40
41ohos_unittest("PlatformConfigTest") {
42  module_out_path = module_output_path
43  configs = [ ":unittest_config" ]
44
45  sources = [ "unittest/common/platform_config_test.cpp" ]
46
47  deps = [
48    "$hiview_base:hiviewbase_static_lib_for_tdd",
49    "$hiview_core:hiview_core",
50  ]
51
52  external_deps = [
53    "c_utils:utils",
54    "ffrt:libffrt",
55    "googletest:gtest_main",
56    "hilog:libhilog",
57  ]
58
59  resource_config_file = "$hiview_test/resource/ohos_test.xml"
60}
61
62ohos_unittest("PluginPlatformTest") {
63  testonly = true
64  module_out_path = module_output_path
65  configs = [ ":unittest_config" ]
66
67  cflags_cc = [ "-DTEST_LOCAL_SRC" ]
68
69  sources = [
70    "unittest/common/platform_test_result_listener.cpp",
71    "unittest/common/plugin_platform_test.cpp",
72  ]
73
74  deps = [
75    "$hiview_base:hiviewbase_static_lib_for_tdd",
76    "$hiview_core:hiview_core_for_test",
77    "$hiview_root/test/plugins/examples/dynamic_load_plugin_example:dynamicloadpluginexample",
78    "$hiview_root/test/plugins/examples/event_processor_example1:event_processor_example1",
79    "$hiview_root/test/plugins/examples/event_processor_example2:event_processor_example2",
80    "$hiview_root/test/plugins/examples/event_processor_example3:event_processor_example3",
81    "$hiview_root/test/plugins/examples/event_processor_example4:event_processor_example4",
82    "$hiview_root/test/plugins/examples/event_source_example:event_source_example",
83  ]
84
85  external_deps = [
86    "c_utils:utils",
87    "ffrt:libffrt",
88    "googletest:gtest_main",
89    "hilog:libhilog",
90  ]
91
92  resource_config_file = "$hiview_test/resource/ohos_test.xml"
93}
94
95ohos_unittest("PluginBundleTest") {
96  module_out_path = module_output_path
97  configs = [ ":unittest_config" ]
98  sources = [
99    "unittest/common/platform_test_result_listener.cpp",
100    "unittest/common/plugin_bundle_test.cpp",
101  ]
102
103  deps = [
104    "$hiview_base:hiviewbase_static_lib_for_tdd",
105    "$hiview_core:hiview_core_for_test",
106    "$hiview_root/test/plugins/examples:bundletest",
107  ]
108
109  external_deps = [
110    "c_utils:utils",
111    "ffrt:libffrt",
112    "googletest:gtest_main",
113    "hilog:libhilog",
114  ]
115
116  resource_config_file = "$hiview_test/resource/ohos_test.xml"
117}
118
119ohos_unittest("EventDispatchQueueTest") {
120  module_out_path = module_output_path
121  configs = [ ":unittest_config" ]
122
123  sources = [ "unittest/common/event_dispatch_queue_test.cpp" ]
124
125  deps = [
126    "$hiview_base:hiview_base",
127    "$hiview_core:hiview_core",
128  ]
129
130  external_deps = [
131    "c_utils:utils",
132    "ffrt:libffrt",
133    "googletest:gtest_main",
134    "hilog:libhilog",
135  ]
136
137  resource_config_file = "$hiview_test/resource/ohos_test.xml"
138}
139
140ohos_unittest("HiviewPlatformConfigTest") {
141  module_out_path = module_output_path
142  configs = [ ":unittest_config" ]
143
144  sources = [ "unittest/common/hiview_platform_config_test.cpp" ]
145
146  deps = [
147    "$hiview_base:hiview_base",
148    "$hiview_core:hiview_core",
149    "../platform_config:hiviewplatform_config",
150  ]
151
152  external_deps = [
153    "c_utils:utils",
154    "ffrt:libffrt",
155    "googletest:gtest_main",
156    "hilog:libhilog",
157    "jsoncpp:jsoncpp",
158  ]
159}
160
161ohos_unittest("ParamUpdateTest") {
162  module_out_path = module_output_path
163  configs = [ ":unittest_config" ]
164
165  sources = [ "unittest/common/param_update_test.cpp" ]
166
167  deps = [
168    "$hiview_base:hiviewbase_static_lib_for_tdd",
169    "$hiview_core:hiview_core",
170    "$hiview_core/param_update:hiview_param_update",
171  ]
172
173  external_deps = [
174    "c_utils:utils",
175    "ffrt:libffrt",
176    "googletest:gtest_main",
177    "hilog:libhilog",
178  ]
179
180  resource_config_file = "$hiview_test/resource/ohos_test.xml"
181}
182