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. 13 14import("//build/test.gni") 15import("//foundation/graphic/graphic_2d/graphic_config.gni") 16 17module_out_path = "graphic_2d/composer" 18 19group("unittest") { 20 testonly = true 21 22 deps = [ 23 ":native_vsync_test", 24 ":vsync_connection_test", 25 ":vsync_controller_test", 26 ":vsync_distributor_test", 27 ":vsync_generator_test", 28 ":vsync_present_fence_test", 29 ":vsync_receiver_test", 30 ":vsync_sampler_test", 31 ] 32 33 if (graphic_2d_feature_enable_dvsync) { 34 deps += [ ":dvsync_rate_test" ] 35 } 36} 37 38## UnitTest vsync_connection_test {{{ 39ohos_unittest("vsync_connection_test") { 40 module_out_path = module_out_path 41 42 sources = [ "vsync_connection_test.cpp" ] 43 44 deps = [ 45 ":vsync_test_common", 46 "//foundation/graphic/graphic_2d/utils:socketpair", 47 ] 48} 49 50## UnitTest vsync_connection_test }}} 51 52## UnitTest vsync_controller_test {{{ 53ohos_unittest("vsync_controller_test") { 54 module_out_path = module_out_path 55 56 sources = [ "vsync_controller_test.cpp" ] 57 58 deps = [ ":vsync_test_common" ] 59} 60 61## UnitTest vsync_controller_test }}} 62 63## UnitTest vsync_distributor_test {{{ 64ohos_unittest("vsync_distributor_test") { 65 module_out_path = module_out_path 66 67 sources = [ "vsync_distributor_test.cpp" ] 68 69 deps = [ 70 ":vsync_test_common", 71 "//foundation/graphic/graphic_2d/utils:socketpair", 72 ] 73} 74 75## UnitTest vsync_distributor_test }}} 76 77## UnitTest vsync_generator_test {{{ 78ohos_unittest("vsync_generator_test") { 79 module_out_path = module_out_path 80 81 sources = [ "vsync_generator_test.cpp" ] 82 83 deps = [ ":vsync_test_common" ] 84 85 external_deps = [ 86 "eventhandler:libeventhandler", 87 "ipc:ipc_core", 88 ] 89} 90 91## UnitTest vsync_generator_test }}} 92 93## UnitTest vsync_receiver_test {{{ 94ohos_unittest("vsync_receiver_test") { 95 module_out_path = module_out_path 96 97 sources = [ "vsync_receiver_test.cpp" ] 98 99 deps = [ 100 ":vsync_test_common", 101 "../../../../../modules/platform:eventhandler", 102 "../../../../../modules/render_service_client:librender_service_client", 103 "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", 104 "//foundation/graphic/graphic_2d/utils:socketpair", 105 ] 106} 107 108## UnitTest vsync_receiver_test }}} 109 110## UnitTest vsync_sampler_test {{{ 111ohos_unittest("vsync_sampler_test") { 112 module_out_path = module_out_path 113 114 sources = [ "vsync_sampler_test.cpp" ] 115 116 deps = [ ":vsync_test_common" ] 117} 118 119## UnitTest vsync_sampler_test }}} 120 121## UnitTest native {{{ 122ohos_unittest("native_vsync_test") { 123 module_out_path = module_out_path 124 125 sources = [ "native_vsync_test.cpp" ] 126 127 deps = [ ":vsync_test_common" ] 128} 129 130## UnitTest vsync_connection_test }}} 131 132## UnitTest vsync_present_fence_test {{{ 133ohos_unittest("vsync_present_fence_test") { 134 module_out_path = module_out_path 135 136 sources = [ "vsync_present_fence_test.cpp" ] 137 138 deps = [ ":vsync_test_common" ] 139} 140 141## UnitTest vsync_present_fence_test }}} 142 143## UnitTest dvsync_rate_test {{{ 144ohos_unittest("dvsync_rate_test") { 145 module_out_path = module_out_path 146 147 sources = [ "$graphic_2d_ext_root/dvsync/test/unittest/dvsync_rate_test.cpp" ] 148 149 deps = [ 150 ":vsync_test_common", 151 "../../../../../../utils:socketpair", 152 "../../../../../modules/platform:eventhandler", 153 "../../../../../modules/render_service_client:librender_service_client", 154 ] 155 156 external_deps = [ 157 "c_utils:utils", 158 "ipc:ipc_core", 159 ] 160} 161 162## UnitTest dvsync_rate_test }}} 163 164## Build vsync_test_common.a {{{ 165config("vsync_test_common_public_config") { 166 include_dirs = [ 167 "//foundation/graphic/graphic_2d/interfaces/inner_api/common", 168 "//foundation/graphic/graphic_2d/rosen/modules/composer/vsync/include", 169 ] 170 171 cflags = [ 172 "-Wall", 173 "-Werror", 174 "-g3", 175 "-Dprivate=public", 176 "-Dprotected=public", 177 ] 178} 179 180ohos_static_library("vsync_test_common") { 181 visibility = [ ":*" ] 182 testonly = true 183 184 public_configs = [ ":vsync_test_common_public_config" ] 185 186 public_deps = [ 187 "//foundation/graphic/graphic_2d/rosen/modules/composer/native_vsync:libnative_vsync", 188 "//foundation/graphic/graphic_2d/rosen/modules/composer/vsync:libvsync", 189 "//third_party/googletest:gmock_main", 190 "//third_party/googletest:gtest_main", 191 ] 192 193 public_external_deps = [ 194 "c_utils:utils", 195 "graphic_surface:surface", 196 ] 197 198 subsystem_name = "graphic" 199 part_name = "graphic_2d" 200} 201## Build vsync_test_common.a }}} 202