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