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/hiview.gni") 14import("//build/ohos.gni") 15import("//build/test.gni") 16module_output_path = "hiviewdfx/hiview" 17group("moduletest") { 18 testonly = true 19} 20 21ohos_unittest("HiviewPlatformModuleTest") { 22 module_out_path = module_output_path 23 24 include_dirs = [ "moduletest/common" ] 25 26 sources = [ "moduletest/common/hiview_plugin_platform_module_test.cpp" ] 27 28 deps = [ "$hiview_base:hiviewbase_static_lib_for_tdd" ] 29 30 external_deps = [ 31 "googletest:gtest_main", 32 "hilog:libhilog", 33 ] 34} 35 36config("HolisticPlatformTest_config") { 37 include_dirs = [ 38 "../", 39 "$hiview_test/plugins/examples_bundle/bundle_event_source_example", 40 "$hiview_test/plugins/examples/event_source_example", 41 ] 42 43 cflags_cc = [ 44 "-D__UNITTEST__", 45 "-D__HIVIEW_OHOS__", 46 "-DUSE_POLL", 47 ] 48} 49 50ohos_unittest("HolisticPlatformTest") { 51 testonly = true 52 module_out_path = module_output_path 53 configs = [ ":HolisticPlatformTest_config" ] 54 55 sources = [ "unittest/common/holistic_platform_test.cpp" ] 56 57 deps = [ 58 "$hiview_base:hiviewbase_static_lib_for_tdd", 59 "$hiview_core:hiview_core_for_test", 60 "$hiview_root/test/plugins/examples/dynamic_load_plugin_example:dynamicloadpluginexample", 61 "$hiview_root/test/plugins/examples/event_processor_example1:event_processor_example1", 62 "$hiview_root/test/plugins/examples/event_processor_example2:event_processor_example2", 63 "$hiview_root/test/plugins/examples/event_processor_example3:event_processor_example3", 64 "$hiview_root/test/plugins/examples/event_processor_example4:event_processor_example4", 65 "$hiview_root/test/plugins/examples/event_processor_example5:event_processor_example5", 66 "$hiview_root/test/plugins/examples/event_source_example:event_source_example", 67 "$hiview_test/plugins/examples_bundle:bundleplugintest", 68 ] 69 70 external_deps = [ 71 "ffrt:libffrt", 72 "googletest:gtest_main", 73 "hilog:libhilog", 74 ] 75 76 resource_config_file = "$hiview_test/resource/ohos_test.xml" 77} 78 79ohos_unittest("ReportXPowerEventTest") { 80 module_out_path = module_output_path 81 configs = [] 82 83 sources = [ "unittest/xpower_event/xpower_event_test.cpp" ] 84 85 deps = [ "$hiview_root/interfaces/innerkits/xpower_event:libxpower_event" ] 86 87 external_deps = [ 88 "googletest:gtest_main", 89 "hilog:libhilog", 90 "init:libbegetutil", 91 ] 92} 93 94if (!defined(ohos_lite)) { 95 import("//build/test.gni") 96 97 ohos_unittest("ReportXPowerJsEventTest") { 98 module_out_path = module_output_path 99 cflags = [ "-g3" ] 100 defines = [ "NAPI_TEST" ] 101 include_dirs = [ 102 "//foundation/arkui/napi/test/unittest/engine/", 103 "//foundation/arkui/napi/test/unittest/common/", 104 ] 105 106 sources = [ "unittest/xpower_event/xpower_jsevent_test.cpp" ] 107 deps = 108 [ "$hiview_root/interfaces/innerkits/xpower_event:libxpower_event_js" ] 109 external_deps = [ 110 "bounds_checking_function:libsec_shared", 111 "c_utils:utils", 112 "ets_runtime:libark_jsruntime", 113 "init:libbegetutil", 114 "napi:ace_napi", 115 ] 116 117 external_deps += [ "hilog:libhilog" ] 118 } 119} 120 121group("unittest") { 122 testonly = true 123 deps = [ 124 ":HiviewPlatformModuleTest", 125 ":HolisticPlatformTest", 126 ":ReportXPowerEventTest", 127 ":ReportXPowerJsEventTest", 128 "unittest/unified_collection/client:UCollectionClientUnitTest", 129 "unittest/unified_collection/utility:UCollectionUtilityUnitTest", 130 ] 131} 132