blob: 2966c8d01c69f03d850c947b94cc06aaf983ce5e [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) {
36 # GN orders flags on a target before flags from configs. The default config
37 # adds -Wall, and this flag have to be after -Wall -- so they need to
38 # come from a config and cannot be on the target directly.
39 cflags += [
40 "-Wno-parentheses-equality",
41 "-Wno-reorder",
42 "-Wno-tautological-constant-out-of-range-compare",
43 "-Wno-unused-private-field",
44 ]
45 }
46 }
47}
48
49source_set("channel_transport") {
50 testonly = true
51 sources = [
52 "channel_transport/channel_transport.cc",
53 "channel_transport/channel_transport.h",
54 "channel_transport/traffic_control_win.cc",
55 "channel_transport/traffic_control_win.h",
56 "channel_transport/udp_socket2_manager_win.cc",
57 "channel_transport/udp_socket2_manager_win.h",
58 "channel_transport/udp_socket2_win.cc",
59 "channel_transport/udp_socket2_win.h",
60 "channel_transport/udp_socket_manager_posix.cc",
61 "channel_transport/udp_socket_manager_posix.h",
62 "channel_transport/udp_socket_manager_wrapper.cc",
63 "channel_transport/udp_socket_manager_wrapper.h",
64 "channel_transport/udp_socket_posix.cc",
65 "channel_transport/udp_socket_posix.h",
66 "channel_transport/udp_socket_wrapper.cc",
67 "channel_transport/udp_socket_wrapper.h",
68 "channel_transport/udp_transport.h",
69 "channel_transport/udp_transport_impl.cc",
70 "channel_transport/udp_transport_impl.h",
71 ]
72
73 configs += [
74 "..:common_config",
75 ":channel_transport_warnings_config",
76 ]
77 public_configs = [ "..:common_inherited_config" ]
78
79 if (is_clang && !is_nacl) {
80 # Suppress warnings from the Chromium Clang plugin.
81 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
82 configs -= [ "//build/config/clang:find_bad_constructs" ]
83 }
84
85 deps = [
86 "..:webrtc_common",
87 "../system_wrappers",
88 "//testing/gtest",
89 ]
90}
91
92source_set("video_test_common") {
93 testonly = true
94 sources = [
95 "fake_texture_frame.cc",
96 "fake_texture_frame.h",
97 "frame_generator.cc",
98 "frame_generator.h",
99 "frame_utils.cc",
100 "frame_utils.h",
101 ]
102
103 configs += [ "..:common_config" ]
104 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.
109 configs -= [ "//build/config/clang:find_bad_constructs" ]
110 }
111
112 deps = [
113 "../common_video",
114 ]
115}
116
117source_set("rtp_test_utils") {
118 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
128 configs += [ "..:common_config" ]
129 public_configs = [ "..:common_inherited_config" ]
130
131 if (is_clang && !is_nacl) {
132 # Suppress warnings from the Chromium Clang plugin.
133 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
134 configs -= [ "//build/config/clang:find_bad_constructs" ]
135 }
136
137 deps = [
138 "..:webrtc_common",
139 "../modules/rtp_rtcp",
140 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000141 ]
142}
143
144source_set("field_trial") {
kjellander0f380d82016-06-01 04:48:26 -0700145 testonly = true
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000146 sources = [
147 "field_trial.cc",
148 "field_trial.h",
149 ]
150
151 deps = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000152 "..:webrtc_common",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000153 "../system_wrappers",
phoglund37ebcf02016-01-08 05:04:57 -0800154 "../system_wrappers:field_trial_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000155 ]
156
kjellander@webrtc.org3037bc32014-09-30 19:07:58 +0000157 configs += [ "..:common_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200158 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000159}
160
kjellander0f380d82016-06-01 04:48:26 -0700161source_set("test_main") {
162 testonly = true
163 sources = [
164 "test_main.cc",
165 ]
166
167 deps = [
168 ":field_trial",
169 ":test_support",
170 "../system_wrappers:metrics_default",
171 "//testing/gtest",
172 "//third_party/gflags",
173 ]
174
175 configs += [ "..:common_config" ]
176 public_configs = [ "..:common_inherited_config" ]
177}
178
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000179source_set("test_support") {
180 testonly = true
181
182 sources = [
183 "testsupport/fileutils.cc",
184 "testsupport/fileutils.h",
185 "testsupport/frame_reader.cc",
186 "testsupport/frame_reader.h",
187 "testsupport/frame_writer.cc",
188 "testsupport/frame_writer.h",
kjellander95177d12016-04-07 00:13:58 -0700189 "testsupport/iosfileutils.mm",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000190 "testsupport/mock/mock_frame_reader.h",
191 "testsupport/mock/mock_frame_writer.h",
192 "testsupport/packet_reader.cc",
193 "testsupport/packet_reader.h",
194 "testsupport/perf_test.cc",
195 "testsupport/perf_test.h",
196 "testsupport/trace_to_stderr.cc",
197 "testsupport/trace_to_stderr.h",
198 ]
199
200 deps = [
kjellander988d31e2016-02-05 00:23:50 -0800201 "../base:gtest_prod",
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
kjellander95177d12016-04-07 00:13:58 -0700207 if (is_ios) {
kjellander0f380d82016-06-01 04:48:26 -0700208 configs += [ "//build/config/compiler:enable_arc" ]
209 }
210
211 if (use_x11) {
212 deps += [ "//tools/xdisplaycheck" ]
kjellander95177d12016-04-07 00:13:58 -0700213 }
214
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000215 if (is_android) {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000216 deps += [ "//base:base" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000217 }
218
kjellander@webrtc.org3037bc32014-09-30 19:07:58 +0000219 configs += [ "..:common_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200220 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000221}
222
kjellander0f380d82016-06-01 04:48:26 -0700223# Depend on this target when you want to have test_support but also the
224# main method needed for gtest to execute!
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000225source_set("test_support_main") {
226 testonly = true
227
228 sources = [
229 "run_all_unittests.cc",
230 "test_suite.cc",
231 "test_suite.h",
232 ]
233
234 deps = [
235 ":field_trial",
236 ":test_support",
asapersson01d70a32016-05-20 06:29:46 -0700237 "../system_wrappers:metrics_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000238 "//testing/gmock",
239 "//testing/gtest",
240 "//third_party/gflags",
241 ]
242
kjellander@webrtc.org3037bc32014-09-30 19:07:58 +0000243 configs += [ "..:common_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200244 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000245}
kjellander0f380d82016-06-01 04:48:26 -0700246
247# Depend on this target when you want to have test_support and a special
248# main for mac which will run your test on a worker thread and consume
249# events on the main thread. Useful if you want to access a webcam.
250# This main will provide all the scaffolding and objective-c black magic
251# for you. All you need to do is to implement a function in the
252# run_threaded_main_mac.h file (ImplementThisToRunYourTest).
253source_set("test_support_main_threaded_mac") {
254 testonly = true
255
256 sources = [
257 "testsupport/mac/run_threaded_main_mac.h",
258 "testsupport/mac/run_threaded_main_mac.mm",
259 ]
260
261 configs += [ "..:common_config" ]
262 public_configs = [ "..:common_inherited_config" ]
263
264 deps = [
265 ":test_support",
266 ]
267}
268
269test("test_support_unittests") {
270 deps = []
271 sources = [
272 "channel_transport/udp_socket_manager_unittest.cc",
273 "channel_transport/udp_socket_wrapper_unittest.cc",
274 "channel_transport/udp_transport_unittest.cc",
275 "fake_network_pipe_unittest.cc",
276 "frame_generator_unittest.cc",
277 "rtp_file_reader_unittest.cc",
278 "rtp_file_writer_unittest.cc",
279 "testsupport/always_passing_unittest.cc",
280 "testsupport/fileutils_unittest.cc",
281 "testsupport/frame_reader_unittest.cc",
282 "testsupport/frame_writer_unittest.cc",
283 "testsupport/packet_reader_unittest.cc",
284 "testsupport/perf_test_unittest.cc",
285 "testsupport/unittest_utils.h",
286 ]
287
288 configs += [ "..:common_config" ]
289 public_configs = [ "..:common_inherited_config" ]
290
kjellander8f4419b2016-06-02 02:09:52 -0700291 # TODO(jschuh): Bug 1348: fix this warning.
292 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
293
kjellander0f380d82016-06-01 04:48:26 -0700294 if (is_win) {
kjellander8f4419b2016-06-02 02:09:52 -0700295 cflags = [ "/wd4373" ] # virtual override w/different const/volatile signature.
kjellander0f380d82016-06-01 04:48:26 -0700296 }
297
298 if (is_clang) {
299 # Suppress warnings from the Chromium Clang plugin.
300 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
301 configs -= [ "//build/config/clang:find_bad_constructs" ]
302 }
303
304 if (is_android) {
305 deps += [ "//testing/android/native_test:native_test_support" ]
306
307 # This needs to be kept in sync with the test_support_unittests.isolate file.
308 # TODO(kjellander); Move this to android_assets targets instead.
309 data = [
310 "//resources/video_coding/frame-ethernet-ii.pcap",
311 "//resources/video_coding/frame-loopback.pcap",
312 "//resources/video_coding/pltype103.rtp",
313 "//resources/video_coding/pltype103_header_only.rtp",
314 "//resources/video_coding/ssrcs-2.pcap",
315 "//resources/video_coding/ssrcs-3.pcap",
316 ]
317 }
318 deps += [
319 ":channel_transport",
320 ":test_common",
321 ":test_support_main",
322 "../modules/video_capture",
323 "//testing/gmock",
324 "//testing/gtest",
325 ]
326}
327
328source_set("test_common") {
329 testonly = true
330 sources = [
331 "call_test.cc",
332 "call_test.h",
333 "configurable_frame_size_encoder.cc",
334 "configurable_frame_size_encoder.h",
335 "constants.cc",
336 "constants.h",
337 "direct_transport.cc",
338 "direct_transport.h",
339 "drifting_clock.cc",
340 "drifting_clock.h",
341 "encoder_settings.cc",
342 "encoder_settings.h",
343 "fake_audio_device.cc",
344 "fake_audio_device.h",
345 "fake_decoder.cc",
346 "fake_decoder.h",
347 "fake_encoder.cc",
348 "fake_encoder.h",
349 "fake_network_pipe.cc",
350 "fake_network_pipe.h",
351 "frame_generator_capturer.cc",
352 "frame_generator_capturer.h",
353 "layer_filtering_transport.cc",
354 "layer_filtering_transport.h",
355 "mock_transport.h",
356 "mock_voe_channel_proxy.h",
357 "mock_voice_engine.h",
358 "null_transport.cc",
359 "null_transport.h",
360 "rtp_rtcp_observer.h",
361 "statistics.cc",
362 "statistics.h",
363 "vcm_capturer.cc",
364 "vcm_capturer.h",
365 "video_capturer.cc",
366 "video_capturer.h",
367 "win/run_loop_win.cc",
368 ]
369 if (!is_win) {
370 sources += [
371 "run_loop.cc",
372 "run_loop.h",
373 ]
374 }
375
376 configs += [ "..:common_config" ]
377 public_configs = [ "..:common_inherited_config" ]
378
379 if (is_clang && !is_nacl) {
380 # Suppress warnings from the Chromium Clang plugin.
381 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
382 configs -= [ "//build/config/clang:find_bad_constructs" ]
383 }
384
385 deps = [
386 ":rtp_test_utils",
387 ":test_support",
388 ":video_test_common",
kjellander0f380d82016-06-01 04:48:26 -0700389 "..:webrtc_common",
kjellander94cee312016-06-10 01:56:57 -0700390 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700391 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700392 "../call",
kjellander0f380d82016-06-01 04:48:26 -0700393 "../modules/media_file",
kjellander94cee312016-06-10 01:56:57 -0700394 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700395 "//testing/gmock",
396 "//testing/gtest",
397 "//third_party/gflags",
398 ]
399}
400
401config("test_renderer_exported_config") {
402 if (is_win && is_clang) {
403 # GN orders flags on a target before flags from configs. The default config
404 # adds -Wall, and this flag have to be after -Wall -- so they need to
405 # come from a config and cannot be on the target directly.
406 cflags += [
407 "-Wno-bool-conversion",
408 "-Wno-comment",
409 "-Wno-delete-non-virtual-dtor",
410 ]
411 }
412}
413
414source_set("test_renderer") {
415 testonly = true
416 libs = []
417 sources = [
418 "linux/glx_renderer.cc",
419 "linux/glx_renderer.h",
420 "linux/video_renderer_linux.cc",
421 "mac/video_renderer_mac.h",
422 "mac/video_renderer_mac.mm",
423 "video_renderer.cc",
424 "video_renderer.h",
425 "win/d3d_renderer.cc",
426 "win/d3d_renderer.h",
427 ]
428 if (!is_linux && !is_mac && !is_win) {
429 sources += [ "null_platform_renderer.cc" ]
430 }
431 if (is_linux || is_mac) {
432 sources += [
433 "gl/gl_renderer.cc",
434 "gl/gl_renderer.h",
435 ]
436 }
437
438 if (is_linux) {
439 libs += [
440 "Xext",
441 "X11",
442 "GL",
443 ]
444 }
445 if (is_android) {
446 libs += [
447 "GLESv2",
448 "log",
449 ]
450 }
451 if (is_mac) {
452 libs = [
453 "Cocoa.framework",
454 "OpenGL.framework",
455 "CoreVideo.framework",
456 ]
457 }
458
459 configs += [ "..:common_config" ]
460 public_configs = [
461 "..:common_inherited_config",
462 ":test_renderer_exported_config",
463 ]
464
465 if (is_clang && !is_nacl) {
466 # Suppress warnings from the Chromium Clang plugin.
467 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
468 configs -= [ "//build/config/clang:find_bad_constructs" ]
469 }
470
471 deps = [
472 ":test_support",
473 ":video_test_common",
474 "../modules/media_file",
475 "//testing/gtest",
476 ]
477}