blob: 993ff59267ec59d1bfc347176182aed0ea96bf4e [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
kjellander32c4a202016-08-30 02:53:49 -0700282if (is_android || is_ios) {
283 test_support_unittests_resources = [
284 "//resources/foreman_cif_short.yuv",
285 "//resources/video_coding/frame-ethernet-ii.pcap",
286 "//resources/video_coding/frame-loopback.pcap",
287 "//resources/video_coding/pltype103.rtp",
288 "//resources/video_coding/pltype103_header_only.rtp",
289 "//resources/video_coding/ssrcs-2.pcap",
290 "//resources/video_coding/ssrcs-3.pcap",
291 ]
292}
293
294if (is_ios) {
295 bundle_data("test_support_unittests_bundle_data") {
296 testonly = true
297 sources = test_support_unittests_resources
298 outputs = [
299 "{{bundle_resources_dir}}/{{source_file_part}}",
300 ]
301 }
302}
303
kjellander0f380d82016-06-01 04:48:26 -0700304test("test_support_unittests") {
305 deps = []
306 sources = [
307 "channel_transport/udp_socket_manager_unittest.cc",
308 "channel_transport/udp_socket_wrapper_unittest.cc",
309 "channel_transport/udp_transport_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200310 "common_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700311 "fake_network_pipe_unittest.cc",
312 "frame_generator_unittest.cc",
313 "rtp_file_reader_unittest.cc",
314 "rtp_file_writer_unittest.cc",
315 "testsupport/always_passing_unittest.cc",
316 "testsupport/fileutils_unittest.cc",
317 "testsupport/frame_reader_unittest.cc",
318 "testsupport/frame_writer_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200319 "testsupport/metrics/video_metrics_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700320 "testsupport/packet_reader_unittest.cc",
321 "testsupport/perf_test_unittest.cc",
322 "testsupport/unittest_utils.h",
323 ]
324
325 configs += [ "..:common_config" ]
326 public_configs = [ "..:common_inherited_config" ]
327
kjellander8f4419b2016-06-02 02:09:52 -0700328 # TODO(jschuh): Bug 1348: fix this warning.
329 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
330
kjellander0f380d82016-06-01 04:48:26 -0700331 if (is_win) {
kjellander8f4419b2016-06-02 02:09:52 -0700332 cflags = [ "/wd4373" ] # virtual override w/different const/volatile signature.
kjellander0f380d82016-06-01 04:48:26 -0700333 }
334
335 if (is_clang) {
336 # Suppress warnings from the Chromium Clang plugin.
337 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
338 configs -= [ "//build/config/clang:find_bad_constructs" ]
339 }
340
341 if (is_android) {
342 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander32c4a202016-08-30 02:53:49 -0700343 data = test_support_unittests_resources
kjellander28a0ffd2016-08-24 07:48:42 -0700344 shard_timeout = 900
345 }
kjellander0f380d82016-06-01 04:48:26 -0700346
kjellander32c4a202016-08-30 02:53:49 -0700347 if (is_ios) {
348 deps += [ ":test_support_unittests_bundle_data" ]
kjellander0f380d82016-06-01 04:48:26 -0700349 }
kjellander28a0ffd2016-08-24 07:48:42 -0700350
kjellander0f380d82016-06-01 04:48:26 -0700351 deps += [
352 ":channel_transport",
353 ":test_common",
354 ":test_support_main",
355 "../modules/video_capture",
356 "//testing/gmock",
357 "//testing/gtest",
358 ]
359}
360
361source_set("test_common") {
362 testonly = true
363 sources = [
364 "call_test.cc",
365 "call_test.h",
366 "configurable_frame_size_encoder.cc",
367 "configurable_frame_size_encoder.h",
368 "constants.cc",
369 "constants.h",
370 "direct_transport.cc",
371 "direct_transport.h",
372 "drifting_clock.cc",
373 "drifting_clock.h",
374 "encoder_settings.cc",
375 "encoder_settings.h",
376 "fake_audio_device.cc",
377 "fake_audio_device.h",
378 "fake_decoder.cc",
379 "fake_decoder.h",
380 "fake_encoder.cc",
381 "fake_encoder.h",
382 "fake_network_pipe.cc",
383 "fake_network_pipe.h",
384 "frame_generator_capturer.cc",
385 "frame_generator_capturer.h",
386 "layer_filtering_transport.cc",
387 "layer_filtering_transport.h",
388 "mock_transport.h",
389 "mock_voe_channel_proxy.h",
390 "mock_voice_engine.h",
391 "null_transport.cc",
392 "null_transport.h",
393 "rtp_rtcp_observer.h",
394 "statistics.cc",
395 "statistics.h",
396 "vcm_capturer.cc",
397 "vcm_capturer.h",
398 "video_capturer.cc",
399 "video_capturer.h",
400 "win/run_loop_win.cc",
401 ]
402 if (!is_win) {
403 sources += [
404 "run_loop.cc",
405 "run_loop.h",
406 ]
407 }
408
409 configs += [ "..:common_config" ]
410 public_configs = [ "..:common_inherited_config" ]
411
412 if (is_clang && !is_nacl) {
413 # Suppress warnings from the Chromium Clang plugin.
414 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
415 configs -= [ "//build/config/clang:find_bad_constructs" ]
416 }
417
418 deps = [
419 ":rtp_test_utils",
420 ":test_support",
421 ":video_test_common",
kjellander0f380d82016-06-01 04:48:26 -0700422 "..:webrtc_common",
kjellander94cee312016-06-10 01:56:57 -0700423 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700424 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700425 "../call",
kjellander0f380d82016-06-01 04:48:26 -0700426 "../modules/media_file",
kjellander94cee312016-06-10 01:56:57 -0700427 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700428 "//testing/gmock",
429 "//testing/gtest",
430 "//third_party/gflags",
431 ]
432}
433
434config("test_renderer_exported_config") {
435 if (is_win && is_clang) {
436 # GN orders flags on a target before flags from configs. The default config
437 # adds -Wall, and this flag have to be after -Wall -- so they need to
438 # come from a config and cannot be on the target directly.
ehmaldonado4bc4d272016-08-25 04:15:40 -0700439 cflags = [
kjellander0f380d82016-06-01 04:48:26 -0700440 "-Wno-bool-conversion",
441 "-Wno-comment",
442 "-Wno-delete-non-virtual-dtor",
443 ]
444 }
445}
446
447source_set("test_renderer") {
448 testonly = true
449 libs = []
450 sources = [
451 "linux/glx_renderer.cc",
452 "linux/glx_renderer.h",
453 "linux/video_renderer_linux.cc",
454 "mac/video_renderer_mac.h",
455 "mac/video_renderer_mac.mm",
456 "video_renderer.cc",
457 "video_renderer.h",
458 "win/d3d_renderer.cc",
459 "win/d3d_renderer.h",
460 ]
461 if (!is_linux && !is_mac && !is_win) {
462 sources += [ "null_platform_renderer.cc" ]
463 }
464 if (is_linux || is_mac) {
465 sources += [
466 "gl/gl_renderer.cc",
467 "gl/gl_renderer.h",
468 ]
469 }
470
471 if (is_linux) {
472 libs += [
473 "Xext",
474 "X11",
475 "GL",
476 ]
477 }
478 if (is_android) {
479 libs += [
480 "GLESv2",
481 "log",
482 ]
483 }
484 if (is_mac) {
485 libs = [
486 "Cocoa.framework",
487 "OpenGL.framework",
488 "CoreVideo.framework",
489 ]
490 }
491
492 configs += [ "..:common_config" ]
493 public_configs = [
494 "..:common_inherited_config",
495 ":test_renderer_exported_config",
496 ]
497
498 if (is_clang && !is_nacl) {
499 # Suppress warnings from the Chromium Clang plugin.
500 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
501 configs -= [ "//build/config/clang:find_bad_constructs" ]
502 }
503
504 deps = [
505 ":test_support",
506 ":video_test_common",
507 "../modules/media_file",
508 "//testing/gtest",
509 ]
510}