• 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    ":EventJsonParserTest",
22    ":HiviewPlatformConfigTest",
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    "//third_party/googletest:gtest_main",
51  ]
52
53  resource_config_file = "$hiview_test/resource/ohos_test.xml"
54  external_deps = [ "hilog:libhilog" ]
55}
56
57ohos_unittest("PluginPlatformTest") {
58  module_out_path = module_output_path
59  configs = [ ":unittest_config" ]
60
61  cflags_cc = [ "-DTEST_LOCAL_SRC" ]
62
63  sources = [
64    "unittest/common/platform_test_result_listener.cpp",
65    "unittest/common/plugin_platform_test.cpp",
66  ]
67
68  deps = [
69    "$hiview_base:hiviewbase_static_lib_for_tdd",
70    "$hiview_core:hiview_core",
71    "$hiview_root/test/plugins/examples/dynamic_load_plugin_example:dynamicloadpluginexample",
72    "$hiview_root/test/plugins/examples/event_processor_example1:event_processor_example1",
73    "$hiview_root/test/plugins/examples/event_processor_example2:event_processor_example2",
74    "$hiview_root/test/plugins/examples/event_processor_example3:event_processor_example3",
75    "$hiview_root/test/plugins/examples/event_processor_example4:event_processor_example4",
76    "$hiview_root/test/plugins/examples/event_source_example:event_source_example",
77    "//third_party/googletest:gtest_main",
78  ]
79
80  resource_config_file = "$hiview_test/resource/ohos_test.xml"
81  external_deps = [ "hilog:libhilog" ]
82}
83
84ohos_unittest("PluginBundleTest") {
85  module_out_path = module_output_path
86  configs = [ ":unittest_config" ]
87  sources = [
88    "unittest/common/platform_test_result_listener.cpp",
89    "unittest/common/plugin_bundle_test.cpp",
90  ]
91
92  deps = [
93    "$hiview_base:hiviewbase_static_lib_for_tdd",
94    "$hiview_core:hiview_core",
95    "$hiview_root/test/plugins/examples:bundletest",
96    "//third_party/googletest:gtest_main",
97  ]
98
99  resource_config_file = "$hiview_test/resource/ohos_test.xml"
100  external_deps = [ "hilog:libhilog" ]
101}
102
103ohos_unittest("EventDispatchQueueTest") {
104  module_out_path = module_output_path
105  configs = [ ":unittest_config" ]
106
107  sources = [ "unittest/common/event_dispatch_queue_test.cpp" ]
108
109  deps = [
110    "$hiview_base:hiview_base",
111    "$hiview_core:hiview_core",
112    "//third_party/googletest:gtest_main",
113  ]
114
115  resource_config_file = "$hiview_test/resource/ohos_test.xml"
116}
117
118ohos_unittest("HiviewPlatformConfigTest") {
119  module_out_path = module_output_path
120  configs = [ ":unittest_config" ]
121
122  sources = [ "unittest/common/hiview_platform_config_test.cpp" ]
123
124  deps = [
125    "$hiview_base:hiview_base",
126    "$hiview_core:hiview_core",
127    "../platform_config:hiviewplatform_config",
128    "//third_party/googletest:gtest_main",
129  ]
130}
131
132ohos_unittest("EventJsonParserTest") {
133  module_out_path = module_output_path
134  configs = [ ":unittest_config" ]
135
136  sources = [ "unittest/common/event_json_parser_test.cpp" ]
137
138  deps = [
139    "$hiview_base:hiviewbase_static_lib_for_tdd",
140    "$hiview_core:hiview_core",
141    "//third_party/googletest:gtest_main",
142  ]
143}
144