blob: 326a3b1e959db2cabe8aafb074dac62ac3fefe1b [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
kjellanderb62dbbe2016-09-23 00:38:52 -070015group("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
kjellandere40a7ee2016-10-16 23:56:12 -070041 if (!build_with_chromium && is_clang) {
42 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070043 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070044 }
45
46 deps = [
47 "../common_video",
48 ]
49}
50
ehmaldonado38a21322016-09-02 04:10:34 -070051rtc_source_set("rtp_test_utils") {
kjellander0f380d82016-06-01 04:48:26 -070052 testonly = true
53 sources = [
54 "rtcp_packet_parser.cc",
55 "rtcp_packet_parser.h",
56 "rtp_file_reader.cc",
57 "rtp_file_reader.h",
58 "rtp_file_writer.cc",
59 "rtp_file_writer.h",
60 ]
61
kjellandere40a7ee2016-10-16 23:56:12 -070062 if (!build_with_chromium && is_clang) {
63 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070064 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -070065 }
66
67 deps = [
68 "..:webrtc_common",
69 "../modules/rtp_rtcp",
70 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000071 ]
72}
73
ehmaldonado38a21322016-09-02 04:10:34 -070074rtc_source_set("field_trial") {
kjellander0f380d82016-06-01 04:48:26 -070075 testonly = true
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000076 sources = [
77 "field_trial.cc",
78 "field_trial.h",
79 ]
80
81 deps = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000082 "..:webrtc_common",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000083 "../system_wrappers",
phoglund37ebcf02016-01-08 05:04:57 -080084 "../system_wrappers:field_trial_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000085 ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +000086}
87
ehmaldonado38a21322016-09-02 04:10:34 -070088rtc_source_set("test_main") {
kjellander0f380d82016-06-01 04:48:26 -070089 testonly = true
90 sources = [
91 "test_main.cc",
92 ]
93
94 deps = [
95 ":field_trial",
96 ":test_support",
97 "../system_wrappers:metrics_default",
98 "//testing/gtest",
99 "//third_party/gflags",
100 ]
kjellander0f380d82016-06-01 04:48:26 -0700101}
102
ehmaldonado38a21322016-09-02 04:10:34 -0700103rtc_source_set("test_support") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000104 testonly = true
105
106 sources = [
kwiberg77eab702016-09-28 17:42:01 -0700107 "gmock.h",
108 "gtest.h",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000109 "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 = [
nisse115bd152016-09-30 04:14:07 -0700129 ":video_test_common",
kjellander988d31e2016-02-05 00:23:50 -0800130 "../base:gtest_prod",
kwiberg77eab702016-09-28 17:42:01 -0700131 "../base:rtc_base_approved",
Peter Boström02083222016-06-14 12:52:54 +0200132 "../common_video",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000133 "../system_wrappers",
Peter Boström62e9bda2015-11-23 15:12:06 +0100134 "//testing/gmock",
135 "//testing/gtest",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000136 ]
137
kjellandere40a7ee2016-10-16 23:56:12 -0700138 if (!build_with_chromium && is_clang) {
139 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700140 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
Peter Boström02083222016-06-14 12:52:54 +0200141 }
142
kjellander95177d12016-04-07 00:13:58 -0700143 if (is_ios) {
kjellander0f380d82016-06-01 04:48:26 -0700144 configs += [ "//build/config/compiler:enable_arc" ]
145 }
146
147 if (use_x11) {
148 deps += [ "//tools/xdisplaycheck" ]
kjellander95177d12016-04-07 00:13:58 -0700149 }
150
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000151 if (is_android) {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000152 deps += [ "//base:base" ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000153 }
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000154}
155
kjellander0f380d82016-06-01 04:48:26 -0700156# Depend on this target when you want to have test_support but also the
157# main method needed for gtest to execute!
ehmaldonado38a21322016-09-02 04:10:34 -0700158rtc_source_set("test_support_main") {
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000159 testonly = true
160
161 sources = [
162 "run_all_unittests.cc",
163 "test_suite.cc",
164 "test_suite.h",
165 ]
166
167 deps = [
168 ":field_trial",
169 ":test_support",
asapersson01d70a32016-05-20 06:29:46 -0700170 "../system_wrappers:metrics_default",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000171 "//testing/gmock",
172 "//testing/gtest",
173 "//third_party/gflags",
174 ]
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000175}
kjellander0f380d82016-06-01 04:48:26 -0700176
177# Depend on this target when you want to have test_support and a special
178# main for mac which will run your test on a worker thread and consume
179# events on the main thread. Useful if you want to access a webcam.
180# This main will provide all the scaffolding and objective-c black magic
181# for you. All you need to do is to implement a function in the
182# run_threaded_main_mac.h file (ImplementThisToRunYourTest).
ehmaldonado38a21322016-09-02 04:10:34 -0700183rtc_source_set("test_support_main_threaded_mac") {
kjellander0f380d82016-06-01 04:48:26 -0700184 testonly = true
185
186 sources = [
187 "testsupport/mac/run_threaded_main_mac.h",
188 "testsupport/mac/run_threaded_main_mac.mm",
189 ]
190
kjellander0f380d82016-06-01 04:48:26 -0700191 deps = [
192 ":test_support",
193 ]
194}
195
kjellandera3cac052016-10-24 01:52:39 -0700196rtc_source_set("run_test") {
197 testonly = true
198 sources = [
199 "run_test.h",
200 ]
201 if (is_mac) {
202 sources += [ "mac/run_test.mm" ]
203 } else {
204 sources += [ "run_test.cc" ]
205 }
206}
207
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700208test_support_unittests_resources = [
209 "//resources/foreman_cif_short.yuv",
210 "//resources/video_coding/frame-ethernet-ii.pcap",
211 "//resources/video_coding/frame-loopback.pcap",
212 "//resources/video_coding/pltype103.rtp",
213 "//resources/video_coding/pltype103_header_only.rtp",
214 "//resources/video_coding/ssrcs-2.pcap",
215 "//resources/video_coding/ssrcs-3.pcap",
216]
kjellander32c4a202016-08-30 02:53:49 -0700217
218if (is_ios) {
219 bundle_data("test_support_unittests_bundle_data") {
220 testonly = true
221 sources = test_support_unittests_resources
222 outputs = [
223 "{{bundle_resources_dir}}/{{source_file_part}}",
224 ]
225 }
226}
227
ehmaldonado38a21322016-09-02 04:10:34 -0700228rtc_test("test_support_unittests") {
kjellander0f380d82016-06-01 04:48:26 -0700229 deps = []
230 sources = [
kjellander0f380d82016-06-01 04:48:26 -0700231 "fake_network_pipe_unittest.cc",
232 "frame_generator_unittest.cc",
233 "rtp_file_reader_unittest.cc",
234 "rtp_file_writer_unittest.cc",
235 "testsupport/always_passing_unittest.cc",
236 "testsupport/fileutils_unittest.cc",
237 "testsupport/frame_reader_unittest.cc",
238 "testsupport/frame_writer_unittest.cc",
Peter Boström02083222016-06-14 12:52:54 +0200239 "testsupport/metrics/video_metrics_unittest.cc",
kjellander0f380d82016-06-01 04:48:26 -0700240 "testsupport/packet_reader_unittest.cc",
241 "testsupport/perf_test_unittest.cc",
242 "testsupport/unittest_utils.h",
243 ]
244
kjellander8f4419b2016-06-02 02:09:52 -0700245 # TODO(jschuh): Bug 1348: fix this warning.
246 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
247
kjellander0f380d82016-06-01 04:48:26 -0700248 if (is_win) {
kjellander8f4419b2016-06-02 02:09:52 -0700249 cflags = [ "/wd4373" ] # virtual override w/different const/volatile signature.
kjellander0f380d82016-06-01 04:48:26 -0700250 }
251
kjellandere40a7ee2016-10-16 23:56:12 -0700252 if (!build_with_chromium && is_clang) {
253 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700254 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700255 }
256
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700257 data = test_support_unittests_resources
kjellander0f380d82016-06-01 04:48:26 -0700258 if (is_android) {
259 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700260 shard_timeout = 900
261 }
kjellander0f380d82016-06-01 04:48:26 -0700262
kjellander32c4a202016-08-30 02:53:49 -0700263 if (is_ios) {
264 deps += [ ":test_support_unittests_bundle_data" ]
kjellander0f380d82016-06-01 04:48:26 -0700265 }
kjellander28a0ffd2016-08-24 07:48:42 -0700266
kjellander0f380d82016-06-01 04:48:26 -0700267 deps += [
kjellander0f380d82016-06-01 04:48:26 -0700268 ":test_common",
269 ":test_support_main",
270 "../modules/video_capture",
271 "//testing/gmock",
272 "//testing/gtest",
273 ]
274}
275
ehmaldonado38a21322016-09-02 04:10:34 -0700276rtc_source_set("test_common") {
kjellander0f380d82016-06-01 04:48:26 -0700277 testonly = true
278 sources = [
279 "call_test.cc",
280 "call_test.h",
281 "configurable_frame_size_encoder.cc",
282 "configurable_frame_size_encoder.h",
283 "constants.cc",
284 "constants.h",
285 "direct_transport.cc",
286 "direct_transport.h",
287 "drifting_clock.cc",
288 "drifting_clock.h",
289 "encoder_settings.cc",
290 "encoder_settings.h",
291 "fake_audio_device.cc",
292 "fake_audio_device.h",
293 "fake_decoder.cc",
294 "fake_decoder.h",
295 "fake_encoder.cc",
296 "fake_encoder.h",
297 "fake_network_pipe.cc",
298 "fake_network_pipe.h",
sakal55d932b2016-09-30 06:19:08 -0700299 "fake_videorenderer.h",
kjellander0f380d82016-06-01 04:48:26 -0700300 "frame_generator_capturer.cc",
301 "frame_generator_capturer.h",
302 "layer_filtering_transport.cc",
303 "layer_filtering_transport.h",
304 "mock_transport.h",
305 "mock_voe_channel_proxy.h",
306 "mock_voice_engine.h",
307 "null_transport.cc",
308 "null_transport.h",
309 "rtp_rtcp_observer.h",
310 "statistics.cc",
311 "statistics.h",
312 "vcm_capturer.cc",
313 "vcm_capturer.h",
kjellander0f380d82016-06-01 04:48:26 -0700314 "video_capturer.h",
315 "win/run_loop_win.cc",
316 ]
317 if (!is_win) {
318 sources += [
319 "run_loop.cc",
320 "run_loop.h",
321 ]
322 }
323
kjellandere40a7ee2016-10-16 23:56:12 -0700324 if (!build_with_chromium && is_clang) {
325 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700326 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700327 }
328
329 deps = [
330 ":rtp_test_utils",
331 ":test_support",
kjellander0f380d82016-06-01 04:48:26 -0700332 "..:webrtc_common",
kjellander94cee312016-06-10 01:56:57 -0700333 "../audio",
kjellander0f380d82016-06-01 04:48:26 -0700334 "../base:rtc_base_approved",
kjellander94cee312016-06-10 01:56:57 -0700335 "../call",
kjellander0f380d82016-06-01 04:48:26 -0700336 "../modules/media_file",
kjellandera3cac052016-10-24 01:52:39 -0700337 "../modules/video_capture:video_capture_module",
kjellander94cee312016-06-10 01:56:57 -0700338 "../video",
kjellander0f380d82016-06-01 04:48:26 -0700339 "//testing/gmock",
340 "//testing/gtest",
kjellander0f380d82016-06-01 04:48:26 -0700341 ]
342}
343
344config("test_renderer_exported_config") {
345 if (is_win && is_clang) {
346 # GN orders flags on a target before flags from configs. The default config
347 # adds -Wall, and this flag have to be after -Wall -- so they need to
348 # come from a config and cannot be on the target directly.
ehmaldonado4bc4d272016-08-25 04:15:40 -0700349 cflags = [
kjellander0f380d82016-06-01 04:48:26 -0700350 "-Wno-bool-conversion",
351 "-Wno-comment",
352 "-Wno-delete-non-virtual-dtor",
353 ]
354 }
355}
356
ehmaldonado38a21322016-09-02 04:10:34 -0700357rtc_source_set("test_renderer") {
kjellander0f380d82016-06-01 04:48:26 -0700358 testonly = true
359 libs = []
360 sources = [
361 "linux/glx_renderer.cc",
362 "linux/glx_renderer.h",
363 "linux/video_renderer_linux.cc",
364 "mac/video_renderer_mac.h",
365 "mac/video_renderer_mac.mm",
366 "video_renderer.cc",
367 "video_renderer.h",
368 "win/d3d_renderer.cc",
369 "win/d3d_renderer.h",
370 ]
371 if (!is_linux && !is_mac && !is_win) {
372 sources += [ "null_platform_renderer.cc" ]
373 }
374 if (is_linux || is_mac) {
375 sources += [
376 "gl/gl_renderer.cc",
377 "gl/gl_renderer.h",
378 ]
379 }
380
381 if (is_linux) {
382 libs += [
383 "Xext",
384 "X11",
385 "GL",
386 ]
387 }
388 if (is_android) {
389 libs += [
390 "GLESv2",
391 "log",
392 ]
393 }
394 if (is_mac) {
395 libs = [
396 "Cocoa.framework",
397 "OpenGL.framework",
398 "CoreVideo.framework",
399 ]
400 }
401
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700402 public_configs = [ ":test_renderer_exported_config" ]
kjellander0f380d82016-06-01 04:48:26 -0700403
kjellandere40a7ee2016-10-16 23:56:12 -0700404 if (!build_with_chromium && is_clang) {
405 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700406 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander0f380d82016-06-01 04:48:26 -0700407 }
408
409 deps = [
410 ":test_support",
411 ":video_test_common",
412 "../modules/media_file",
413 "//testing/gtest",
414 ]
415}