blob: 6e494c76befd03b7a2ce5ad7c40a3328989a96b6 [file] [log] [blame]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +00001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
ehmaldonado38a21322016-09-02 04:10:34 -07009import("../build/webrtc.gni")
kjellander0f380d82016-06-01 04:48:26 -070010import("//build/config/ui.gni")
kjellander0f380d82016-06-01 04:48:26 -070011if (is_android) {
12 import("//build/config/android/rules.gni")
13}
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000014
kjellanderb62dbbe2016-09-23 00:38:52 -070015group("test") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000016 testonly = true
17
18 deps = [
19 ":field_trial",
kjellander0f380d82016-06-01 04:48:26 -070020 ":rtp_test_utils",
21 ":test_common",
22 ":test_renderer",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000023 ":test_support",
24 ":test_support_main",
kjellander0f380d82016-06-01 04:48:26 -070025 ":test_support_unittests",
26 ":video_test_common",
27 ]
28}
29
ehmaldonado38a21322016-09-02 04:10:34 -070030rtc_source_set("video_test_common") {
kjellander0f380d82016-06-01 04:48:26 -070031 testonly = true
32 sources = [
33 "fake_texture_frame.cc",
34 "fake_texture_frame.h",
35 "frame_generator.cc",
36 "frame_generator.h",
37 "frame_utils.cc",
38 "frame_utils.h",
39 ]
40
kjellander0f380d82016-06-01 04:48:26 -070041 if (is_clang && !is_nacl) {
42 # Suppress warnings from the Chromium Clang plugin.
43 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -070044 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070045 }
46
47 deps = [
48 "../common_video",
49 ]
50}
51
ehmaldonado38a21322016-09-02 04:10:34 -070052rtc_source_set("rtp_test_utils") {
kjellander0f380d82016-06-01 04:48:26 -070053 testonly = true
54 sources = [
55 "rtcp_packet_parser.cc",
56 "rtcp_packet_parser.h",
57 "rtp_file_reader.cc",
58 "rtp_file_reader.h",
59 "rtp_file_writer.cc",
60 "rtp_file_writer.h",
61 ]
62
kjellander0f380d82016-06-01 04:48:26 -070063 if (is_clang && !is_nacl) {
64 # Suppress warnings from the Chromium Clang plugin.
65 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -070066 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070067 }
68
69 deps = [
70 "..:webrtc_common",
71 "../modules/rtp_rtcp",
72 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000073 ]
74}
75
ehmaldonado38a21322016-09-02 04:10:34 -070076rtc_source_set("field_trial") {
kjellander0f380d82016-06-01 04:48:26 -070077 testonly = true
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000078 sources = [
79 "field_trial.cc",
80 "field_trial.h",
81 ]
82
83 deps = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000084 "..:webrtc_common",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000085 "../system_wrappers",
phoglund37ebcf02016-01-08 05:04:57 -080086 "../system_wrappers:field_trial_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000087 ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000088}
89
ehmaldonado38a21322016-09-02 04:10:34 -070090rtc_source_set("test_main") {
kjellander0f380d82016-06-01 04:48:26 -070091 testonly = true
92 sources = [
93 "test_main.cc",
94 ]
95
96 deps = [
97 ":field_trial",
98 ":test_support",
99 "../system_wrappers:metrics_default",
100 "//testing/gtest",
101 "//third_party/gflags",
102 ]
kjellander0f380d82016-06-01 04:48:26 -0700103}
104
ehmaldonado38a21322016-09-02 04:10:34 -0700105rtc_source_set("test_support") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000106 testonly = true
107
108 sources = [
kwiberg77eab702016-09-28 17:42:01 -0700109 "gmock.h",
110 "gtest.h",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000111 "testsupport/fileutils.cc",
112 "testsupport/fileutils.h",
113 "testsupport/frame_reader.cc",
114 "testsupport/frame_reader.h",
115 "testsupport/frame_writer.cc",
116 "testsupport/frame_writer.h",
kjellander95177d12016-04-07 00:13:58 -0700117 "testsupport/iosfileutils.mm",
Peter Boström02083222016-06-14 12:52:54 +0200118 "testsupport/metrics/video_metrics.cc",
119 "testsupport/metrics/video_metrics.h",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000120 "testsupport/mock/mock_frame_reader.h",
121 "testsupport/mock/mock_frame_writer.h",
122 "testsupport/packet_reader.cc",
123 "testsupport/packet_reader.h",
124 "testsupport/perf_test.cc",
125 "testsupport/perf_test.h",
126 "testsupport/trace_to_stderr.cc",
127 "testsupport/trace_to_stderr.h",
128 ]
129
130 deps = [
nisse115bd152016-09-30 04:14:07 -0700131 ":video_test_common",
kjellander988d31e2016-02-05 00:23:50 -0800132 "../base:gtest_prod",
kwiberg77eab702016-09-28 17:42:01 -0700133 "../base:rtc_base_approved",
Peter Boström02083222016-06-14 12:52:54 +0200134 "../common_video",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000135 "../system_wrappers",
Peter Boström62e9bda2015-11-23 15:12:06 +0100136 "//testing/gmock",
137 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000138 ]
139
Peter Boström02083222016-06-14 12:52:54 +0200140 if (is_clang) {
141 # Suppress warnings from the Chromium Clang plugin.
142 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700143 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
Peter Boström02083222016-06-14 12:52:54 +0200144 }
145
kjellander95177d12016-04-07 00:13:58 -0700146 if (is_ios) {
kjellander0f380d82016-06-01 04:48:26 -0700147 configs += [ "//build/config/compiler:enable_arc" ]
148 }
149
150 if (use_x11) {
151 deps += [ "//tools/xdisplaycheck" ]
kjellander95177d12016-04-07 00:13:58 -0700152 }
153
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000154 if (is_android) {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000155 deps += [ "//base:base" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000156 }
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000157}
158
kjellander0f380d82016-06-01 04:48:26 -0700159# Depend on this target when you want to have test_support but also the
160# main method needed for gtest to execute!
ehmaldonado38a21322016-09-02 04:10:34 -0700161rtc_source_set("test_support_main") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000162 testonly = true
163
164 sources = [
165 "run_all_unittests.cc",
166 "test_suite.cc",
167 "test_suite.h",
168 ]
169
170 deps = [
171 ":field_trial",
172 ":test_support",
asapersson01d70a32016-05-20 06:29:46 -0700173 "../system_wrappers:metrics_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000174 "//testing/gmock",
175 "//testing/gtest",
176 "//third_party/gflags",
177 ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000178}
kjellander0f380d82016-06-01 04:48:26 -0700179
180# Depend on this target when you want to have test_support and a special
181# main for mac which will run your test on a worker thread and consume
182# events on the main thread. Useful if you want to access a webcam.
183# This main will provide all the scaffolding and objective-c black magic
184# for you. All you need to do is to implement a function in the
185# run_threaded_main_mac.h file (ImplementThisToRunYourTest).
ehmaldonado38a21322016-09-02 04:10:34 -0700186rtc_source_set("test_support_main_threaded_mac") {
kjellander0f380d82016-06-01 04:48:26 -0700187 testonly = true
188
189 sources = [
190 "testsupport/mac/run_threaded_main_mac.h",
191 "testsupport/mac/run_threaded_main_mac.mm",
192 ]
193
kjellander0f380d82016-06-01 04:48:26 -0700194 deps = [
195 ":test_support",
196 ]
197}
198
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700199test_support_unittests_resources = [
200 "//resources/foreman_cif_short.yuv",
201 "//resources/video_coding/frame-ethernet-ii.pcap",
202 "//resources/video_coding/frame-loopback.pcap",
203 "//resources/video_coding/pltype103.rtp",
204 "//resources/video_coding/pltype103_header_only.rtp",
205 "//resources/video_coding/ssrcs-2.pcap",
206 "//resources/video_coding/ssrcs-3.pcap",
207]
kjellander32c4a202016-08-30 02:53:49 -0700208
209if (is_ios) {
210 bundle_data("test_support_unittests_bundle_data") {
211 testonly = true
212 sources = test_support_unittests_resources
213 outputs = [
214 "{{bundle_resources_dir}}/{{source_file_part}}",
215 ]
216 }
217}
218
ehmaldonado38a21322016-09-02 04:10:34 -0700219rtc_test("test_support_unittests") {
kjellander0f380d82016-06-01 04:48:26 -0700220 deps = []
221 sources = [
kjellander0f380d82016-06-01 04:48:26 -0700222 "fake_network_pipe_unittest.cc",
223 "frame_generator_unittest.cc",
224 "rtp_file_reader_unittest.cc",
225 "rtp_file_writer_unittest.cc",
226 "testsupport/always_passing_unittest.cc",
227 "testsupport/fileutils_unittest.cc",
228 "testsupport/frame_reader_unittest.cc",
229 "testsupport/frame_writer_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200230 "testsupport/metrics/video_metrics_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700231 "testsupport/packet_reader_unittest.cc",
232 "testsupport/perf_test_unittest.cc",
233 "testsupport/unittest_utils.h",
234 ]
235
kjellander8f4419b2016-06-02 02:09:52 -0700236 # TODO(jschuh): Bug 1348: fix this warning.
237 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
238
kjellander0f380d82016-06-01 04:48:26 -0700239 if (is_win) {
kjellander8f4419b2016-06-02 02:09:52 -0700240 cflags = [ "/wd4373" ] # virtual override w/different const/volatile signature.
kjellander0f380d82016-06-01 04:48:26 -0700241 }
242
243 if (is_clang) {
244 # Suppress warnings from the Chromium Clang plugin.
245 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700246 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700247 }
248
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700249 data = test_support_unittests_resources
kjellander0f380d82016-06-01 04:48:26 -0700250 if (is_android) {
251 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700252 shard_timeout = 900
253 }
kjellander0f380d82016-06-01 04:48:26 -0700254
kjellander32c4a202016-08-30 02:53:49 -0700255 if (is_ios) {
256 deps += [ ":test_support_unittests_bundle_data" ]
kjellander0f380d82016-06-01 04:48:26 -0700257 }
kjellander28a0ffd2016-08-24 07:48:42 -0700258
kjellander0f380d82016-06-01 04:48:26 -0700259 deps += [
kjellander0f380d82016-06-01 04:48:26 -0700260 ":test_common",
261 ":test_support_main",
262 "../modules/video_capture",
263 "//testing/gmock",
264 "//testing/gtest",
265 ]
266}
267
ehmaldonado38a21322016-09-02 04:10:34 -0700268rtc_source_set("test_common") {
kjellander0f380d82016-06-01 04:48:26 -0700269 testonly = true
270 sources = [
271 "call_test.cc",
272 "call_test.h",
273 "configurable_frame_size_encoder.cc",
274 "configurable_frame_size_encoder.h",
275 "constants.cc",
276 "constants.h",
277 "direct_transport.cc",
278 "direct_transport.h",
279 "drifting_clock.cc",
280 "drifting_clock.h",
281 "encoder_settings.cc",
282 "encoder_settings.h",
283 "fake_audio_device.cc",
284 "fake_audio_device.h",
285 "fake_decoder.cc",
286 "fake_decoder.h",
287 "fake_encoder.cc",
288 "fake_encoder.h",
289 "fake_network_pipe.cc",
290 "fake_network_pipe.h",
sakal55d932b2016-09-30 06:19:08 -0700291 "fake_videorenderer.h",
kjellander0f380d82016-06-01 04:48:26 -0700292 "frame_generator_capturer.cc",
293 "frame_generator_capturer.h",
294 "layer_filtering_transport.cc",
295 "layer_filtering_transport.h",
296 "mock_transport.h",
297 "mock_voe_channel_proxy.h",
298 "mock_voice_engine.h",
299 "null_transport.cc",
300 "null_transport.h",
301 "rtp_rtcp_observer.h",
302 "statistics.cc",
303 "statistics.h",
304 "vcm_capturer.cc",
305 "vcm_capturer.h",
kjellander0f380d82016-06-01 04:48:26 -0700306 "video_capturer.h",
307 "win/run_loop_win.cc",
308 ]
309 if (!is_win) {
310 sources += [
311 "run_loop.cc",
312 "run_loop.h",
313 ]
314 }
315
kjellander0f380d82016-06-01 04:48:26 -0700316 if (is_clang && !is_nacl) {
317 # Suppress warnings from the Chromium Clang plugin.
318 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700319 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700320 }
321
322 deps = [
323 ":rtp_test_utils",
324 ":test_support",
kjellander0f380d82016-06-01 04:48:26 -0700325 "..:webrtc_common",
kjellander94cee312016-06-10 01:56:57 -0700326 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700327 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700328 "../call",
kjellander0f380d82016-06-01 04:48:26 -0700329 "../modules/media_file",
kjellander94cee312016-06-10 01:56:57 -0700330 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700331 "//testing/gmock",
332 "//testing/gtest",
kjellander0f380d82016-06-01 04:48:26 -0700333 ]
334}
335
336config("test_renderer_exported_config") {
337 if (is_win && is_clang) {
338 # GN orders flags on a target before flags from configs. The default config
339 # adds -Wall, and this flag have to be after -Wall -- so they need to
340 # come from a config and cannot be on the target directly.
ehmaldonado4bc4d272016-08-25 04:15:40 -0700341 cflags = [
kjellander0f380d82016-06-01 04:48:26 -0700342 "-Wno-bool-conversion",
343 "-Wno-comment",
344 "-Wno-delete-non-virtual-dtor",
345 ]
346 }
347}
348
ehmaldonado38a21322016-09-02 04:10:34 -0700349rtc_source_set("test_renderer") {
kjellander0f380d82016-06-01 04:48:26 -0700350 testonly = true
351 libs = []
352 sources = [
353 "linux/glx_renderer.cc",
354 "linux/glx_renderer.h",
355 "linux/video_renderer_linux.cc",
356 "mac/video_renderer_mac.h",
357 "mac/video_renderer_mac.mm",
358 "video_renderer.cc",
359 "video_renderer.h",
360 "win/d3d_renderer.cc",
361 "win/d3d_renderer.h",
362 ]
363 if (!is_linux && !is_mac && !is_win) {
364 sources += [ "null_platform_renderer.cc" ]
365 }
366 if (is_linux || is_mac) {
367 sources += [
368 "gl/gl_renderer.cc",
369 "gl/gl_renderer.h",
370 ]
371 }
372
373 if (is_linux) {
374 libs += [
375 "Xext",
376 "X11",
377 "GL",
378 ]
379 }
380 if (is_android) {
381 libs += [
382 "GLESv2",
383 "log",
384 ]
385 }
386 if (is_mac) {
387 libs = [
388 "Cocoa.framework",
389 "OpenGL.framework",
390 "CoreVideo.framework",
391 ]
392 }
393
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700394 public_configs = [ ":test_renderer_exported_config" ]
kjellander0f380d82016-06-01 04:48:26 -0700395
396 if (is_clang && !is_nacl) {
397 # Suppress warnings from the Chromium Clang plugin.
398 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700399 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700400 }
401
402 deps = [
403 ":test_support",
404 ":video_test_common",
405 "../modules/media_file",
406 "//testing/gtest",
407 ]
408}