blob: 728269bb8588a2e73308ee9514c5de24f4d7c8cc [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) {
kthelgason37144b22017-05-17 06:52:58 -0700143 deps += [ "//webrtc/sdk:rtc_sdk_common_objc" ]
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) {
kthelgason37144b22017-05-17 06:52:58 -0700213 deps += [ "//webrtc/sdk:rtc_sdk_common_objc" ]
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" ]
319 }
320 visibility = [ ":*" ]
321}
322
323rtc_source_set("run_test") {
324 testonly = true
325 sources = [
326 "run_test.h",
327 ]
328 if (is_mac) {
329 sources += [ "mac/run_test.mm" ]
330 } else {
331 sources += [ "run_test.cc" ]
332 }
333}
334
ehmaldonado37535bf2016-12-05 06:42:45 -0800335rtc_source_set("fileutils_unittests") {
336 testonly = true
kjellandere0629c02017-04-25 04:04:50 -0700337 visibility = [ ":*" ] # Only targets in this file can depend on this.
ehmaldonado37535bf2016-12-05 06:42:45 -0800338 sources = [
339 "testsupport/fileutils_unittest.cc",
340 ]
341 deps = [
342 ":fileutils",
343 "//testing/gmock",
344 "//testing/gtest",
345 ]
346}
kjellander0f380d82016-06-01 04:48:26 -0700347
perkj488c5dc2017-02-08 05:55:51 -0800348rtc_source_set("direct_transport") {
349 testonly = true
350 sources = [
351 "direct_transport.cc",
352 "direct_transport.h",
353 "fake_network_pipe.cc",
354 "fake_network_pipe.h",
355 ]
356 if (!build_with_chromium && is_clang) {
357 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
358 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
359 }
360 deps = [
361 "../api:transport_api",
362 "../base:rtc_base_approved",
363 "../call",
364 ]
365}
366
perkj16ccfdf2017-02-28 14:41:05 -0800367rtc_source_set("fake_audio_device") {
368 testonly = true
369 sources = [
370 "fake_audio_device.cc",
371 "fake_audio_device.h",
372 ]
373 if (!build_with_chromium && is_clang) {
374 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
375 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
376 }
377 deps = [
378 "../base:rtc_base_approved",
mbonadeib80ef8c2017-04-24 13:05:47 -0700379 "../modules/audio_device:audio_device",
perkj16ccfdf2017-02-28 14:41:05 -0800380 ]
381}
382
ehmaldonado38a21322016-09-02 04:10:34 -0700383rtc_source_set("test_common") {
kjellander0f380d82016-06-01 04:48:26 -0700384 testonly = true
385 sources = [
386 "call_test.cc",
387 "call_test.h",
388 "configurable_frame_size_encoder.cc",
389 "configurable_frame_size_encoder.h",
390 "constants.cc",
391 "constants.h",
kjellander0f380d82016-06-01 04:48:26 -0700392 "drifting_clock.cc",
393 "drifting_clock.h",
394 "encoder_settings.cc",
395 "encoder_settings.h",
kjellander0f380d82016-06-01 04:48:26 -0700396 "fake_decoder.cc",
397 "fake_decoder.h",
398 "fake_encoder.cc",
399 "fake_encoder.h",
sakal55d932b2016-09-30 06:19:08 -0700400 "fake_videorenderer.h",
kjellander0f380d82016-06-01 04:48:26 -0700401 "layer_filtering_transport.cc",
402 "layer_filtering_transport.h",
403 "mock_transport.h",
404 "mock_voe_channel_proxy.h",
405 "mock_voice_engine.h",
406 "null_transport.cc",
407 "null_transport.h",
408 "rtp_rtcp_observer.h",
409 "statistics.cc",
410 "statistics.h",
kjellander0f380d82016-06-01 04:48:26 -0700411 "win/run_loop_win.cc",
412 ]
413 if (!is_win) {
414 sources += [
415 "run_loop.cc",
416 "run_loop.h",
417 ]
418 }
419
kjellandere40a7ee2016-10-16 23:56:12 -0700420 if (!build_with_chromium && is_clang) {
421 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700422 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700423 }
424
425 deps = [
perkj488c5dc2017-02-08 05:55:51 -0800426 ":direct_transport",
perkj16ccfdf2017-02-28 14:41:05 -0800427 ":fake_audio_device",
kjellander0f380d82016-06-01 04:48:26 -0700428 ":rtp_test_utils",
429 ":test_support",
perkjc5726c12017-03-01 03:37:08 -0800430 ":video_test_common",
kjellander0f380d82016-06-01 04:48:26 -0700431 "..:webrtc_common",
ossueb1fde42017-05-02 06:46:30 -0700432 "../api/audio_codecs:builtin_audio_encoder_factory",
ilnikd60d06a2017-04-05 03:02:20 -0700433 "../api/video_codecs:video_codecs_api",
kjellander94cee312016-06-10 01:56:57 -0700434 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700435 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700436 "../call",
aleloi10111bc2016-11-17 06:48:48 -0800437 "../modules/audio_mixer:audio_mixer_impl",
aleloidd310712016-11-17 06:28:59 -0800438 "../modules/audio_processing",
kjellander94cee312016-06-10 01:56:57 -0700439 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700440 "//testing/gmock",
441 "//testing/gtest",
kjellander0f380d82016-06-01 04:48:26 -0700442 ]
mbonadei148d5a22017-04-28 05:24:50 -0700443 if (!is_android && !build_with_chromium) {
oprypin92220ff2017-03-23 03:40:03 -0700444 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
445 }
kjellander0f380d82016-06-01 04:48:26 -0700446}
447
448config("test_renderer_exported_config") {
449 if (is_win && is_clang) {
450 # GN orders flags on a target before flags from configs. The default config
451 # adds -Wall, and this flag have to be after -Wall -- so they need to
452 # come from a config and cannot be on the target directly.
ehmaldonado4bc4d272016-08-25 04:15:40 -0700453 cflags = [
kjellander0f380d82016-06-01 04:48:26 -0700454 "-Wno-bool-conversion",
455 "-Wno-comment",
456 "-Wno-delete-non-virtual-dtor",
457 ]
458 }
459}
460
ehmaldonado38a21322016-09-02 04:10:34 -0700461rtc_source_set("test_renderer") {
kjellander0f380d82016-06-01 04:48:26 -0700462 testonly = true
463 libs = []
464 sources = [
465 "linux/glx_renderer.cc",
466 "linux/glx_renderer.h",
467 "linux/video_renderer_linux.cc",
468 "mac/video_renderer_mac.h",
469 "mac/video_renderer_mac.mm",
470 "video_renderer.cc",
471 "video_renderer.h",
472 "win/d3d_renderer.cc",
473 "win/d3d_renderer.h",
474 ]
475 if (!is_linux && !is_mac && !is_win) {
476 sources += [ "null_platform_renderer.cc" ]
477 }
478 if (is_linux || is_mac) {
479 sources += [
480 "gl/gl_renderer.cc",
481 "gl/gl_renderer.h",
482 ]
483 }
484
485 if (is_linux) {
486 libs += [
487 "Xext",
488 "X11",
489 "GL",
490 ]
491 }
492 if (is_android) {
493 libs += [
494 "GLESv2",
495 "log",
496 ]
497 }
498 if (is_mac) {
499 libs = [
500 "Cocoa.framework",
501 "OpenGL.framework",
502 "CoreVideo.framework",
503 ]
504 }
505
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700506 public_configs = [ ":test_renderer_exported_config" ]
kjellander0f380d82016-06-01 04:48:26 -0700507
kjellandere40a7ee2016-10-16 23:56:12 -0700508 if (!build_with_chromium && is_clang) {
509 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700510 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700511 }
512
513 deps = [
514 ":test_support",
kjellander0f380d82016-06-01 04:48:26 -0700515 "../modules/media_file",
516 "//testing/gtest",
517 ]
518}
kwiberg37e99fd2017-04-10 05:15:48 -0700519
520rtc_source_set("audio_codec_mocks") {
521 testonly = true
522 sources = [
523 "mock_audio_decoder.h",
524 "mock_audio_decoder_factory.h",
ossueb1fde42017-05-02 06:46:30 -0700525 "mock_audio_encoder.cc",
526 "mock_audio_encoder.h",
527 "mock_audio_encoder_factory.h",
528 ]
529
530 deps = [
531 "../api/audio_codecs:audio_codecs_api",
532 "//testing/gmock",
kwiberg37e99fd2017-04-10 05:15:48 -0700533 ]
534}
sakald7fdb802017-05-26 01:51:53 -0700535
536if (!build_with_chromium && is_android) {
537 android_library("native_test_java") {
538 testonly = true
539 java_files = [
540 "android/org/webrtc/native_test/RTCNativeUnitTest.java",
541 "android/org/webrtc/native_test/RTCNativeUnitTestActivity.java",
542 ]
543 deps = [
544 "//testing/android/native_test:native_test_java",
545 "//webrtc/base:base_java",
546 ]
547 }
548}