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. 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 ":PlatformConfigTest", 23 ":PluginBundleTest", 24 ":PluginPlatformTest", 25 ] 26} 27 28config("unittest_config") { 29 include_dirs = [ 30 "../", 31 "unittest/common", 32 ] 33 34 cflags_cc = [ 35 "-D__UNITTEST__", 36 "-D__HIVIEW_OHOS__", 37 ] 38} 39 40ohos_unittest("PlatformConfigTest") { 41 module_out_path = module_output_path 42 configs = [ ":unittest_config" ] 43 44 sources = [ "unittest/common/platform_config_test.cpp" ] 45 46 deps = [ 47 "$hiview_base:hiviewbase_static_lib_for_tdd", 48 "$hiview_core:hiview_core", 49 "//third_party/googletest:gtest_main", 50 ] 51 52 resource_config_file = "$hiview_test/resource/ohos_test.xml" 53 external_deps = [ "hilog_native:libhilog" ] 54} 55 56ohos_unittest("PluginPlatformTest") { 57 module_out_path = module_output_path 58 configs = [ ":unittest_config" ] 59 60 cflags_cc = [ "-DTEST_LOCAL_SRC" ] 61 62 sources = [ 63 "unittest/common/platform_test_result_listener.cpp", 64 "unittest/common/plugin_platform_test.cpp", 65 ] 66 67 deps = [ 68 "$hiview_base:hiviewbase_static_lib_for_tdd", 69 "$hiview_core:hiview_core", 70 "$hiview_root/test/plugins/examples/dynamic_load_plugin_example:dynamicloadpluginexample", 71 "$hiview_root/test/plugins/examples/event_processor_example1:event_processor_example1", 72 "$hiview_root/test/plugins/examples/event_processor_example2:event_processor_example2", 73 "$hiview_root/test/plugins/examples/event_processor_example3:event_processor_example3", 74 "$hiview_root/test/plugins/examples/event_processor_example4:event_processor_example4", 75 "$hiview_root/test/plugins/examples/event_source_example:event_source_example", 76 "//third_party/googletest:gtest_main", 77 ] 78 79 resource_config_file = "$hiview_test/resource/ohos_test.xml" 80 external_deps = [ "hilog_native:libhilog" ] 81} 82 83ohos_unittest("PluginBundleTest") { 84 module_out_path = module_output_path 85 configs = [ ":unittest_config" ] 86 sources = [ 87 "unittest/common/platform_test_result_listener.cpp", 88 "unittest/common/plugin_bundle_test.cpp", 89 ] 90 91 deps = [ 92 "$hiview_base:hiviewbase_static_lib_for_tdd", 93 "$hiview_core:hiview_core", 94 "$hiview_root/test/plugins/examples:bundletest", 95 "//third_party/googletest:gtest_main", 96 ] 97 98 resource_config_file = "$hiview_test/resource/ohos_test.xml" 99 external_deps = [ "hilog_native:libhilog" ] 100} 101 102ohos_unittest("EventDispatchQueueTest") { 103 module_out_path = module_output_path 104 configs = [ ":unittest_config" ] 105 106 sources = [ "unittest/common/event_dispatch_queue_test.cpp" ] 107 108 deps = [ 109 "$hiview_base:hiview_base", 110 "$hiview_core:hiview_core", 111 "//third_party/googletest:gtest_main", 112 ] 113 114 resource_config_file = "$hiview_test/resource/ohos_test.xml" 115} 116 117ohos_unittest("HiviewPlatformConfigTest") { 118 module_out_path = module_output_path 119 configs = [ ":unittest_config" ] 120 121 sources = [ "unittest/common/hiview_platform_config_test.cpp" ] 122 123 deps = [ 124 "$hiview_adapter/utility:hiview_adapter_utility", 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("EventServerTest") { 133 module_out_path = module_output_path 134 configs = [ ":unittest_config" ] 135 136 sources = [ "unittest/common/event_server_test.cpp" ] 137 138 deps = [ 139 "$hiview_adapter/utility:hiview_adapter_utility", 140 "$hiview_core:sysevent_source", 141 "//third_party/googletest:gtest_main", 142 ] 143} 144