blob: bf8e59dc6cf9c297e12dc8370156725e8cb52414 [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
mbonadei9aa3f0a2017-01-24 06:58:22 -08009import("../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}
ehmaldonadoed8c8ed2016-11-23 12:58:35 -080014if (rtc_use_memcheck) {
Henrik Kjellander90fd7d82017-05-09 08:30:10 +020015 import("//tools_webrtc/valgrind/valgrind-webrtc.gni")
ehmaldonadoed8c8ed2016-11-23 12:58:35 -080016}
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000017
kjellanderb62dbbe2016-09-23 00:38:52 -070018group("test") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000019 testonly = true
20
21 deps = [
22 ":field_trial",
kjellander0f380d82016-06-01 04:48:26 -070023 ":rtp_test_utils",
24 ":test_common",
25 ":test_renderer",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000026 ":test_support",
kjellander0f380d82016-06-01 04:48:26 -070027 ":video_test_common",
28 ]
mbonadei148d5a22017-04-28 05:24:50 -070029
30 if (!build_with_chromium) {
31 deps += [
32 ":test_main",
33 ":test_support_unittests",
34 ]
35 }
kjellander0f380d82016-06-01 04:48:26 -070036}
37
ehmaldonado38a21322016-09-02 04:10:34 -070038rtc_source_set("video_test_common") {
kjellander0f380d82016-06-01 04:48:26 -070039 testonly = true
40 sources = [
41 "fake_texture_frame.cc",
42 "fake_texture_frame.h",
43 "frame_generator.cc",
44 "frame_generator.h",
ehmaldonado656610f2017-02-06 02:21:11 -080045 "frame_generator_capturer.cc",
46 "frame_generator_capturer.h",
kjellander0f380d82016-06-01 04:48:26 -070047 "frame_utils.cc",
48 "frame_utils.h",
ehmaldonado656610f2017-02-06 02:21:11 -080049 "vcm_capturer.cc",
50 "vcm_capturer.h",
sprangc5d62e22017-04-02 23:53:04 -070051 "video_capturer.cc",
ehmaldonado656610f2017-02-06 02:21:11 -080052 "video_capturer.h",
kjellander0f380d82016-06-01 04:48:26 -070053 ]
54
kjellandere40a7ee2016-10-16 23:56:12 -070055 if (!build_with_chromium && is_clang) {
56 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070057 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070058 }
59
60 deps = [
61 "../common_video",
sprangc5d62e22017-04-02 23:53:04 -070062 "../media:rtc_media_base",
ehmaldonado656610f2017-02-06 02:21:11 -080063 "../modules/video_capture:video_capture_module",
kjellander0f380d82016-06-01 04:48:26 -070064 ]
65}
66
ehmaldonado38a21322016-09-02 04:10:34 -070067rtc_source_set("rtp_test_utils") {
kjellander0f380d82016-06-01 04:48:26 -070068 testonly = true
69 sources = [
70 "rtcp_packet_parser.cc",
71 "rtcp_packet_parser.h",
72 "rtp_file_reader.cc",
73 "rtp_file_reader.h",
74 "rtp_file_writer.cc",
75 "rtp_file_writer.h",
76 ]
77
kjellandere40a7ee2016-10-16 23:56:12 -070078 if (!build_with_chromium && is_clang) {
79 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070080 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070081 }
82
83 deps = [
84 "..:webrtc_common",
85 "../modules/rtp_rtcp",
86 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000087 ]
88}
89
ehmaldonado38a21322016-09-02 04:10:34 -070090rtc_source_set("field_trial") {
kjellander0f380d82016-06-01 04:48:26 -070091 testonly = true
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000092 sources = [
93 "field_trial.cc",
94 "field_trial.h",
95 ]
96
97 deps = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000098 "..:webrtc_common",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000099 "../system_wrappers",
phoglund37ebcf02016-01-08 05:04:57 -0800100 "../system_wrappers:field_trial_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000101 ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000102}
103
mbonadei148d5a22017-04-28 05:24:50 -0700104rtc_source_set("test_support") {
105 testonly = true
kjellander32c4a202016-08-30 02:53:49 -0700106
mbonadei148d5a22017-04-28 05:24:50 -0700107 sources = [
108 "gmock.h",
109 "gtest.h",
110 "testsupport/packet_reader.cc",
111 "testsupport/packet_reader.h",
112 "testsupport/perf_test.cc",
113 "testsupport/perf_test.h",
114 "testsupport/trace_to_stderr.cc",
115 "testsupport/trace_to_stderr.h",
116 "testsupport/unittest_utils.h",
117 ]
118
119 deps = [
120 "..:webrtc_common",
121 "../base:gtest_prod",
122 "../base:rtc_base_approved",
123 "../common_video",
124 "../system_wrappers",
125 "//testing/gmock",
126 "//testing/gtest",
127 ]
128
129 public_deps = [
130 ":fileutils",
131 ]
132
133 if (!build_with_chromium && is_clang) {
134 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
135 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
136 }
137
138 if (is_android) {
139 deps += [ "//base:base" ]
140 }
141
142 if (is_ios && !build_with_chromium) {
kthelgason2f088792017-05-30 01:48:47 -0700143 deps += [ "//webrtc/sdk:objc_common" ]
mbonadei148d5a22017-04-28 05:24:50 -0700144 }
145
146 if (rtc_use_memcheck) {
147 data = valgrind_webrtc_dependencies
kjellander32c4a202016-08-30 02:53:49 -0700148 }
149}
150
mbonadei9452c622017-04-27 12:29:29 -0700151if (!build_with_chromium) {
152 # This target depends on //third_party/gflags and since chromium does not
153 # have gflags it causes an error when Gn parses this BUILD.gn file.
154 # It seems that Gn eagerly tries to understand if all the targets are
155 # buildable (even deps). Obviously gflags is not buildable in chromium
156 # so if a target depends on this BUILD.gn file we hit this error.
157 rtc_source_set("test_main") {
158 testonly = true
159 sources = [
160 "test_main.cc",
161 ]
kjellander0f380d82016-06-01 04:48:26 -0700162
mbonadei9452c622017-04-27 12:29:29 -0700163 public_deps = [
164 ":test_support",
165 ]
166 deps = [
167 ":field_trial",
168 "../system_wrappers:metrics_default",
169 "//testing/gmock",
170 "//testing/gtest",
171 "//third_party/gflags",
172 ]
kjellander0f380d82016-06-01 04:48:26 -0700173 }
174
mbonadei9452c622017-04-27 12:29:29 -0700175 rtc_source_set("video_test_support") {
176 testonly = true
177
178 sources = [
179 "testsupport/frame_reader.h",
180 "testsupport/frame_writer.h",
181 "testsupport/metrics/video_metrics.cc",
182 "testsupport/metrics/video_metrics.h",
183 "testsupport/mock/mock_frame_reader.h",
184 "testsupport/mock/mock_frame_writer.h",
185 "testsupport/y4m_frame_writer.cc",
186 "testsupport/yuv_frame_reader.cc",
187 "testsupport/yuv_frame_writer.cc",
188 ]
189
190 deps = [
191 "../base:rtc_base_approved",
192 "../common_video",
193 "../system_wrappers",
194 "//testing/gmock",
195 "//testing/gtest",
196 "//third_party/gflags",
197 ]
198
199 public_deps = [
200 ":fileutils",
201 ]
202
203 if (!build_with_chromium && is_clang) {
204 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
205 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
206 }
207
208 if (is_android) {
209 deps += [ "//base:base" ]
210 }
211
212 if (is_ios) {
kthelgason2f088792017-05-30 01:48:47 -0700213 deps += [ "//webrtc/sdk:objc_common" ]
mbonadei9452c622017-04-27 12:29:29 -0700214 }
215
216 if (rtc_use_memcheck) {
217 data = valgrind_webrtc_dependencies
218 }
kjellander0f380d82016-06-01 04:48:26 -0700219 }
220
mbonadei148d5a22017-04-28 05:24:50 -0700221 rtc_source_set("test_support_isolated_output") {
mbonadei9452c622017-04-27 12:29:29 -0700222 testonly = true
mbonadei9452c622017-04-27 12:29:29 -0700223 sources = [
mbonadei9452c622017-04-27 12:29:29 -0700224 "testsupport/isolated_output.cc",
225 "testsupport/isolated_output.h",
mbonadei9452c622017-04-27 12:29:29 -0700226 ]
mbonadei9452c622017-04-27 12:29:29 -0700227 deps = [
mbonadei148d5a22017-04-28 05:24:50 -0700228 ":fileutils",
mbonadei9452c622017-04-27 12:29:29 -0700229 "../base:rtc_base_approved",
mbonadei9452c622017-04-27 12:29:29 -0700230 "//third_party/gflags",
231 ]
mbonadei148d5a22017-04-28 05:24:50 -0700232 }
mbonadei9452c622017-04-27 12:29:29 -0700233
mbonadei148d5a22017-04-28 05:24:50 -0700234 test_support_unittests_resources = [
235 "//resources/foreman_cif_short.yuv",
236 "//resources/video_coding/frame-ethernet-ii.pcap",
237 "//resources/video_coding/frame-loopback.pcap",
238 "//resources/video_coding/pltype103.rtp",
239 "//resources/video_coding/pltype103_header_only.rtp",
240 "//resources/video_coding/ssrcs-2.pcap",
241 "//resources/video_coding/ssrcs-3.pcap",
242 ]
mbonadei9452c622017-04-27 12:29:29 -0700243
mbonadei148d5a22017-04-28 05:24:50 -0700244 if (is_ios) {
245 bundle_data("test_support_unittests_bundle_data") {
246 testonly = true
247 sources = test_support_unittests_resources
248 outputs = [
249 "{{bundle_resources_dir}}/{{source_file_part}}",
250 ]
mbonadei9452c622017-04-27 12:29:29 -0700251 }
kjellander28a0ffd2016-08-24 07:48:42 -0700252 }
kjellander0f380d82016-06-01 04:48:26 -0700253
mbonadei9452c622017-04-27 12:29:29 -0700254 rtc_test("test_support_unittests") {
255 deps = []
256 sources = [
257 "fake_audio_device_unittest.cc",
258 "fake_network_pipe_unittest.cc",
259 "frame_generator_unittest.cc",
260 "rtp_file_reader_unittest.cc",
261 "rtp_file_writer_unittest.cc",
262 "testsupport/always_passing_unittest.cc",
263 "testsupport/isolated_output_unittest.cc",
264 "testsupport/metrics/video_metrics_unittest.cc",
265 "testsupport/packet_reader_unittest.cc",
266 "testsupport/perf_test_unittest.cc",
267 "testsupport/y4m_frame_writer_unittest.cc",
268 "testsupport/yuv_frame_reader_unittest.cc",
269 "testsupport/yuv_frame_writer_unittest.cc",
270 ]
kjellander28a0ffd2016-08-24 07:48:42 -0700271
mbonadei9452c622017-04-27 12:29:29 -0700272 # TODO(jschuh): Bug 1348: fix this warning.
273 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
274
275 if (is_win) {
276 # virtual override w/different const/volatile signature.
277 cflags = [ "/wd4373" ]
278 }
279
280 if (!build_with_chromium && is_clang) {
281 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
282 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
283 }
284
285 data = test_support_unittests_resources
286 if (is_android) {
287 deps += [ "//testing/android/native_test:native_test_support" ]
288 shard_timeout = 900
289 }
290
291 if (is_ios) {
292 deps += [ ":test_support_unittests_bundle_data" ]
293 }
294
295 deps += [
296 ":direct_transport",
297 ":fileutils_unittests",
298 ":test_common",
299 ":test_main",
mbonadei148d5a22017-04-28 05:24:50 -0700300 ":test_support_isolated_output",
mbonadei9452c622017-04-27 12:29:29 -0700301 ":video_test_common",
302 ":video_test_support",
303 "../modules/video_capture",
304 "//testing/gmock",
305 "//testing/gtest",
306 "//third_party/gflags",
307 ]
308 }
kjellander0f380d82016-06-01 04:48:26 -0700309}
mbonadei9452c622017-04-27 12:29:29 -0700310
311rtc_source_set("fileutils") {
312 testonly = true
313 sources = [
314 "testsupport/fileutils.cc",
315 "testsupport/fileutils.h",
316 ]
317 if (is_ios) {
318 sources += [ "testsupport/iosfileutils.mm" ]
kthelgason2f088792017-05-30 01:48:47 -0700319 deps = [
mbonadei07502d42017-05-30 06:23:41 -0700320 "../sdk:objc_common",
kthelgason2f088792017-05-30 01:48:47 -0700321 ]
mbonadei9452c622017-04-27 12:29:29 -0700322 }
323 visibility = [ ":*" ]
324}
325
326rtc_source_set("run_test") {
327 testonly = true
328 sources = [
329 "run_test.h",
330 ]
331 if (is_mac) {
332 sources += [ "mac/run_test.mm" ]
333 } else {
334 sources += [ "run_test.cc" ]
335 }
336}
337
ehmaldonado37535bf2016-12-05 06:42:45 -0800338rtc_source_set("fileutils_unittests") {
339 testonly = true
kjellandere0629c02017-04-25 04:04:50 -0700340 visibility = [ ":*" ] # Only targets in this file can depend on this.
ehmaldonado37535bf2016-12-05 06:42:45 -0800341 sources = [
342 "testsupport/fileutils_unittest.cc",
343 ]
344 deps = [
345 ":fileutils",
346 "//testing/gmock",
347 "//testing/gtest",
348 ]
349}
kjellander0f380d82016-06-01 04:48:26 -0700350
perkj488c5dc2017-02-08 05:55:51 -0800351rtc_source_set("direct_transport") {
352 testonly = true
353 sources = [
354 "direct_transport.cc",
355 "direct_transport.h",
356 "fake_network_pipe.cc",
357 "fake_network_pipe.h",
358 ]
359 if (!build_with_chromium && is_clang) {
360 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
361 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
362 }
363 deps = [
364 "../api:transport_api",
365 "../base:rtc_base_approved",
366 "../call",
367 ]
368}
369
perkj16ccfdf2017-02-28 14:41:05 -0800370rtc_source_set("fake_audio_device") {
371 testonly = true
372 sources = [
373 "fake_audio_device.cc",
374 "fake_audio_device.h",
375 ]
376 if (!build_with_chromium && is_clang) {
377 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
378 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
379 }
380 deps = [
381 "../base:rtc_base_approved",
mbonadeib80ef8c2017-04-24 13:05:47 -0700382 "../modules/audio_device:audio_device",
perkj16ccfdf2017-02-28 14:41:05 -0800383 ]
384}
385
ehmaldonado38a21322016-09-02 04:10:34 -0700386rtc_source_set("test_common") {
kjellander0f380d82016-06-01 04:48:26 -0700387 testonly = true
388 sources = [
389 "call_test.cc",
390 "call_test.h",
391 "configurable_frame_size_encoder.cc",
392 "configurable_frame_size_encoder.h",
393 "constants.cc",
394 "constants.h",
kjellander0f380d82016-06-01 04:48:26 -0700395 "drifting_clock.cc",
396 "drifting_clock.h",
397 "encoder_settings.cc",
398 "encoder_settings.h",
kjellander0f380d82016-06-01 04:48:26 -0700399 "fake_decoder.cc",
400 "fake_decoder.h",
401 "fake_encoder.cc",
402 "fake_encoder.h",
sakal55d932b2016-09-30 06:19:08 -0700403 "fake_videorenderer.h",
kjellander0f380d82016-06-01 04:48:26 -0700404 "layer_filtering_transport.cc",
405 "layer_filtering_transport.h",
406 "mock_transport.h",
407 "mock_voe_channel_proxy.h",
408 "mock_voice_engine.h",
409 "null_transport.cc",
410 "null_transport.h",
411 "rtp_rtcp_observer.h",
412 "statistics.cc",
413 "statistics.h",
kjellander0f380d82016-06-01 04:48:26 -0700414 "win/run_loop_win.cc",
415 ]
416 if (!is_win) {
417 sources += [
418 "run_loop.cc",
419 "run_loop.h",
420 ]
421 }
422
kjellandere40a7ee2016-10-16 23:56:12 -0700423 if (!build_with_chromium && is_clang) {
424 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700425 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700426 }
427
428 deps = [
perkj488c5dc2017-02-08 05:55:51 -0800429 ":direct_transport",
perkj16ccfdf2017-02-28 14:41:05 -0800430 ":fake_audio_device",
kjellander0f380d82016-06-01 04:48:26 -0700431 ":rtp_test_utils",
432 ":test_support",
perkjc5726c12017-03-01 03:37:08 -0800433 ":video_test_common",
kjellander0f380d82016-06-01 04:48:26 -0700434 "..:webrtc_common",
ossueb1fde42017-05-02 06:46:30 -0700435 "../api/audio_codecs:builtin_audio_encoder_factory",
ilnikd60d06a2017-04-05 03:02:20 -0700436 "../api/video_codecs:video_codecs_api",
kjellander94cee312016-06-10 01:56:57 -0700437 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700438 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700439 "../call",
aleloi10111bc2016-11-17 06:48:48 -0800440 "../modules/audio_mixer:audio_mixer_impl",
aleloidd310712016-11-17 06:28:59 -0800441 "../modules/audio_processing",
kjellander94cee312016-06-10 01:56:57 -0700442 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700443 "//testing/gmock",
444 "//testing/gtest",
kjellander0f380d82016-06-01 04:48:26 -0700445 ]
mbonadei148d5a22017-04-28 05:24:50 -0700446 if (!is_android && !build_with_chromium) {
oprypin92220ff2017-03-23 03:40:03 -0700447 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
448 }
kjellander0f380d82016-06-01 04:48:26 -0700449}
450
451config("test_renderer_exported_config") {
452 if (is_win && is_clang) {
453 # GN orders flags on a target before flags from configs. The default config
454 # adds -Wall, and this flag have to be after -Wall -- so they need to
455 # come from a config and cannot be on the target directly.
ehmaldonado4bc4d272016-08-25 04:15:40 -0700456 cflags = [
kjellander0f380d82016-06-01 04:48:26 -0700457 "-Wno-bool-conversion",
458 "-Wno-comment",
459 "-Wno-delete-non-virtual-dtor",
460 ]
461 }
462}
463
ehmaldonado38a21322016-09-02 04:10:34 -0700464rtc_source_set("test_renderer") {
kjellander0f380d82016-06-01 04:48:26 -0700465 testonly = true
466 libs = []
467 sources = [
468 "linux/glx_renderer.cc",
469 "linux/glx_renderer.h",
470 "linux/video_renderer_linux.cc",
471 "mac/video_renderer_mac.h",
472 "mac/video_renderer_mac.mm",
473 "video_renderer.cc",
474 "video_renderer.h",
475 "win/d3d_renderer.cc",
476 "win/d3d_renderer.h",
477 ]
478 if (!is_linux && !is_mac && !is_win) {
479 sources += [ "null_platform_renderer.cc" ]
480 }
481 if (is_linux || is_mac) {
482 sources += [
483 "gl/gl_renderer.cc",
484 "gl/gl_renderer.h",
485 ]
486 }
487
488 if (is_linux) {
489 libs += [
490 "Xext",
491 "X11",
492 "GL",
493 ]
494 }
495 if (is_android) {
496 libs += [
497 "GLESv2",
498 "log",
499 ]
500 }
501 if (is_mac) {
502 libs = [
503 "Cocoa.framework",
504 "OpenGL.framework",
505 "CoreVideo.framework",
506 ]
507 }
508
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700509 public_configs = [ ":test_renderer_exported_config" ]
kjellander0f380d82016-06-01 04:48:26 -0700510
kjellandere40a7ee2016-10-16 23:56:12 -0700511 if (!build_with_chromium && is_clang) {
512 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700513 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700514 }
515
516 deps = [
517 ":test_support",
kjellander0f380d82016-06-01 04:48:26 -0700518 "../modules/media_file",
519 "//testing/gtest",
520 ]
521}
kwiberg37e99fd2017-04-10 05:15:48 -0700522
523rtc_source_set("audio_codec_mocks") {
524 testonly = true
525 sources = [
526 "mock_audio_decoder.h",
527 "mock_audio_decoder_factory.h",
ossueb1fde42017-05-02 06:46:30 -0700528 "mock_audio_encoder.cc",
529 "mock_audio_encoder.h",
530 "mock_audio_encoder_factory.h",
531 ]
532
533 deps = [
534 "../api/audio_codecs:audio_codecs_api",
535 "//testing/gmock",
kwiberg37e99fd2017-04-10 05:15:48 -0700536 ]
537}
sakald7fdb802017-05-26 01:51:53 -0700538
539if (!build_with_chromium && is_android) {
540 android_library("native_test_java") {
541 testonly = true
542 java_files = [
543 "android/org/webrtc/native_test/RTCNativeUnitTest.java",
544 "android/org/webrtc/native_test/RTCNativeUnitTestActivity.java",
545 ]
546 deps = [
547 "//testing/android/native_test:native_test_java",
548 "//webrtc/base:base_java",
549 ]
550 }
551}