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