blob: 988c2d5fe251d4e8c2060a369bb5a68a70b4b545 [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 public_configs = [ "..:common_inherited_config" ]
79
80 if (is_clang && !is_nacl) {
81 # Suppress warnings from the Chromium Clang plugin.
82 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -070083 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070084 }
85
86 deps = [
87 "..:webrtc_common",
88 "../system_wrappers",
89 "//testing/gtest",
90 ]
91}
92
ehmaldonado38a21322016-09-02 04:10:34 -070093rtc_source_set("video_test_common") {
kjellander0f380d82016-06-01 04:48:26 -070094 testonly = true
95 sources = [
96 "fake_texture_frame.cc",
97 "fake_texture_frame.h",
98 "frame_generator.cc",
99 "frame_generator.h",
100 "frame_utils.cc",
101 "frame_utils.h",
102 ]
103
kjellander0f380d82016-06-01 04:48:26 -0700104 public_configs = [ "..:common_inherited_config" ]
105
106 if (is_clang && !is_nacl) {
107 # Suppress warnings from the Chromium Clang plugin.
108 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700109 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700110 }
111
112 deps = [
113 "../common_video",
114 ]
115}
116
ehmaldonado38a21322016-09-02 04:10:34 -0700117rtc_source_set("rtp_test_utils") {
kjellander0f380d82016-06-01 04:48:26 -0700118 testonly = true
119 sources = [
120 "rtcp_packet_parser.cc",
121 "rtcp_packet_parser.h",
122 "rtp_file_reader.cc",
123 "rtp_file_reader.h",
124 "rtp_file_writer.cc",
125 "rtp_file_writer.h",
126 ]
127
kjellander0f380d82016-06-01 04:48:26 -0700128 public_configs = [ "..:common_inherited_config" ]
129
130 if (is_clang && !is_nacl) {
131 # Suppress warnings from the Chromium Clang plugin.
132 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700133 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700134 }
135
136 deps = [
137 "..:webrtc_common",
138 "../modules/rtp_rtcp",
139 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000140 ]
141}
142
ehmaldonado38a21322016-09-02 04:10:34 -0700143rtc_source_set("field_trial") {
kjellander0f380d82016-06-01 04:48:26 -0700144 testonly = true
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000145 sources = [
146 "field_trial.cc",
147 "field_trial.h",
148 ]
149
150 deps = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000151 "..:webrtc_common",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000152 "../system_wrappers",
phoglund37ebcf02016-01-08 05:04:57 -0800153 "../system_wrappers:field_trial_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000154 ]
155
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200156 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000157}
158
ehmaldonado38a21322016-09-02 04:10:34 -0700159rtc_source_set("test_main") {
kjellander0f380d82016-06-01 04:48:26 -0700160 testonly = true
161 sources = [
162 "test_main.cc",
163 ]
164
165 deps = [
166 ":field_trial",
167 ":test_support",
168 "../system_wrappers:metrics_default",
169 "//testing/gtest",
170 "//third_party/gflags",
171 ]
172
kjellander0f380d82016-06-01 04:48:26 -0700173 public_configs = [ "..:common_inherited_config" ]
174}
175
ehmaldonado38a21322016-09-02 04:10:34 -0700176rtc_source_set("test_support") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000177 testonly = true
178
179 sources = [
180 "testsupport/fileutils.cc",
181 "testsupport/fileutils.h",
182 "testsupport/frame_reader.cc",
183 "testsupport/frame_reader.h",
184 "testsupport/frame_writer.cc",
185 "testsupport/frame_writer.h",
kjellander95177d12016-04-07 00:13:58 -0700186 "testsupport/iosfileutils.mm",
Peter Boström02083222016-06-14 12:52:54 +0200187 "testsupport/metrics/video_metrics.cc",
188 "testsupport/metrics/video_metrics.h",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000189 "testsupport/mock/mock_frame_reader.h",
190 "testsupport/mock/mock_frame_writer.h",
191 "testsupport/packet_reader.cc",
192 "testsupport/packet_reader.h",
193 "testsupport/perf_test.cc",
194 "testsupport/perf_test.h",
195 "testsupport/trace_to_stderr.cc",
196 "testsupport/trace_to_stderr.h",
197 ]
198
199 deps = [
kjellander988d31e2016-02-05 00:23:50 -0800200 "../base:gtest_prod",
Peter Boström02083222016-06-14 12:52:54 +0200201 "../common_video",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000202 "../system_wrappers",
Peter Boström62e9bda2015-11-23 15:12:06 +0100203 "//testing/gmock",
204 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000205 ]
206
Peter Boström02083222016-06-14 12:52:54 +0200207 if (is_clang) {
208 # Suppress warnings from the Chromium Clang plugin.
209 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700210 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
Peter Boström02083222016-06-14 12:52:54 +0200211 }
212
kjellander95177d12016-04-07 00:13:58 -0700213 if (is_ios) {
kjellander0f380d82016-06-01 04:48:26 -0700214 configs += [ "//build/config/compiler:enable_arc" ]
215 }
216
217 if (use_x11) {
218 deps += [ "//tools/xdisplaycheck" ]
kjellander95177d12016-04-07 00:13:58 -0700219 }
220
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000221 if (is_android) {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000222 deps += [ "//base:base" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000223 }
224
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200225 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000226}
227
kjellander0f380d82016-06-01 04:48:26 -0700228# Depend on this target when you want to have test_support but also the
229# main method needed for gtest to execute!
ehmaldonado38a21322016-09-02 04:10:34 -0700230rtc_source_set("test_support_main") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000231 testonly = true
232
233 sources = [
234 "run_all_unittests.cc",
235 "test_suite.cc",
236 "test_suite.h",
237 ]
238
239 deps = [
240 ":field_trial",
241 ":test_support",
asapersson01d70a32016-05-20 06:29:46 -0700242 "../system_wrappers:metrics_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000243 "//testing/gmock",
244 "//testing/gtest",
245 "//third_party/gflags",
246 ]
247
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200248 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000249}
kjellander0f380d82016-06-01 04:48:26 -0700250
251# Depend on this target when you want to have test_support and a special
252# main for mac which will run your test on a worker thread and consume
253# events on the main thread. Useful if you want to access a webcam.
254# This main will provide all the scaffolding and objective-c black magic
255# for you. All you need to do is to implement a function in the
256# run_threaded_main_mac.h file (ImplementThisToRunYourTest).
ehmaldonado38a21322016-09-02 04:10:34 -0700257rtc_source_set("test_support_main_threaded_mac") {
kjellander0f380d82016-06-01 04:48:26 -0700258 testonly = true
259
260 sources = [
261 "testsupport/mac/run_threaded_main_mac.h",
262 "testsupport/mac/run_threaded_main_mac.mm",
263 ]
264
kjellander0f380d82016-06-01 04:48:26 -0700265 public_configs = [ "..:common_inherited_config" ]
266
267 deps = [
268 ":test_support",
269 ]
270}
271
kjellander32c4a202016-08-30 02:53:49 -0700272if (is_android || is_ios) {
273 test_support_unittests_resources = [
274 "//resources/foreman_cif_short.yuv",
275 "//resources/video_coding/frame-ethernet-ii.pcap",
276 "//resources/video_coding/frame-loopback.pcap",
277 "//resources/video_coding/pltype103.rtp",
278 "//resources/video_coding/pltype103_header_only.rtp",
279 "//resources/video_coding/ssrcs-2.pcap",
280 "//resources/video_coding/ssrcs-3.pcap",
281 ]
282}
283
284if (is_ios) {
285 bundle_data("test_support_unittests_bundle_data") {
286 testonly = true
287 sources = test_support_unittests_resources
288 outputs = [
289 "{{bundle_resources_dir}}/{{source_file_part}}",
290 ]
291 }
292}
293
ehmaldonado38a21322016-09-02 04:10:34 -0700294rtc_test("test_support_unittests") {
kjellander0f380d82016-06-01 04:48:26 -0700295 deps = []
296 sources = [
297 "channel_transport/udp_socket_manager_unittest.cc",
298 "channel_transport/udp_socket_wrapper_unittest.cc",
299 "channel_transport/udp_transport_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200300 "common_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700301 "fake_network_pipe_unittest.cc",
302 "frame_generator_unittest.cc",
303 "rtp_file_reader_unittest.cc",
304 "rtp_file_writer_unittest.cc",
305 "testsupport/always_passing_unittest.cc",
306 "testsupport/fileutils_unittest.cc",
307 "testsupport/frame_reader_unittest.cc",
308 "testsupport/frame_writer_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200309 "testsupport/metrics/video_metrics_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700310 "testsupport/packet_reader_unittest.cc",
311 "testsupport/perf_test_unittest.cc",
312 "testsupport/unittest_utils.h",
313 ]
314
kjellander0f380d82016-06-01 04:48:26 -0700315 public_configs = [ "..:common_inherited_config" ]
316
kjellander8f4419b2016-06-02 02:09:52 -0700317 # TODO(jschuh): Bug 1348: fix this warning.
318 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
319
kjellander0f380d82016-06-01 04:48:26 -0700320 if (is_win) {
kjellander8f4419b2016-06-02 02:09:52 -0700321 cflags = [ "/wd4373" ] # virtual override w/different const/volatile signature.
kjellander0f380d82016-06-01 04:48:26 -0700322 }
323
324 if (is_clang) {
325 # Suppress warnings from the Chromium Clang plugin.
326 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700327 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700328 }
329
330 if (is_android) {
331 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander32c4a202016-08-30 02:53:49 -0700332 data = test_support_unittests_resources
kjellander28a0ffd2016-08-24 07:48:42 -0700333 shard_timeout = 900
334 }
kjellander0f380d82016-06-01 04:48:26 -0700335
kjellander32c4a202016-08-30 02:53:49 -0700336 if (is_ios) {
337 deps += [ ":test_support_unittests_bundle_data" ]
kjellander0f380d82016-06-01 04:48:26 -0700338 }
kjellander28a0ffd2016-08-24 07:48:42 -0700339
kjellander0f380d82016-06-01 04:48:26 -0700340 deps += [
341 ":channel_transport",
342 ":test_common",
343 ":test_support_main",
344 "../modules/video_capture",
345 "//testing/gmock",
346 "//testing/gtest",
347 ]
348}
349
ehmaldonado38a21322016-09-02 04:10:34 -0700350rtc_source_set("test_common") {
kjellander0f380d82016-06-01 04:48:26 -0700351 testonly = true
352 sources = [
353 "call_test.cc",
354 "call_test.h",
355 "configurable_frame_size_encoder.cc",
356 "configurable_frame_size_encoder.h",
357 "constants.cc",
358 "constants.h",
359 "direct_transport.cc",
360 "direct_transport.h",
361 "drifting_clock.cc",
362 "drifting_clock.h",
363 "encoder_settings.cc",
364 "encoder_settings.h",
365 "fake_audio_device.cc",
366 "fake_audio_device.h",
367 "fake_decoder.cc",
368 "fake_decoder.h",
369 "fake_encoder.cc",
370 "fake_encoder.h",
371 "fake_network_pipe.cc",
372 "fake_network_pipe.h",
373 "frame_generator_capturer.cc",
374 "frame_generator_capturer.h",
375 "layer_filtering_transport.cc",
376 "layer_filtering_transport.h",
377 "mock_transport.h",
378 "mock_voe_channel_proxy.h",
379 "mock_voice_engine.h",
380 "null_transport.cc",
381 "null_transport.h",
382 "rtp_rtcp_observer.h",
383 "statistics.cc",
384 "statistics.h",
385 "vcm_capturer.cc",
386 "vcm_capturer.h",
387 "video_capturer.cc",
388 "video_capturer.h",
389 "win/run_loop_win.cc",
390 ]
391 if (!is_win) {
392 sources += [
393 "run_loop.cc",
394 "run_loop.h",
395 ]
396 }
397
kjellander0f380d82016-06-01 04:48:26 -0700398 public_configs = [ "..:common_inherited_config" ]
399
400 if (is_clang && !is_nacl) {
401 # Suppress warnings from the Chromium Clang plugin.
402 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700403 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700404 }
405
406 deps = [
407 ":rtp_test_utils",
408 ":test_support",
409 ":video_test_common",
kjellander0f380d82016-06-01 04:48:26 -0700410 "..:webrtc_common",
kjellander94cee312016-06-10 01:56:57 -0700411 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700412 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700413 "../call",
kjellander0f380d82016-06-01 04:48:26 -0700414 "../modules/media_file",
kjellander94cee312016-06-10 01:56:57 -0700415 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700416 "//testing/gmock",
417 "//testing/gtest",
418 "//third_party/gflags",
419 ]
420}
421
422config("test_renderer_exported_config") {
423 if (is_win && is_clang) {
424 # GN orders flags on a target before flags from configs. The default config
425 # adds -Wall, and this flag have to be after -Wall -- so they need to
426 # come from a config and cannot be on the target directly.
ehmaldonado4bc4d272016-08-25 04:15:40 -0700427 cflags = [
kjellander0f380d82016-06-01 04:48:26 -0700428 "-Wno-bool-conversion",
429 "-Wno-comment",
430 "-Wno-delete-non-virtual-dtor",
431 ]
432 }
433}
434
ehmaldonado38a21322016-09-02 04:10:34 -0700435rtc_source_set("test_renderer") {
kjellander0f380d82016-06-01 04:48:26 -0700436 testonly = true
437 libs = []
438 sources = [
439 "linux/glx_renderer.cc",
440 "linux/glx_renderer.h",
441 "linux/video_renderer_linux.cc",
442 "mac/video_renderer_mac.h",
443 "mac/video_renderer_mac.mm",
444 "video_renderer.cc",
445 "video_renderer.h",
446 "win/d3d_renderer.cc",
447 "win/d3d_renderer.h",
448 ]
449 if (!is_linux && !is_mac && !is_win) {
450 sources += [ "null_platform_renderer.cc" ]
451 }
452 if (is_linux || is_mac) {
453 sources += [
454 "gl/gl_renderer.cc",
455 "gl/gl_renderer.h",
456 ]
457 }
458
459 if (is_linux) {
460 libs += [
461 "Xext",
462 "X11",
463 "GL",
464 ]
465 }
466 if (is_android) {
467 libs += [
468 "GLESv2",
469 "log",
470 ]
471 }
472 if (is_mac) {
473 libs = [
474 "Cocoa.framework",
475 "OpenGL.framework",
476 "CoreVideo.framework",
477 ]
478 }
479
kjellander0f380d82016-06-01 04:48:26 -0700480 public_configs = [
481 "..:common_inherited_config",
482 ":test_renderer_exported_config",
483 ]
484
485 if (is_clang && !is_nacl) {
486 # Suppress warnings from the Chromium Clang plugin.
487 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700488 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700489 }
490
491 deps = [
492 ":test_support",
493 ":video_test_common",
494 "../modules/media_file",
495 "//testing/gtest",
496 ]
497}