blob: 9fd7d1af694668491b660c1077fdd5092b4aee83 [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
kjellander0f380d82016-06-01 04:48:26 -07009import("//build/config/ui.gni")
10import("//testing/test.gni")
11if (is_android) {
12 import("//build/config/android/rules.gni")
13}
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000014
15source_set("test") {
16 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
53source_set("channel_transport") {
54 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
77 configs += [
78 "..:common_config",
79 ":channel_transport_warnings_config",
80 ]
81 public_configs = [ "..:common_inherited_config" ]
82
83 if (is_clang && !is_nacl) {
84 # Suppress warnings from the Chromium Clang plugin.
85 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
86 configs -= [ "//build/config/clang:find_bad_constructs" ]
87 }
88
89 deps = [
90 "..:webrtc_common",
91 "../system_wrappers",
92 "//testing/gtest",
93 ]
94}
95
96source_set("video_test_common") {
97 testonly = true
98 sources = [
99 "fake_texture_frame.cc",
100 "fake_texture_frame.h",
101 "frame_generator.cc",
102 "frame_generator.h",
103 "frame_utils.cc",
104 "frame_utils.h",
105 ]
106
107 configs += [ "..:common_config" ]
108 public_configs = [ "..:common_inherited_config" ]
109
110 if (is_clang && !is_nacl) {
111 # Suppress warnings from the Chromium Clang plugin.
112 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
113 configs -= [ "//build/config/clang:find_bad_constructs" ]
114 }
115
116 deps = [
117 "../common_video",
118 ]
119}
120
121source_set("rtp_test_utils") {
122 testonly = true
123 sources = [
124 "rtcp_packet_parser.cc",
125 "rtcp_packet_parser.h",
126 "rtp_file_reader.cc",
127 "rtp_file_reader.h",
128 "rtp_file_writer.cc",
129 "rtp_file_writer.h",
130 ]
131
132 configs += [ "..:common_config" ]
133 public_configs = [ "..:common_inherited_config" ]
134
135 if (is_clang && !is_nacl) {
136 # Suppress warnings from the Chromium Clang plugin.
137 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
138 configs -= [ "//build/config/clang:find_bad_constructs" ]
139 }
140
141 deps = [
142 "..:webrtc_common",
143 "../modules/rtp_rtcp",
144 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000145 ]
146}
147
148source_set("field_trial") {
kjellander0f380d82016-06-01 04:48:26 -0700149 testonly = true
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000150 sources = [
151 "field_trial.cc",
152 "field_trial.h",
153 ]
154
155 deps = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000156 "..:webrtc_common",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000157 "../system_wrappers",
phoglund37ebcf02016-01-08 05:04:57 -0800158 "../system_wrappers:field_trial_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000159 ]
160
kjellander@webrtc.org3037bc32014-09-30 19:07:58 +0000161 configs += [ "..:common_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200162 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000163}
164
kjellander0f380d82016-06-01 04:48:26 -0700165source_set("test_main") {
166 testonly = true
167 sources = [
168 "test_main.cc",
169 ]
170
171 deps = [
172 ":field_trial",
173 ":test_support",
174 "../system_wrappers:metrics_default",
175 "//testing/gtest",
176 "//third_party/gflags",
177 ]
178
179 configs += [ "..:common_config" ]
180 public_configs = [ "..:common_inherited_config" ]
181}
182
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000183source_set("test_support") {
184 testonly = true
185
186 sources = [
187 "testsupport/fileutils.cc",
188 "testsupport/fileutils.h",
189 "testsupport/frame_reader.cc",
190 "testsupport/frame_reader.h",
191 "testsupport/frame_writer.cc",
192 "testsupport/frame_writer.h",
kjellander95177d12016-04-07 00:13:58 -0700193 "testsupport/iosfileutils.mm",
Peter Boström02083222016-06-14 12:52:54 +0200194 "testsupport/metrics/video_metrics.cc",
195 "testsupport/metrics/video_metrics.h",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000196 "testsupport/mock/mock_frame_reader.h",
197 "testsupport/mock/mock_frame_writer.h",
198 "testsupport/packet_reader.cc",
199 "testsupport/packet_reader.h",
200 "testsupport/perf_test.cc",
201 "testsupport/perf_test.h",
202 "testsupport/trace_to_stderr.cc",
203 "testsupport/trace_to_stderr.h",
204 ]
205
206 deps = [
kjellander988d31e2016-02-05 00:23:50 -0800207 "../base:gtest_prod",
Peter Boström02083222016-06-14 12:52:54 +0200208 "../common_video",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000209 "../system_wrappers",
Peter Boström62e9bda2015-11-23 15:12:06 +0100210 "//testing/gmock",
211 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000212 ]
213
Peter Boström02083222016-06-14 12:52:54 +0200214 if (is_clang) {
215 # Suppress warnings from the Chromium Clang plugin.
216 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
217 configs -= [ "//build/config/clang:find_bad_constructs" ]
218 }
219
kjellander95177d12016-04-07 00:13:58 -0700220 if (is_ios) {
kjellander0f380d82016-06-01 04:48:26 -0700221 configs += [ "//build/config/compiler:enable_arc" ]
222 }
223
224 if (use_x11) {
225 deps += [ "//tools/xdisplaycheck" ]
kjellander95177d12016-04-07 00:13:58 -0700226 }
227
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000228 if (is_android) {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000229 deps += [ "//base:base" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000230 }
231
kjellander@webrtc.org3037bc32014-09-30 19:07:58 +0000232 configs += [ "..:common_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200233 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000234}
235
kjellander0f380d82016-06-01 04:48:26 -0700236# Depend on this target when you want to have test_support but also the
237# main method needed for gtest to execute!
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000238source_set("test_support_main") {
239 testonly = true
240
241 sources = [
242 "run_all_unittests.cc",
243 "test_suite.cc",
244 "test_suite.h",
245 ]
246
247 deps = [
248 ":field_trial",
249 ":test_support",
asapersson01d70a32016-05-20 06:29:46 -0700250 "../system_wrappers:metrics_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000251 "//testing/gmock",
252 "//testing/gtest",
253 "//third_party/gflags",
254 ]
255
kjellander@webrtc.org3037bc32014-09-30 19:07:58 +0000256 configs += [ "..:common_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200257 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000258}
kjellander0f380d82016-06-01 04:48:26 -0700259
260# Depend on this target when you want to have test_support and a special
261# main for mac which will run your test on a worker thread and consume
262# events on the main thread. Useful if you want to access a webcam.
263# This main will provide all the scaffolding and objective-c black magic
264# for you. All you need to do is to implement a function in the
265# run_threaded_main_mac.h file (ImplementThisToRunYourTest).
266source_set("test_support_main_threaded_mac") {
267 testonly = true
268
269 sources = [
270 "testsupport/mac/run_threaded_main_mac.h",
271 "testsupport/mac/run_threaded_main_mac.mm",
272 ]
273
274 configs += [ "..:common_config" ]
275 public_configs = [ "..:common_inherited_config" ]
276
277 deps = [
278 ":test_support",
279 ]
280}
281
282test("test_support_unittests") {
283 deps = []
284 sources = [
285 "channel_transport/udp_socket_manager_unittest.cc",
286 "channel_transport/udp_socket_wrapper_unittest.cc",
287 "channel_transport/udp_transport_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200288 "common_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700289 "fake_network_pipe_unittest.cc",
290 "frame_generator_unittest.cc",
291 "rtp_file_reader_unittest.cc",
292 "rtp_file_writer_unittest.cc",
293 "testsupport/always_passing_unittest.cc",
294 "testsupport/fileutils_unittest.cc",
295 "testsupport/frame_reader_unittest.cc",
296 "testsupport/frame_writer_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200297 "testsupport/metrics/video_metrics_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700298 "testsupport/packet_reader_unittest.cc",
299 "testsupport/perf_test_unittest.cc",
300 "testsupport/unittest_utils.h",
301 ]
302
303 configs += [ "..:common_config" ]
304 public_configs = [ "..:common_inherited_config" ]
305
kjellander8f4419b2016-06-02 02:09:52 -0700306 # TODO(jschuh): Bug 1348: fix this warning.
307 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
308
kjellander0f380d82016-06-01 04:48:26 -0700309 if (is_win) {
kjellander8f4419b2016-06-02 02:09:52 -0700310 cflags = [ "/wd4373" ] # virtual override w/different const/volatile signature.
kjellander0f380d82016-06-01 04:48:26 -0700311 }
312
313 if (is_clang) {
314 # Suppress warnings from the Chromium Clang plugin.
315 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
316 configs -= [ "//build/config/clang:find_bad_constructs" ]
317 }
318
319 if (is_android) {
320 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700321 shard_timeout = 900
322 }
kjellander0f380d82016-06-01 04:48:26 -0700323
kjellander28a0ffd2016-08-24 07:48:42 -0700324 if (is_android || is_ios) {
kjellander0f380d82016-06-01 04:48:26 -0700325 data = [
kjellanderd8dd1902016-08-23 04:52:11 -0700326 "//resources/foreman_cif_short.yuv",
kjellander0f380d82016-06-01 04:48:26 -0700327 "//resources/video_coding/frame-ethernet-ii.pcap",
328 "//resources/video_coding/frame-loopback.pcap",
329 "//resources/video_coding/pltype103.rtp",
330 "//resources/video_coding/pltype103_header_only.rtp",
331 "//resources/video_coding/ssrcs-2.pcap",
332 "//resources/video_coding/ssrcs-3.pcap",
333 ]
334 }
kjellander28a0ffd2016-08-24 07:48:42 -0700335
kjellander0f380d82016-06-01 04:48:26 -0700336 deps += [
337 ":channel_transport",
338 ":test_common",
339 ":test_support_main",
340 "../modules/video_capture",
341 "//testing/gmock",
342 "//testing/gtest",
343 ]
344}
345
346source_set("test_common") {
347 testonly = true
348 sources = [
349 "call_test.cc",
350 "call_test.h",
351 "configurable_frame_size_encoder.cc",
352 "configurable_frame_size_encoder.h",
353 "constants.cc",
354 "constants.h",
355 "direct_transport.cc",
356 "direct_transport.h",
357 "drifting_clock.cc",
358 "drifting_clock.h",
359 "encoder_settings.cc",
360 "encoder_settings.h",
361 "fake_audio_device.cc",
362 "fake_audio_device.h",
363 "fake_decoder.cc",
364 "fake_decoder.h",
365 "fake_encoder.cc",
366 "fake_encoder.h",
367 "fake_network_pipe.cc",
368 "fake_network_pipe.h",
369 "frame_generator_capturer.cc",
370 "frame_generator_capturer.h",
371 "layer_filtering_transport.cc",
372 "layer_filtering_transport.h",
373 "mock_transport.h",
374 "mock_voe_channel_proxy.h",
375 "mock_voice_engine.h",
376 "null_transport.cc",
377 "null_transport.h",
378 "rtp_rtcp_observer.h",
379 "statistics.cc",
380 "statistics.h",
381 "vcm_capturer.cc",
382 "vcm_capturer.h",
383 "video_capturer.cc",
384 "video_capturer.h",
385 "win/run_loop_win.cc",
386 ]
387 if (!is_win) {
388 sources += [
389 "run_loop.cc",
390 "run_loop.h",
391 ]
392 }
393
394 configs += [ "..:common_config" ]
395 public_configs = [ "..:common_inherited_config" ]
396
397 if (is_clang && !is_nacl) {
398 # Suppress warnings from the Chromium Clang plugin.
399 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
400 configs -= [ "//build/config/clang:find_bad_constructs" ]
401 }
402
403 deps = [
404 ":rtp_test_utils",
405 ":test_support",
406 ":video_test_common",
kjellander0f380d82016-06-01 04:48:26 -0700407 "..:webrtc_common",
kjellander94cee312016-06-10 01:56:57 -0700408 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700409 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700410 "../call",
kjellander0f380d82016-06-01 04:48:26 -0700411 "../modules/media_file",
kjellander94cee312016-06-10 01:56:57 -0700412 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700413 "//testing/gmock",
414 "//testing/gtest",
415 "//third_party/gflags",
416 ]
417}
418
419config("test_renderer_exported_config") {
420 if (is_win && is_clang) {
421 # GN orders flags on a target before flags from configs. The default config
422 # adds -Wall, and this flag have to be after -Wall -- so they need to
423 # come from a config and cannot be on the target directly.
ehmaldonado4bc4d272016-08-25 04:15:40 -0700424 cflags = [
kjellander0f380d82016-06-01 04:48:26 -0700425 "-Wno-bool-conversion",
426 "-Wno-comment",
427 "-Wno-delete-non-virtual-dtor",
428 ]
429 }
430}
431
432source_set("test_renderer") {
433 testonly = true
434 libs = []
435 sources = [
436 "linux/glx_renderer.cc",
437 "linux/glx_renderer.h",
438 "linux/video_renderer_linux.cc",
439 "mac/video_renderer_mac.h",
440 "mac/video_renderer_mac.mm",
441 "video_renderer.cc",
442 "video_renderer.h",
443 "win/d3d_renderer.cc",
444 "win/d3d_renderer.h",
445 ]
446 if (!is_linux && !is_mac && !is_win) {
447 sources += [ "null_platform_renderer.cc" ]
448 }
449 if (is_linux || is_mac) {
450 sources += [
451 "gl/gl_renderer.cc",
452 "gl/gl_renderer.h",
453 ]
454 }
455
456 if (is_linux) {
457 libs += [
458 "Xext",
459 "X11",
460 "GL",
461 ]
462 }
463 if (is_android) {
464 libs += [
465 "GLESv2",
466 "log",
467 ]
468 }
469 if (is_mac) {
470 libs = [
471 "Cocoa.framework",
472 "OpenGL.framework",
473 "CoreVideo.framework",
474 ]
475 }
476
477 configs += [ "..:common_config" ]
478 public_configs = [
479 "..:common_inherited_config",
480 ":test_renderer_exported_config",
481 ]
482
483 if (is_clang && !is_nacl) {
484 # Suppress warnings from the Chromium Clang plugin.
485 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
486 configs -= [ "//build/config/clang:find_bad_constructs" ]
487 }
488
489 deps = [
490 ":test_support",
491 ":video_test_common",
492 "../modules/media_file",
493 "//testing/gtest",
494 ]
495}