blob: 5ac393df1c03b4a28db8c5e04d73444640993a57 [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 = [
19 ":field_trial",
kjellander0f380d82016-06-01 04:48:26 -070020 ":rtp_test_utils",
21 ":test_common",
22 ":test_renderer",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000023 ":test_support",
24 ":test_support_main",
kjellander0f380d82016-06-01 04:48:26 -070025 ":test_support_unittests",
26 ":video_test_common",
27 ]
28}
29
ehmaldonado38a21322016-09-02 04:10:34 -070030rtc_source_set("video_test_common") {
kjellander0f380d82016-06-01 04:48:26 -070031 testonly = true
32 sources = [
33 "fake_texture_frame.cc",
34 "fake_texture_frame.h",
35 "frame_generator.cc",
36 "frame_generator.h",
37 "frame_utils.cc",
38 "frame_utils.h",
39 ]
40
kjellander0f380d82016-06-01 04:48:26 -070041 if (is_clang && !is_nacl) {
42 # Suppress warnings from the Chromium Clang plugin.
43 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -070044 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070045 }
46
47 deps = [
48 "../common_video",
49 ]
50}
51
ehmaldonado38a21322016-09-02 04:10:34 -070052rtc_source_set("rtp_test_utils") {
kjellander0f380d82016-06-01 04:48:26 -070053 testonly = true
54 sources = [
55 "rtcp_packet_parser.cc",
56 "rtcp_packet_parser.h",
57 "rtp_file_reader.cc",
58 "rtp_file_reader.h",
59 "rtp_file_writer.cc",
60 "rtp_file_writer.h",
61 ]
62
kjellander0f380d82016-06-01 04:48:26 -070063 if (is_clang && !is_nacl) {
64 # Suppress warnings from the Chromium Clang plugin.
65 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -070066 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070067 }
68
69 deps = [
70 "..:webrtc_common",
71 "../modules/rtp_rtcp",
72 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000073 ]
74}
75
ehmaldonado38a21322016-09-02 04:10:34 -070076rtc_source_set("field_trial") {
kjellander0f380d82016-06-01 04:48:26 -070077 testonly = true
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000078 sources = [
79 "field_trial.cc",
80 "field_trial.h",
81 ]
82
83 deps = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000084 "..:webrtc_common",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000085 "../system_wrappers",
phoglund37ebcf02016-01-08 05:04:57 -080086 "../system_wrappers:field_trial_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000087 ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000088}
89
ehmaldonado38a21322016-09-02 04:10:34 -070090rtc_source_set("test_main") {
kjellander0f380d82016-06-01 04:48:26 -070091 testonly = true
92 sources = [
93 "test_main.cc",
94 ]
95
96 deps = [
97 ":field_trial",
98 ":test_support",
99 "../system_wrappers:metrics_default",
100 "//testing/gtest",
101 "//third_party/gflags",
102 ]
kjellander0f380d82016-06-01 04:48:26 -0700103}
104
ehmaldonado38a21322016-09-02 04:10:34 -0700105rtc_source_set("test_support") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000106 testonly = true
107
108 sources = [
109 "testsupport/fileutils.cc",
110 "testsupport/fileutils.h",
111 "testsupport/frame_reader.cc",
112 "testsupport/frame_reader.h",
113 "testsupport/frame_writer.cc",
114 "testsupport/frame_writer.h",
kjellander95177d12016-04-07 00:13:58 -0700115 "testsupport/iosfileutils.mm",
Peter Boström02083222016-06-14 12:52:54 +0200116 "testsupport/metrics/video_metrics.cc",
117 "testsupport/metrics/video_metrics.h",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000118 "testsupport/mock/mock_frame_reader.h",
119 "testsupport/mock/mock_frame_writer.h",
120 "testsupport/packet_reader.cc",
121 "testsupport/packet_reader.h",
122 "testsupport/perf_test.cc",
123 "testsupport/perf_test.h",
124 "testsupport/trace_to_stderr.cc",
125 "testsupport/trace_to_stderr.h",
126 ]
127
128 deps = [
kjellander988d31e2016-02-05 00:23:50 -0800129 "../base:gtest_prod",
Peter Boström02083222016-06-14 12:52:54 +0200130 "../common_video",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000131 "../system_wrappers",
Peter Boström62e9bda2015-11-23 15:12:06 +0100132 "//testing/gmock",
133 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000134 ]
135
Peter Boström02083222016-06-14 12:52:54 +0200136 if (is_clang) {
137 # Suppress warnings from the Chromium Clang plugin.
138 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700139 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
Peter Boström02083222016-06-14 12:52:54 +0200140 }
141
kjellander95177d12016-04-07 00:13:58 -0700142 if (is_ios) {
kjellander0f380d82016-06-01 04:48:26 -0700143 configs += [ "//build/config/compiler:enable_arc" ]
144 }
145
146 if (use_x11) {
147 deps += [ "//tools/xdisplaycheck" ]
kjellander95177d12016-04-07 00:13:58 -0700148 }
149
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000150 if (is_android) {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000151 deps += [ "//base:base" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000152 }
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000153}
154
kjellander0f380d82016-06-01 04:48:26 -0700155# Depend on this target when you want to have test_support but also the
156# main method needed for gtest to execute!
ehmaldonado38a21322016-09-02 04:10:34 -0700157rtc_source_set("test_support_main") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000158 testonly = true
159
160 sources = [
161 "run_all_unittests.cc",
162 "test_suite.cc",
163 "test_suite.h",
164 ]
165
166 deps = [
167 ":field_trial",
168 ":test_support",
asapersson01d70a32016-05-20 06:29:46 -0700169 "../system_wrappers:metrics_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000170 "//testing/gmock",
171 "//testing/gtest",
172 "//third_party/gflags",
173 ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000174}
kjellander0f380d82016-06-01 04:48:26 -0700175
176# Depend on this target when you want to have test_support and a special
177# main for mac which will run your test on a worker thread and consume
178# events on the main thread. Useful if you want to access a webcam.
179# This main will provide all the scaffolding and objective-c black magic
180# for you. All you need to do is to implement a function in the
181# run_threaded_main_mac.h file (ImplementThisToRunYourTest).
ehmaldonado38a21322016-09-02 04:10:34 -0700182rtc_source_set("test_support_main_threaded_mac") {
kjellander0f380d82016-06-01 04:48:26 -0700183 testonly = true
184
185 sources = [
186 "testsupport/mac/run_threaded_main_mac.h",
187 "testsupport/mac/run_threaded_main_mac.mm",
188 ]
189
kjellander0f380d82016-06-01 04:48:26 -0700190 deps = [
191 ":test_support",
192 ]
193}
194
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700195test_support_unittests_resources = [
196 "//resources/foreman_cif_short.yuv",
197 "//resources/video_coding/frame-ethernet-ii.pcap",
198 "//resources/video_coding/frame-loopback.pcap",
199 "//resources/video_coding/pltype103.rtp",
200 "//resources/video_coding/pltype103_header_only.rtp",
201 "//resources/video_coding/ssrcs-2.pcap",
202 "//resources/video_coding/ssrcs-3.pcap",
203]
kjellander32c4a202016-08-30 02:53:49 -0700204
205if (is_ios) {
206 bundle_data("test_support_unittests_bundle_data") {
207 testonly = true
208 sources = test_support_unittests_resources
209 outputs = [
210 "{{bundle_resources_dir}}/{{source_file_part}}",
211 ]
212 }
213}
214
ehmaldonado38a21322016-09-02 04:10:34 -0700215rtc_test("test_support_unittests") {
kjellander0f380d82016-06-01 04:48:26 -0700216 deps = []
217 sources = [
kjellander0f380d82016-06-01 04:48:26 -0700218 "fake_network_pipe_unittest.cc",
219 "frame_generator_unittest.cc",
220 "rtp_file_reader_unittest.cc",
221 "rtp_file_writer_unittest.cc",
222 "testsupport/always_passing_unittest.cc",
223 "testsupport/fileutils_unittest.cc",
224 "testsupport/frame_reader_unittest.cc",
225 "testsupport/frame_writer_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200226 "testsupport/metrics/video_metrics_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700227 "testsupport/packet_reader_unittest.cc",
228 "testsupport/perf_test_unittest.cc",
229 "testsupport/unittest_utils.h",
230 ]
231
kjellander8f4419b2016-06-02 02:09:52 -0700232 # TODO(jschuh): Bug 1348: fix this warning.
233 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
234
kjellander0f380d82016-06-01 04:48:26 -0700235 if (is_win) {
kjellander8f4419b2016-06-02 02:09:52 -0700236 cflags = [ "/wd4373" ] # virtual override w/different const/volatile signature.
kjellander0f380d82016-06-01 04:48:26 -0700237 }
238
239 if (is_clang) {
240 # Suppress warnings from the Chromium Clang plugin.
241 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700242 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700243 }
244
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700245 data = test_support_unittests_resources
kjellander0f380d82016-06-01 04:48:26 -0700246 if (is_android) {
247 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700248 shard_timeout = 900
249 }
kjellander0f380d82016-06-01 04:48:26 -0700250
kjellander32c4a202016-08-30 02:53:49 -0700251 if (is_ios) {
252 deps += [ ":test_support_unittests_bundle_data" ]
kjellander0f380d82016-06-01 04:48:26 -0700253 }
kjellander28a0ffd2016-08-24 07:48:42 -0700254
kjellander0f380d82016-06-01 04:48:26 -0700255 deps += [
kjellander0f380d82016-06-01 04:48:26 -0700256 ":test_common",
257 ":test_support_main",
258 "../modules/video_capture",
259 "//testing/gmock",
260 "//testing/gtest",
261 ]
262}
263
ehmaldonado38a21322016-09-02 04:10:34 -0700264rtc_source_set("test_common") {
kjellander0f380d82016-06-01 04:48:26 -0700265 testonly = true
266 sources = [
267 "call_test.cc",
268 "call_test.h",
269 "configurable_frame_size_encoder.cc",
270 "configurable_frame_size_encoder.h",
271 "constants.cc",
272 "constants.h",
273 "direct_transport.cc",
274 "direct_transport.h",
275 "drifting_clock.cc",
276 "drifting_clock.h",
277 "encoder_settings.cc",
278 "encoder_settings.h",
279 "fake_audio_device.cc",
280 "fake_audio_device.h",
281 "fake_decoder.cc",
282 "fake_decoder.h",
283 "fake_encoder.cc",
284 "fake_encoder.h",
285 "fake_network_pipe.cc",
286 "fake_network_pipe.h",
287 "frame_generator_capturer.cc",
288 "frame_generator_capturer.h",
289 "layer_filtering_transport.cc",
290 "layer_filtering_transport.h",
291 "mock_transport.h",
292 "mock_voe_channel_proxy.h",
293 "mock_voice_engine.h",
294 "null_transport.cc",
295 "null_transport.h",
296 "rtp_rtcp_observer.h",
297 "statistics.cc",
298 "statistics.h",
299 "vcm_capturer.cc",
300 "vcm_capturer.h",
kjellander0f380d82016-06-01 04:48:26 -0700301 "video_capturer.h",
302 "win/run_loop_win.cc",
303 ]
304 if (!is_win) {
305 sources += [
306 "run_loop.cc",
307 "run_loop.h",
308 ]
309 }
310
kjellander0f380d82016-06-01 04:48:26 -0700311 if (is_clang && !is_nacl) {
312 # Suppress warnings from the Chromium Clang plugin.
313 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700314 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700315 }
316
317 deps = [
318 ":rtp_test_utils",
319 ":test_support",
320 ":video_test_common",
kjellander0f380d82016-06-01 04:48:26 -0700321 "..:webrtc_common",
kjellander94cee312016-06-10 01:56:57 -0700322 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700323 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700324 "../call",
kjellander0f380d82016-06-01 04:48:26 -0700325 "../modules/media_file",
kjellander94cee312016-06-10 01:56:57 -0700326 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700327 "//testing/gmock",
328 "//testing/gtest",
kjellander0f380d82016-06-01 04:48:26 -0700329 ]
330}
331
332config("test_renderer_exported_config") {
333 if (is_win && is_clang) {
334 # GN orders flags on a target before flags from configs. The default config
335 # adds -Wall, and this flag have to be after -Wall -- so they need to
336 # come from a config and cannot be on the target directly.
ehmaldonado4bc4d272016-08-25 04:15:40 -0700337 cflags = [
kjellander0f380d82016-06-01 04:48:26 -0700338 "-Wno-bool-conversion",
339 "-Wno-comment",
340 "-Wno-delete-non-virtual-dtor",
341 ]
342 }
343}
344
ehmaldonado38a21322016-09-02 04:10:34 -0700345rtc_source_set("test_renderer") {
kjellander0f380d82016-06-01 04:48:26 -0700346 testonly = true
347 libs = []
348 sources = [
349 "linux/glx_renderer.cc",
350 "linux/glx_renderer.h",
351 "linux/video_renderer_linux.cc",
352 "mac/video_renderer_mac.h",
353 "mac/video_renderer_mac.mm",
354 "video_renderer.cc",
355 "video_renderer.h",
356 "win/d3d_renderer.cc",
357 "win/d3d_renderer.h",
358 ]
359 if (!is_linux && !is_mac && !is_win) {
360 sources += [ "null_platform_renderer.cc" ]
361 }
362 if (is_linux || is_mac) {
363 sources += [
364 "gl/gl_renderer.cc",
365 "gl/gl_renderer.h",
366 ]
367 }
368
369 if (is_linux) {
370 libs += [
371 "Xext",
372 "X11",
373 "GL",
374 ]
375 }
376 if (is_android) {
377 libs += [
378 "GLESv2",
379 "log",
380 ]
381 }
382 if (is_mac) {
383 libs = [
384 "Cocoa.framework",
385 "OpenGL.framework",
386 "CoreVideo.framework",
387 ]
388 }
389
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700390 public_configs = [ ":test_renderer_exported_config" ]
kjellander0f380d82016-06-01 04:48:26 -0700391
392 if (is_clang && !is_nacl) {
393 # Suppress warnings from the Chromium Clang plugin.
394 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700395 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700396 }
397
398 deps = [
399 ":test_support",
400 ":video_test_common",
401 "../modules/media_file",
402 "//testing/gtest",
403 ]
404}