blob: 6b6a2bb33f432b08962a4e553ee58cf5a3bb70c1 [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
ehmaldonado38a21322016-09-02 04:10:34 -070015rtc_source_set("test") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000016 testonly = true
17
18 deps = [
kjellander0f380d82016-06-01 04:48:26 -070019 ":channel_transport",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000020 ":field_trial",
kjellander0f380d82016-06-01 04:48:26 -070021 ":rtp_test_utils",
22 ":test_common",
23 ":test_renderer",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000024 ":test_support",
25 ":test_support_main",
kjellander0f380d82016-06-01 04:48:26 -070026 ":test_support_unittests",
27 ":video_test_common",
28 ]
29}
30
31config("channel_transport_warnings_config") {
32 if (is_win) {
33 cflags = [ "/wd4302" ] # cast truncation
34
35 if (is_clang) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -070036 # GN orders flags on a target before flags from configs. The default
37 # config adds -Wall, and this flag have to be after -Wall -- so they need
38 # to come from a config and cannot be on the target directly.
kjellander0f380d82016-06-01 04:48:26 -070039 cflags += [
40 "-Wno-parentheses-equality",
41 "-Wno-reorder",
42 "-Wno-tautological-constant-out-of-range-compare",
ehmaldonadod02fe4b2016-08-26 13:31:24 -070043
44 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6268
45 # for -Wno-thread-safety-analysis
46 "-Wno-thread-safety-analysis",
kjellander0f380d82016-06-01 04:48:26 -070047 "-Wno-unused-private-field",
48 ]
49 }
50 }
51}
52
ehmaldonado38a21322016-09-02 04:10:34 -070053rtc_source_set("channel_transport") {
kjellander0f380d82016-06-01 04:48:26 -070054 testonly = true
55 sources = [
56 "channel_transport/channel_transport.cc",
57 "channel_transport/channel_transport.h",
58 "channel_transport/traffic_control_win.cc",
59 "channel_transport/traffic_control_win.h",
60 "channel_transport/udp_socket2_manager_win.cc",
61 "channel_transport/udp_socket2_manager_win.h",
62 "channel_transport/udp_socket2_win.cc",
63 "channel_transport/udp_socket2_win.h",
64 "channel_transport/udp_socket_manager_posix.cc",
65 "channel_transport/udp_socket_manager_posix.h",
66 "channel_transport/udp_socket_manager_wrapper.cc",
67 "channel_transport/udp_socket_manager_wrapper.h",
68 "channel_transport/udp_socket_posix.cc",
69 "channel_transport/udp_socket_posix.h",
70 "channel_transport/udp_socket_wrapper.cc",
71 "channel_transport/udp_socket_wrapper.h",
72 "channel_transport/udp_transport.h",
73 "channel_transport/udp_transport_impl.cc",
74 "channel_transport/udp_transport_impl.h",
75 ]
76
ehmaldonado7a2ce0b2016-09-05 01:35:44 -070077 configs += [ ":channel_transport_warnings_config" ]
kjellander0f380d82016-06-01 04:48:26 -070078
79 if (is_clang && !is_nacl) {
80 # Suppress warnings from the Chromium Clang plugin.
81 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -070082 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070083 }
84
85 deps = [
86 "..:webrtc_common",
87 "../system_wrappers",
88 "//testing/gtest",
89 ]
90}
91
ehmaldonado38a21322016-09-02 04:10:34 -070092rtc_source_set("video_test_common") {
kjellander0f380d82016-06-01 04:48:26 -070093 testonly = true
94 sources = [
95 "fake_texture_frame.cc",
96 "fake_texture_frame.h",
97 "frame_generator.cc",
98 "frame_generator.h",
99 "frame_utils.cc",
100 "frame_utils.h",
101 ]
102
kjellander0f380d82016-06-01 04:48:26 -0700103 if (is_clang && !is_nacl) {
104 # Suppress warnings from the Chromium Clang plugin.
105 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700106 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700107 }
108
109 deps = [
110 "../common_video",
111 ]
112}
113
ehmaldonado38a21322016-09-02 04:10:34 -0700114rtc_source_set("rtp_test_utils") {
kjellander0f380d82016-06-01 04:48:26 -0700115 testonly = true
116 sources = [
117 "rtcp_packet_parser.cc",
118 "rtcp_packet_parser.h",
119 "rtp_file_reader.cc",
120 "rtp_file_reader.h",
121 "rtp_file_writer.cc",
122 "rtp_file_writer.h",
123 ]
124
kjellander0f380d82016-06-01 04:48:26 -0700125 if (is_clang && !is_nacl) {
126 # Suppress warnings from the Chromium Clang plugin.
127 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700128 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700129 }
130
131 deps = [
132 "..:webrtc_common",
133 "../modules/rtp_rtcp",
134 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000135 ]
136}
137
ehmaldonado38a21322016-09-02 04:10:34 -0700138rtc_source_set("field_trial") {
kjellander0f380d82016-06-01 04:48:26 -0700139 testonly = true
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000140 sources = [
141 "field_trial.cc",
142 "field_trial.h",
143 ]
144
145 deps = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000146 "..:webrtc_common",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000147 "../system_wrappers",
phoglund37ebcf02016-01-08 05:04:57 -0800148 "../system_wrappers:field_trial_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000149 ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000150}
151
ehmaldonado38a21322016-09-02 04:10:34 -0700152rtc_source_set("test_main") {
kjellander0f380d82016-06-01 04:48:26 -0700153 testonly = true
154 sources = [
155 "test_main.cc",
156 ]
157
158 deps = [
159 ":field_trial",
160 ":test_support",
161 "../system_wrappers:metrics_default",
162 "//testing/gtest",
163 "//third_party/gflags",
164 ]
kjellander0f380d82016-06-01 04:48:26 -0700165}
166
ehmaldonado38a21322016-09-02 04:10:34 -0700167rtc_source_set("test_support") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000168 testonly = true
169
170 sources = [
171 "testsupport/fileutils.cc",
172 "testsupport/fileutils.h",
173 "testsupport/frame_reader.cc",
174 "testsupport/frame_reader.h",
175 "testsupport/frame_writer.cc",
176 "testsupport/frame_writer.h",
kjellander95177d12016-04-07 00:13:58 -0700177 "testsupport/iosfileutils.mm",
Peter Boström02083222016-06-14 12:52:54 +0200178 "testsupport/metrics/video_metrics.cc",
179 "testsupport/metrics/video_metrics.h",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000180 "testsupport/mock/mock_frame_reader.h",
181 "testsupport/mock/mock_frame_writer.h",
182 "testsupport/packet_reader.cc",
183 "testsupport/packet_reader.h",
184 "testsupport/perf_test.cc",
185 "testsupport/perf_test.h",
186 "testsupport/trace_to_stderr.cc",
187 "testsupport/trace_to_stderr.h",
188 ]
189
190 deps = [
kjellander988d31e2016-02-05 00:23:50 -0800191 "../base:gtest_prod",
Peter Boström02083222016-06-14 12:52:54 +0200192 "../common_video",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000193 "../system_wrappers",
Peter Boström62e9bda2015-11-23 15:12:06 +0100194 "//testing/gmock",
195 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000196 ]
197
Peter Boström02083222016-06-14 12:52:54 +0200198 if (is_clang) {
199 # Suppress warnings from the Chromium Clang plugin.
200 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700201 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
Peter Boström02083222016-06-14 12:52:54 +0200202 }
203
kjellander95177d12016-04-07 00:13:58 -0700204 if (is_ios) {
kjellander0f380d82016-06-01 04:48:26 -0700205 configs += [ "//build/config/compiler:enable_arc" ]
206 }
207
208 if (use_x11) {
209 deps += [ "//tools/xdisplaycheck" ]
kjellander95177d12016-04-07 00:13:58 -0700210 }
211
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000212 if (is_android) {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000213 deps += [ "//base:base" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000214 }
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000215}
216
kjellander0f380d82016-06-01 04:48:26 -0700217# Depend on this target when you want to have test_support but also the
218# main method needed for gtest to execute!
ehmaldonado38a21322016-09-02 04:10:34 -0700219rtc_source_set("test_support_main") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000220 testonly = true
221
222 sources = [
223 "run_all_unittests.cc",
224 "test_suite.cc",
225 "test_suite.h",
226 ]
227
228 deps = [
229 ":field_trial",
230 ":test_support",
asapersson01d70a32016-05-20 06:29:46 -0700231 "../system_wrappers:metrics_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000232 "//testing/gmock",
233 "//testing/gtest",
234 "//third_party/gflags",
235 ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000236}
kjellander0f380d82016-06-01 04:48:26 -0700237
238# Depend on this target when you want to have test_support and a special
239# main for mac which will run your test on a worker thread and consume
240# events on the main thread. Useful if you want to access a webcam.
241# This main will provide all the scaffolding and objective-c black magic
242# for you. All you need to do is to implement a function in the
243# run_threaded_main_mac.h file (ImplementThisToRunYourTest).
ehmaldonado38a21322016-09-02 04:10:34 -0700244rtc_source_set("test_support_main_threaded_mac") {
kjellander0f380d82016-06-01 04:48:26 -0700245 testonly = true
246
247 sources = [
248 "testsupport/mac/run_threaded_main_mac.h",
249 "testsupport/mac/run_threaded_main_mac.mm",
250 ]
251
kjellander0f380d82016-06-01 04:48:26 -0700252 deps = [
253 ":test_support",
254 ]
255}
256
kjellander32c4a202016-08-30 02:53:49 -0700257if (is_android || is_ios) {
258 test_support_unittests_resources = [
259 "//resources/foreman_cif_short.yuv",
260 "//resources/video_coding/frame-ethernet-ii.pcap",
261 "//resources/video_coding/frame-loopback.pcap",
262 "//resources/video_coding/pltype103.rtp",
263 "//resources/video_coding/pltype103_header_only.rtp",
264 "//resources/video_coding/ssrcs-2.pcap",
265 "//resources/video_coding/ssrcs-3.pcap",
266 ]
267}
268
269if (is_ios) {
270 bundle_data("test_support_unittests_bundle_data") {
271 testonly = true
272 sources = test_support_unittests_resources
273 outputs = [
274 "{{bundle_resources_dir}}/{{source_file_part}}",
275 ]
276 }
277}
278
ehmaldonado38a21322016-09-02 04:10:34 -0700279rtc_test("test_support_unittests") {
kjellander0f380d82016-06-01 04:48:26 -0700280 deps = []
281 sources = [
282 "channel_transport/udp_socket_manager_unittest.cc",
283 "channel_transport/udp_socket_wrapper_unittest.cc",
284 "channel_transport/udp_transport_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200285 "common_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700286 "fake_network_pipe_unittest.cc",
287 "frame_generator_unittest.cc",
288 "rtp_file_reader_unittest.cc",
289 "rtp_file_writer_unittest.cc",
290 "testsupport/always_passing_unittest.cc",
291 "testsupport/fileutils_unittest.cc",
292 "testsupport/frame_reader_unittest.cc",
293 "testsupport/frame_writer_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200294 "testsupport/metrics/video_metrics_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700295 "testsupport/packet_reader_unittest.cc",
296 "testsupport/perf_test_unittest.cc",
297 "testsupport/unittest_utils.h",
298 ]
299
kjellander8f4419b2016-06-02 02:09:52 -0700300 # TODO(jschuh): Bug 1348: fix this warning.
301 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
302
kjellander0f380d82016-06-01 04:48:26 -0700303 if (is_win) {
kjellander8f4419b2016-06-02 02:09:52 -0700304 cflags = [ "/wd4373" ] # virtual override w/different const/volatile signature.
kjellander0f380d82016-06-01 04:48:26 -0700305 }
306
307 if (is_clang) {
308 # Suppress warnings from the Chromium Clang plugin.
309 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700310 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700311 }
312
313 if (is_android) {
314 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander32c4a202016-08-30 02:53:49 -0700315 data = test_support_unittests_resources
kjellander28a0ffd2016-08-24 07:48:42 -0700316 shard_timeout = 900
317 }
kjellander0f380d82016-06-01 04:48:26 -0700318
kjellander32c4a202016-08-30 02:53:49 -0700319 if (is_ios) {
320 deps += [ ":test_support_unittests_bundle_data" ]
kjellander0f380d82016-06-01 04:48:26 -0700321 }
kjellander28a0ffd2016-08-24 07:48:42 -0700322
kjellander0f380d82016-06-01 04:48:26 -0700323 deps += [
324 ":channel_transport",
325 ":test_common",
326 ":test_support_main",
327 "../modules/video_capture",
328 "//testing/gmock",
329 "//testing/gtest",
330 ]
331}
332
ehmaldonado38a21322016-09-02 04:10:34 -0700333rtc_source_set("test_common") {
kjellander0f380d82016-06-01 04:48:26 -0700334 testonly = true
335 sources = [
336 "call_test.cc",
337 "call_test.h",
338 "configurable_frame_size_encoder.cc",
339 "configurable_frame_size_encoder.h",
340 "constants.cc",
341 "constants.h",
342 "direct_transport.cc",
343 "direct_transport.h",
344 "drifting_clock.cc",
345 "drifting_clock.h",
346 "encoder_settings.cc",
347 "encoder_settings.h",
348 "fake_audio_device.cc",
349 "fake_audio_device.h",
350 "fake_decoder.cc",
351 "fake_decoder.h",
352 "fake_encoder.cc",
353 "fake_encoder.h",
354 "fake_network_pipe.cc",
355 "fake_network_pipe.h",
356 "frame_generator_capturer.cc",
357 "frame_generator_capturer.h",
358 "layer_filtering_transport.cc",
359 "layer_filtering_transport.h",
360 "mock_transport.h",
361 "mock_voe_channel_proxy.h",
362 "mock_voice_engine.h",
363 "null_transport.cc",
364 "null_transport.h",
365 "rtp_rtcp_observer.h",
366 "statistics.cc",
367 "statistics.h",
368 "vcm_capturer.cc",
369 "vcm_capturer.h",
370 "video_capturer.cc",
371 "video_capturer.h",
372 "win/run_loop_win.cc",
373 ]
374 if (!is_win) {
375 sources += [
376 "run_loop.cc",
377 "run_loop.h",
378 ]
379 }
380
kjellander0f380d82016-06-01 04:48:26 -0700381 if (is_clang && !is_nacl) {
382 # Suppress warnings from the Chromium Clang plugin.
383 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700384 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700385 }
386
387 deps = [
388 ":rtp_test_utils",
389 ":test_support",
390 ":video_test_common",
kjellander0f380d82016-06-01 04:48:26 -0700391 "..:webrtc_common",
kjellander94cee312016-06-10 01:56:57 -0700392 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700393 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700394 "../call",
kjellander0f380d82016-06-01 04:48:26 -0700395 "../modules/media_file",
kjellander94cee312016-06-10 01:56:57 -0700396 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700397 "//testing/gmock",
398 "//testing/gtest",
399 "//third_party/gflags",
400 ]
401}
402
403config("test_renderer_exported_config") {
404 if (is_win && is_clang) {
405 # GN orders flags on a target before flags from configs. The default config
406 # adds -Wall, and this flag have to be after -Wall -- so they need to
407 # come from a config and cannot be on the target directly.
ehmaldonado4bc4d272016-08-25 04:15:40 -0700408 cflags = [
kjellander0f380d82016-06-01 04:48:26 -0700409 "-Wno-bool-conversion",
410 "-Wno-comment",
411 "-Wno-delete-non-virtual-dtor",
412 ]
413 }
414}
415
ehmaldonado38a21322016-09-02 04:10:34 -0700416rtc_source_set("test_renderer") {
kjellander0f380d82016-06-01 04:48:26 -0700417 testonly = true
418 libs = []
419 sources = [
420 "linux/glx_renderer.cc",
421 "linux/glx_renderer.h",
422 "linux/video_renderer_linux.cc",
423 "mac/video_renderer_mac.h",
424 "mac/video_renderer_mac.mm",
425 "video_renderer.cc",
426 "video_renderer.h",
427 "win/d3d_renderer.cc",
428 "win/d3d_renderer.h",
429 ]
430 if (!is_linux && !is_mac && !is_win) {
431 sources += [ "null_platform_renderer.cc" ]
432 }
433 if (is_linux || is_mac) {
434 sources += [
435 "gl/gl_renderer.cc",
436 "gl/gl_renderer.h",
437 ]
438 }
439
440 if (is_linux) {
441 libs += [
442 "Xext",
443 "X11",
444 "GL",
445 ]
446 }
447 if (is_android) {
448 libs += [
449 "GLESv2",
450 "log",
451 ]
452 }
453 if (is_mac) {
454 libs = [
455 "Cocoa.framework",
456 "OpenGL.framework",
457 "CoreVideo.framework",
458 ]
459 }
460
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700461 public_configs = [ ":test_renderer_exported_config" ]
kjellander0f380d82016-06-01 04:48:26 -0700462
463 if (is_clang && !is_nacl) {
464 # Suppress warnings from the Chromium Clang plugin.
465 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700466 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700467 }
468
469 deps = [
470 ":test_support",
471 ":video_test_common",
472 "../modules/media_file",
473 "//testing/gtest",
474 ]
475}