blob: c696979dd11105b7c4aed5bc81b74c28fca2978f [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) {
kjellanderafd54942016-12-17 12:21:39 -080015 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",
ehmaldonado26bddb92016-11-30 06:12:01 -080025 ":test_main",
kjellander0f380d82016-06-01 04:48:26 -070026 ":test_renderer",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000027 ":test_support",
kjellander0f380d82016-06-01 04:48:26 -070028 ":test_support_unittests",
29 ":video_test_common",
30 ]
31}
32
ehmaldonado38a21322016-09-02 04:10:34 -070033rtc_source_set("video_test_common") {
kjellander0f380d82016-06-01 04:48:26 -070034 testonly = true
35 sources = [
36 "fake_texture_frame.cc",
37 "fake_texture_frame.h",
38 "frame_generator.cc",
39 "frame_generator.h",
ehmaldonado656610f2017-02-06 02:21:11 -080040 "frame_generator_capturer.cc",
41 "frame_generator_capturer.h",
kjellander0f380d82016-06-01 04:48:26 -070042 "frame_utils.cc",
43 "frame_utils.h",
ehmaldonado656610f2017-02-06 02:21:11 -080044 "vcm_capturer.cc",
45 "vcm_capturer.h",
sprangc5d62e22017-04-02 23:53:04 -070046 "video_capturer.cc",
ehmaldonado656610f2017-02-06 02:21:11 -080047 "video_capturer.h",
kjellander0f380d82016-06-01 04:48:26 -070048 ]
49
kjellandere40a7ee2016-10-16 23:56:12 -070050 if (!build_with_chromium && is_clang) {
51 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070052 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070053 }
54
55 deps = [
56 "../common_video",
sprangc5d62e22017-04-02 23:53:04 -070057 "../media:rtc_media_base",
ehmaldonado656610f2017-02-06 02:21:11 -080058 "../modules/video_capture:video_capture_module",
kjellander0f380d82016-06-01 04:48:26 -070059 ]
60}
61
ehmaldonado38a21322016-09-02 04:10:34 -070062rtc_source_set("rtp_test_utils") {
kjellander0f380d82016-06-01 04:48:26 -070063 testonly = true
64 sources = [
65 "rtcp_packet_parser.cc",
66 "rtcp_packet_parser.h",
67 "rtp_file_reader.cc",
68 "rtp_file_reader.h",
69 "rtp_file_writer.cc",
70 "rtp_file_writer.h",
71 ]
72
kjellandere40a7ee2016-10-16 23:56:12 -070073 if (!build_with_chromium && is_clang) {
74 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070075 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070076 }
77
78 deps = [
79 "..:webrtc_common",
80 "../modules/rtp_rtcp",
81 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000082 ]
83}
84
ehmaldonado38a21322016-09-02 04:10:34 -070085rtc_source_set("field_trial") {
kjellander0f380d82016-06-01 04:48:26 -070086 testonly = true
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000087 sources = [
88 "field_trial.cc",
89 "field_trial.h",
90 ]
91
92 deps = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000093 "..:webrtc_common",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000094 "../system_wrappers",
phoglund37ebcf02016-01-08 05:04:57 -080095 "../system_wrappers:field_trial_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000096 ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000097}
98
ehmaldonado3a7f35b2016-09-14 05:10:01 -070099test_support_unittests_resources = [
100 "//resources/foreman_cif_short.yuv",
101 "//resources/video_coding/frame-ethernet-ii.pcap",
102 "//resources/video_coding/frame-loopback.pcap",
103 "//resources/video_coding/pltype103.rtp",
104 "//resources/video_coding/pltype103_header_only.rtp",
105 "//resources/video_coding/ssrcs-2.pcap",
106 "//resources/video_coding/ssrcs-3.pcap",
107]
kjellander32c4a202016-08-30 02:53:49 -0700108
109if (is_ios) {
110 bundle_data("test_support_unittests_bundle_data") {
111 testonly = true
112 sources = test_support_unittests_resources
113 outputs = [
114 "{{bundle_resources_dir}}/{{source_file_part}}",
115 ]
116 }
117}
118
mbonadei9452c622017-04-27 12:29:29 -0700119if (!build_with_chromium) {
120 # This target depends on //third_party/gflags and since chromium does not
121 # have gflags it causes an error when Gn parses this BUILD.gn file.
122 # It seems that Gn eagerly tries to understand if all the targets are
123 # buildable (even deps). Obviously gflags is not buildable in chromium
124 # so if a target depends on this BUILD.gn file we hit this error.
125 rtc_source_set("test_main") {
126 testonly = true
127 sources = [
128 "test_main.cc",
129 ]
kjellander0f380d82016-06-01 04:48:26 -0700130
mbonadei9452c622017-04-27 12:29:29 -0700131 public_deps = [
132 ":test_support",
133 ]
134 deps = [
135 ":field_trial",
136 "../system_wrappers:metrics_default",
137 "//testing/gmock",
138 "//testing/gtest",
139 "//third_party/gflags",
140 ]
kjellander0f380d82016-06-01 04:48:26 -0700141 }
142
mbonadei9452c622017-04-27 12:29:29 -0700143 rtc_source_set("video_test_support") {
144 testonly = true
145
146 sources = [
147 "testsupport/frame_reader.h",
148 "testsupport/frame_writer.h",
149 "testsupport/metrics/video_metrics.cc",
150 "testsupport/metrics/video_metrics.h",
151 "testsupport/mock/mock_frame_reader.h",
152 "testsupport/mock/mock_frame_writer.h",
153 "testsupport/y4m_frame_writer.cc",
154 "testsupport/yuv_frame_reader.cc",
155 "testsupport/yuv_frame_writer.cc",
156 ]
157
158 deps = [
159 "../base:rtc_base_approved",
160 "../common_video",
161 "../system_wrappers",
162 "//testing/gmock",
163 "//testing/gtest",
164 "//third_party/gflags",
165 ]
166
167 public_deps = [
168 ":fileutils",
169 ]
170
171 if (!build_with_chromium && is_clang) {
172 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
173 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
174 }
175
176 if (is_android) {
177 deps += [ "//base:base" ]
178 }
179
180 if (is_ios) {
181 deps += [ "//webrtc/sdk:rtc_sdk_common_objc" ]
182 }
183
184 if (rtc_use_memcheck) {
185 data = valgrind_webrtc_dependencies
186 }
kjellander0f380d82016-06-01 04:48:26 -0700187 }
188
mbonadei9452c622017-04-27 12:29:29 -0700189 rtc_source_set("test_support") {
190 testonly = true
191
192 sources = [
193 "gmock.h",
194 "gtest.h",
195 "testsupport/isolated_output.cc",
196 "testsupport/isolated_output.h",
197 "testsupport/packet_reader.cc",
198 "testsupport/packet_reader.h",
199 "testsupport/perf_test.cc",
200 "testsupport/perf_test.h",
201 "testsupport/trace_to_stderr.cc",
202 "testsupport/trace_to_stderr.h",
203 "testsupport/unittest_utils.h",
204 ]
205
206 deps = [
207 "../base:gtest_prod",
208 "../base:rtc_base_approved",
209 "../common_video",
210 "../system_wrappers",
211 "//testing/gmock",
212 "//testing/gtest",
213 "//third_party/gflags",
214 ]
215
216 public_deps = [
217 ":fileutils",
218 ]
219
220 if (!build_with_chromium && is_clang) {
221 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
222 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
223 }
224
225 if (is_android) {
226 deps += [ "//base:base" ]
227 }
228
229 if (is_ios) {
230 deps += [ "//webrtc/sdk:rtc_sdk_common_objc" ]
231 }
232
233 if (rtc_use_memcheck) {
234 data = valgrind_webrtc_dependencies
235 }
kjellander28a0ffd2016-08-24 07:48:42 -0700236 }
kjellander0f380d82016-06-01 04:48:26 -0700237
mbonadei9452c622017-04-27 12:29:29 -0700238 rtc_test("test_support_unittests") {
239 deps = []
240 sources = [
241 "fake_audio_device_unittest.cc",
242 "fake_network_pipe_unittest.cc",
243 "frame_generator_unittest.cc",
244 "rtp_file_reader_unittest.cc",
245 "rtp_file_writer_unittest.cc",
246 "testsupport/always_passing_unittest.cc",
247 "testsupport/isolated_output_unittest.cc",
248 "testsupport/metrics/video_metrics_unittest.cc",
249 "testsupport/packet_reader_unittest.cc",
250 "testsupport/perf_test_unittest.cc",
251 "testsupport/y4m_frame_writer_unittest.cc",
252 "testsupport/yuv_frame_reader_unittest.cc",
253 "testsupport/yuv_frame_writer_unittest.cc",
254 ]
kjellander28a0ffd2016-08-24 07:48:42 -0700255
mbonadei9452c622017-04-27 12:29:29 -0700256 # TODO(jschuh): Bug 1348: fix this warning.
257 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
258
259 if (is_win) {
260 # virtual override w/different const/volatile signature.
261 cflags = [ "/wd4373" ]
262 }
263
264 if (!build_with_chromium && is_clang) {
265 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
266 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
267 }
268
269 data = test_support_unittests_resources
270 if (is_android) {
271 deps += [ "//testing/android/native_test:native_test_support" ]
272 shard_timeout = 900
273 }
274
275 if (is_ios) {
276 deps += [ ":test_support_unittests_bundle_data" ]
277 }
278
279 deps += [
280 ":direct_transport",
281 ":fileutils_unittests",
282 ":test_common",
283 ":test_main",
284 ":video_test_common",
285 ":video_test_support",
286 "../modules/video_capture",
287 "//testing/gmock",
288 "//testing/gtest",
289 "//third_party/gflags",
290 ]
291 }
kjellander0f380d82016-06-01 04:48:26 -0700292}
mbonadei9452c622017-04-27 12:29:29 -0700293
294rtc_source_set("fileutils") {
295 testonly = true
296 sources = [
297 "testsupport/fileutils.cc",
298 "testsupport/fileutils.h",
299 ]
300 if (is_ios) {
301 sources += [ "testsupport/iosfileutils.mm" ]
302 }
303 visibility = [ ":*" ]
304}
305
306rtc_source_set("run_test") {
307 testonly = true
308 sources = [
309 "run_test.h",
310 ]
311 if (is_mac) {
312 sources += [ "mac/run_test.mm" ]
313 } else {
314 sources += [ "run_test.cc" ]
315 }
316}
317
ehmaldonado37535bf2016-12-05 06:42:45 -0800318rtc_source_set("fileutils_unittests") {
319 testonly = true
kjellandere0629c02017-04-25 04:04:50 -0700320 visibility = [ ":*" ] # Only targets in this file can depend on this.
ehmaldonado37535bf2016-12-05 06:42:45 -0800321 sources = [
322 "testsupport/fileutils_unittest.cc",
323 ]
324 deps = [
325 ":fileutils",
326 "//testing/gmock",
327 "//testing/gtest",
328 ]
329}
kjellander0f380d82016-06-01 04:48:26 -0700330
perkj488c5dc2017-02-08 05:55:51 -0800331rtc_source_set("direct_transport") {
332 testonly = true
333 sources = [
334 "direct_transport.cc",
335 "direct_transport.h",
336 "fake_network_pipe.cc",
337 "fake_network_pipe.h",
338 ]
339 if (!build_with_chromium && is_clang) {
340 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
341 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
342 }
343 deps = [
344 "../api:transport_api",
345 "../base:rtc_base_approved",
346 "../call",
347 ]
348}
349
perkj16ccfdf2017-02-28 14:41:05 -0800350rtc_source_set("fake_audio_device") {
351 testonly = true
352 sources = [
353 "fake_audio_device.cc",
354 "fake_audio_device.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 "../base:rtc_base_approved",
mbonadeib80ef8c2017-04-24 13:05:47 -0700362 "../modules/audio_device:audio_device",
perkj16ccfdf2017-02-28 14:41:05 -0800363 ]
364}
365
ehmaldonado38a21322016-09-02 04:10:34 -0700366rtc_source_set("test_common") {
kjellander0f380d82016-06-01 04:48:26 -0700367 testonly = true
368 sources = [
369 "call_test.cc",
370 "call_test.h",
371 "configurable_frame_size_encoder.cc",
372 "configurable_frame_size_encoder.h",
373 "constants.cc",
374 "constants.h",
kjellander0f380d82016-06-01 04:48:26 -0700375 "drifting_clock.cc",
376 "drifting_clock.h",
377 "encoder_settings.cc",
378 "encoder_settings.h",
kjellander0f380d82016-06-01 04:48:26 -0700379 "fake_decoder.cc",
380 "fake_decoder.h",
381 "fake_encoder.cc",
382 "fake_encoder.h",
sakal55d932b2016-09-30 06:19:08 -0700383 "fake_videorenderer.h",
kjellander0f380d82016-06-01 04:48:26 -0700384 "layer_filtering_transport.cc",
385 "layer_filtering_transport.h",
386 "mock_transport.h",
387 "mock_voe_channel_proxy.h",
388 "mock_voice_engine.h",
389 "null_transport.cc",
390 "null_transport.h",
391 "rtp_rtcp_observer.h",
392 "statistics.cc",
393 "statistics.h",
kjellander0f380d82016-06-01 04:48:26 -0700394 "win/run_loop_win.cc",
395 ]
396 if (!is_win) {
397 sources += [
398 "run_loop.cc",
399 "run_loop.h",
400 ]
401 }
402
kjellandere40a7ee2016-10-16 23:56:12 -0700403 if (!build_with_chromium && is_clang) {
404 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700405 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700406 }
407
408 deps = [
perkj488c5dc2017-02-08 05:55:51 -0800409 ":direct_transport",
perkj16ccfdf2017-02-28 14:41:05 -0800410 ":fake_audio_device",
kjellander0f380d82016-06-01 04:48:26 -0700411 ":rtp_test_utils",
412 ":test_support",
perkjc5726c12017-03-01 03:37:08 -0800413 ":video_test_common",
kjellander0f380d82016-06-01 04:48:26 -0700414 "..:webrtc_common",
ilnikd60d06a2017-04-05 03:02:20 -0700415 "../api/video_codecs:video_codecs_api",
kjellander94cee312016-06-10 01:56:57 -0700416 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700417 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700418 "../call",
ossu20a4b3f2017-04-27 02:08:52 -0700419 "../modules/audio_coding:builtin_audio_encoder_factory",
aleloi10111bc2016-11-17 06:48:48 -0800420 "../modules/audio_mixer:audio_mixer_impl",
aleloidd310712016-11-17 06:28:59 -0800421 "../modules/audio_processing",
kjellander94cee312016-06-10 01:56:57 -0700422 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700423 "//testing/gmock",
424 "//testing/gtest",
kjellander0f380d82016-06-01 04:48:26 -0700425 ]
oprypin92220ff2017-03-23 03:40:03 -0700426 if (!is_android) {
427 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
428 }
kjellander0f380d82016-06-01 04:48:26 -0700429}
430
431config("test_renderer_exported_config") {
432 if (is_win && is_clang) {
433 # GN orders flags on a target before flags from configs. The default config
434 # adds -Wall, and this flag have to be after -Wall -- so they need to
435 # come from a config and cannot be on the target directly.
ehmaldonado4bc4d272016-08-25 04:15:40 -0700436 cflags = [
kjellander0f380d82016-06-01 04:48:26 -0700437 "-Wno-bool-conversion",
438 "-Wno-comment",
439 "-Wno-delete-non-virtual-dtor",
440 ]
441 }
442}
443
ehmaldonado38a21322016-09-02 04:10:34 -0700444rtc_source_set("test_renderer") {
kjellander0f380d82016-06-01 04:48:26 -0700445 testonly = true
446 libs = []
447 sources = [
448 "linux/glx_renderer.cc",
449 "linux/glx_renderer.h",
450 "linux/video_renderer_linux.cc",
451 "mac/video_renderer_mac.h",
452 "mac/video_renderer_mac.mm",
453 "video_renderer.cc",
454 "video_renderer.h",
455 "win/d3d_renderer.cc",
456 "win/d3d_renderer.h",
457 ]
458 if (!is_linux && !is_mac && !is_win) {
459 sources += [ "null_platform_renderer.cc" ]
460 }
461 if (is_linux || is_mac) {
462 sources += [
463 "gl/gl_renderer.cc",
464 "gl/gl_renderer.h",
465 ]
466 }
467
468 if (is_linux) {
469 libs += [
470 "Xext",
471 "X11",
472 "GL",
473 ]
474 }
475 if (is_android) {
476 libs += [
477 "GLESv2",
478 "log",
479 ]
480 }
481 if (is_mac) {
482 libs = [
483 "Cocoa.framework",
484 "OpenGL.framework",
485 "CoreVideo.framework",
486 ]
487 }
488
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700489 public_configs = [ ":test_renderer_exported_config" ]
kjellander0f380d82016-06-01 04:48:26 -0700490
kjellandere40a7ee2016-10-16 23:56:12 -0700491 if (!build_with_chromium && is_clang) {
492 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700493 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700494 }
495
496 deps = [
497 ":test_support",
kjellander0f380d82016-06-01 04:48:26 -0700498 "../modules/media_file",
499 "//testing/gtest",
500 ]
501}
kwiberg37e99fd2017-04-10 05:15:48 -0700502
503rtc_source_set("audio_codec_mocks") {
504 testonly = true
505 sources = [
506 "mock_audio_decoder.h",
507 "mock_audio_decoder_factory.h",
508 ]
509}