naiveproxy/third_party/webrtc/test/BUILD.gn

759 lines
18 KiB
Plaintext
Raw Normal View History

2018-12-10 05:59:24 +03:00
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("../webrtc.gni")
import("//build/config/ui.gni")
if (is_android) {
import("//build/config/android/rules.gni")
}
group("test") {
testonly = true
deps = [
":field_trial",
":rtp_test_utils",
":test_common",
":test_renderer",
":test_support",
":video_test_common",
]
if (rtc_include_tests) {
deps += [
":test_main",
":test_support_unittests",
]
}
}
rtc_source_set("video_test_common") {
visibility = [ "*" ]
testonly = true
sources = [
"fake_texture_frame.cc",
"fake_texture_frame.h",
"frame_generator.cc",
"frame_generator.h",
"frame_generator_capturer.cc",
"frame_generator_capturer.h",
"frame_utils.cc",
"frame_utils.h",
"test_video_capturer.cc",
"test_video_capturer.h",
"vcm_capturer.cc",
"vcm_capturer.h",
"video_codec_settings.h",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"..:webrtc_common",
"../api:libjingle_peerconnection_api",
"../api/video:video_frame",
"../api/video:video_frame_i010",
"../api/video:video_frame_i420",
"../api/video_codecs:video_codecs_api",
"../call:video_stream_api",
"../common_video",
"../media:rtc_media_base",
"../modules/video_capture:video_capture_module",
"../rtc_base:checks",
"../rtc_base:rtc_base",
"../rtc_base:rtc_task_queue",
"../system_wrappers",
"//third_party/abseil-cpp/absl/types:optional",
]
}
rtc_source_set("rtp_test_utils") {
testonly = true
sources = [
"rtcp_packet_parser.cc",
"rtcp_packet_parser.h",
"rtp_file_reader.cc",
"rtp_file_reader.h",
"rtp_file_writer.cc",
"rtp_file_writer.h",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"..:webrtc_common",
"../api:array_view",
"../modules/rtp_rtcp",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../rtc_base/system:arch",
"//testing/gtest",
]
}
rtc_source_set("field_trial") {
visibility = [ "*" ]
testonly = true
sources = [
"field_trial.cc",
"field_trial.h",
]
deps = [
"..:webrtc_common",
"../system_wrappers:field_trial_api",
"../system_wrappers:field_trial_default",
]
}
rtc_source_set("perf_test") {
visibility = [ "*" ]
sources = [
"testsupport/perf_test.cc",
"testsupport/perf_test.h",
]
deps = [
"..:webrtc_common",
"../api:array_view",
"../rtc_base:rtc_base_approved",
]
}
if (is_ios) {
rtc_source_set("test_support_objc") {
testonly = true
visibility = [ ":test_support" ]
sources = [
"ios/test_support.h",
"ios/test_support.mm",
]
deps = [
":perf_test",
"../sdk:common_objc",
]
}
}
config("suppress_warning_4373") {
if (is_win) {
cflags = [
# MSVC has a bug which generates this warning when using mocks; see the
# section on warning 4373 in he googlemock FAQ. This warning isn't the
# least relevant for us, anyway.
"/wd4373",
]
}
}
config("test_main_direct_config") {
visibility = [ ":*" ]
defines = [ "UNIT_TEST" ]
}
rtc_source_set("test_support") {
visibility = [ "*" ]
testonly = true
all_dependent_configs = [
":suppress_warning_4373",
"//third_party/googletest:gmock_config",
"//third_party/googletest:gtest_config",
]
sources = [
"gmock.h",
"gtest.h",
]
public_deps = []
if (is_ios) {
public_deps += [ ":test_support_objc" ]
}
public_configs = [ ":test_main_direct_config" ]
deps = [
"../rtc_base:rtc_base_approved",
"//testing/gmock",
"//testing/gtest",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
if (is_ios && !build_with_chromium) {
deps += [ "../sdk:common_objc" ]
}
}
if (rtc_include_tests) {
rtc_source_set("test_main") {
visibility = [ "*" ]
testonly = true
sources = [
"test_main.cc",
]
public_deps = [
":test_support",
]
deps = [
":field_trial",
":fileutils",
":perf_test",
"../rtc_base:rtc_base_approved",
"../system_wrappers:field_trial_default",
"../system_wrappers:metrics_default",
"../system_wrappers:runtime_enabled_features_default",
"//testing/gtest",
]
}
rtc_source_set("video_test_support") {
testonly = true
sources = [
"testsupport/frame_reader.h",
"testsupport/frame_writer.h",
"testsupport/mock/mock_frame_reader.h",
"testsupport/y4m_frame_writer.cc",
"testsupport/yuv_frame_reader.cc",
"testsupport/yuv_frame_writer.cc",
]
deps = [
":fileutils",
":test_support",
":video_test_common",
"..:webrtc_common",
"../api/video:video_frame",
"../api/video:video_frame_i420",
"../common_video",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../system_wrappers",
"//testing/gtest",
"//third_party/libyuv",
]
if (!is_ios) {
deps += [ "//third_party:jpeg" ]
sources += [ "testsupport/jpeg_frame_writer.cc" ]
} else {
sources += [ "testsupport/jpeg_frame_writer_ios.cc" ]
}
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
if (is_android) {
deps += [ "//base:base" ]
}
if (is_ios) {
deps += [ "../sdk:common_objc" ]
}
}
rtc_source_set("test_support_test_artifacts") {
testonly = true
sources = [
"testsupport/test_artifacts.cc",
"testsupport/test_artifacts.h",
]
deps = [
":fileutils",
"../rtc_base:rtc_base_approved",
]
}
test_support_unittests_resources = [
"../resources/foreman_cif_short.yuv",
"../resources/video_coding/frame-ethernet-ii.pcap",
"../resources/video_coding/frame-loopback.pcap",
"../resources/video_coding/pltype103.rtp",
"../resources/video_coding/pltype103_header_only.rtp",
"../resources/video_coding/ssrcs-2.pcap",
"../resources/video_coding/ssrcs-3.pcap",
]
if (is_ios) {
bundle_data("test_support_unittests_bundle_data") {
testonly = true
sources = test_support_unittests_resources
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
}
}
rtc_test("test_support_unittests") {
deps = [
":direct_transport",
":fake_video_codecs",
":fileutils",
":fileutils_unittests",
":perf_test",
":rtp_test_utils",
":test_common",
":test_main",
":test_support",
":test_support_test_artifacts",
":video_test_common",
":video_test_support",
"../api:create_simulcast_test_fixture_api",
"../api:simulcast_test_fixture_api",
"../api/video:video_frame_i420",
"../modules/rtp_rtcp:rtp_rtcp",
"../modules/video_capture",
"../modules/video_coding:simulcast_test_fixture_impl",
"../rtc_base:rtc_base_approved",
"../test:single_threaded_task_queue",
"//testing/gmock",
"//testing/gtest",
"//third_party/abseil-cpp/absl/memory",
]
sources = [
"direct_transport_unittest.cc",
"fake_vp8_encoder_unittest.cc",
"frame_generator_unittest.cc",
"rtp_file_reader_unittest.cc",
"rtp_file_writer_unittest.cc",
"single_threaded_task_queue_unittest.cc",
"testsupport/always_passing_unittest.cc",
"testsupport/perf_test_unittest.cc",
"testsupport/test_artifacts_unittest.cc",
"testsupport/y4m_frame_writer_unittest.cc",
"testsupport/yuv_frame_reader_unittest.cc",
"testsupport/yuv_frame_writer_unittest.cc",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
data = test_support_unittests_resources
if (is_android) {
deps += [ "//testing/android/native_test:native_test_support" ]
shard_timeout = 900
}
if (is_ios) {
deps += [ ":test_support_unittests_bundle_data" ]
}
if (!is_android && !build_with_chromium) {
# This is needed in order to avoid:
# undefined symbol: webrtc::videocapturemodule::VideoCaptureImpl::Create
deps += [ "../modules/video_capture:video_capture_internal_impl" ]
}
}
}
if (is_ios) {
rtc_source_set("fileutils_objc") {
visibility = [ ":fileutils" ]
sources = [
"testsupport/iosfileutils.mm",
]
deps = [
"..:webrtc_common",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../sdk:common_objc",
]
}
}
rtc_source_set("fileutils") {
testonly = true
visibility = [ "*" ]
sources = [
"testsupport/fileutils.cc",
"testsupport/fileutils.h",
]
deps = [
"..:webrtc_common",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../rtc_base/system:arch",
"//third_party/abseil-cpp/absl/types:optional",
]
if (is_ios) {
deps += [ ":fileutils_objc" ]
}
if (is_win) {
deps += [ "../rtc_base:rtc_base" ]
}
}
rtc_source_set("run_test") {
testonly = true
if (is_mac) {
public_deps = [
":run_test_objc",
]
} else {
public_deps = [
":run_test_generic",
]
}
}
rtc_source_set("run_test_interface") {
sources = [
"run_test.h",
]
}
if (is_mac) {
rtc_source_set("run_test_objc") {
testonly = true
visibility = [ ":run_test" ]
sources = [
"mac/run_test.mm",
]
deps = [
":run_test_interface",
]
}
}
rtc_source_set("run_test_generic") {
testonly = true
visibility = [ ":run_test" ]
sources = [
"run_test.cc",
]
deps = [
":run_test_interface",
]
}
rtc_source_set("fileutils_unittests") {
testonly = true
visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [
"testsupport/fileutils_unittest.cc",
]
deps = [
":fileutils",
":test_support",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"//testing/gtest",
"//third_party/abseil-cpp/absl/types:optional",
]
}
rtc_source_set("direct_transport") {
visibility = [ "*" ]
testonly = true
sources = [
"direct_transport.cc",
"direct_transport.h",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"..:webrtc_common",
"../api:simulated_network_api",
"../api:transport_api",
"../call:call_interfaces",
"../call:simulated_packet_receiver",
"../modules/rtp_rtcp",
"../rtc_base:rtc_base_approved",
"../rtc_base:sequenced_task_checker",
"../system_wrappers",
"//third_party/abseil-cpp/absl/memory",
]
public_deps = [
":single_threaded_task_queue",
"../call:fake_network",
]
}
rtc_source_set("single_threaded_task_queue") {
testonly = true
sources = [
"single_threaded_task_queue.cc",
"single_threaded_task_queue.h",
]
deps = [
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"//third_party/abseil-cpp/absl/memory",
]
}
rtc_source_set("fake_video_codecs") {
testonly = true
visibility = [ "*" ]
sources = [
"configurable_frame_size_encoder.cc",
"configurable_frame_size_encoder.h",
"fake_decoder.cc",
"fake_decoder.h",
"fake_encoder.cc",
"fake_encoder.h",
"fake_vp8_encoder.cc",
"fake_vp8_encoder.h",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"..:webrtc_common",
"../api/video:video_frame_i420",
"../api/video_codecs:video_codecs_api",
"../common_video:common_video",
"../modules/video_coding:video_codec_interface",
"../modules/video_coding:video_coding_utility",
"../modules/video_coding:webrtc_h264",
"../modules/video_coding:webrtc_vp8",
"../modules/video_coding:webrtc_vp9",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_task_queue",
"../rtc_base:sequenced_task_checker",
"../system_wrappers",
]
}
rtc_source_set("test_common") {
testonly = true
sources = [
"call_test.cc",
"call_test.h",
"constants.cc",
"constants.h",
"drifting_clock.cc",
"drifting_clock.h",
"encoder_proxy_factory.h",
"encoder_settings.cc",
"encoder_settings.h",
"fake_videorenderer.h",
"function_video_decoder_factory.h",
"function_video_encoder_factory.h",
"layer_filtering_transport.cc",
"layer_filtering_transport.h",
"mock_transport.cc",
"mock_transport.h",
"null_transport.cc",
"null_transport.h",
"rtp_rtcp_observer.h",
"statistics.cc",
"statistics.h",
"win/run_loop_win.cc",
]
if (!is_win) {
sources += [
"run_loop.cc",
"run_loop.h",
]
}
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
":direct_transport",
":fake_video_codecs",
":fileutils",
":rtp_test_utils",
":test_support",
":video_test_common",
"../api:libjingle_peerconnection_api",
"../api:simulated_network_api",
"../api:transport_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
"../api/audio_codecs:builtin_audio_encoder_factory",
"../api/video:video_frame",
"../api/video_codecs:video_codecs_api",
"../audio",
"../call",
"../call:call_interfaces",
"../call:fake_network",
"../call:rtp_sender",
"../call:simulated_network",
"../call:simulated_packet_receiver",
"../call:video_stream_api",
"../logging:rtc_event_log_api",
"../logging:rtc_event_log_impl_base",
"../media:rtc_internal_video_codecs",
"../media:rtc_media_base",
"../modules/audio_device",
"../modules/audio_device:audio_device_impl",
"../modules/audio_device:mock_audio_device",
"../modules/audio_mixer:audio_mixer_impl",
"../modules/audio_processing",
"../modules/congestion_controller/bbr",
"../modules/rtp_rtcp",
"../modules/rtp_rtcp:mock_rtp_rtcp",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../modules/video_coding:video_coding_utility",
"../modules/video_coding:webrtc_h264",
"../modules/video_coding:webrtc_multiplex",
"../modules/video_coding:webrtc_vp8",
"../modules/video_coding:webrtc_vp9",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../rtc_base/experiments:congestion_controller_experiment",
"../system_wrappers",
"../system_wrappers:field_trial_api",
"../system_wrappers:runtime_enabled_features_api",
"../video",
"//testing/gtest",
"//third_party/abseil-cpp/absl/memory",
]
if (!is_android && !build_with_chromium) {
deps += [ "../modules/video_capture:video_capture_internal_impl" ]
}
}
rtc_source_set("test_renderer") {
public_deps = [
":test_renderer_generic",
]
testonly = true
if (is_mac) {
public_deps += [ ":test_renderer_objc" ]
}
}
if (is_mac) {
rtc_source_set("test_renderer_objc") {
testonly = true
visibility = [ ":test_renderer" ]
sources = [
"mac/video_renderer_mac.h",
"mac/video_renderer_mac.mm",
]
deps = [
":test_renderer_generic",
"../rtc_base:rtc_base_approved",
]
libs = [
"Cocoa.framework",
"OpenGL.framework",
"CoreVideo.framework",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}
rtc_source_set("test_renderer_generic") {
testonly = true
visibility = [
":test_renderer",
":test_renderer_objc",
]
libs = []
sources = [
"video_renderer.cc",
"video_renderer.h",
"win/d3d_renderer.cc",
"win/d3d_renderer.h",
]
deps = [
":test_support",
"..:webrtc_common",
"../api/video:video_frame",
"../common_video",
"../media:rtc_media_base",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"//testing/gtest",
]
if (!(is_linux && rtc_use_x11) && !is_mac && !is_win) {
sources += [ "null_platform_renderer.cc" ]
}
if ((is_linux && rtc_use_x11) || is_mac) {
sources += [
"gl/gl_renderer.cc",
"gl/gl_renderer.h",
]
}
if (is_linux && rtc_use_x11) {
sources += [
"linux/glx_renderer.cc",
"linux/glx_renderer.h",
"linux/video_renderer_linux.cc",
]
libs += [
"Xext",
"X11",
"GL",
]
}
if (is_android) {
libs += [
"GLESv2",
"log",
]
}
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("audio_codec_mocks") {
testonly = true
sources = [
"mock_audio_decoder.cc",
"mock_audio_decoder.h",
"mock_audio_decoder_factory.h",
"mock_audio_encoder.cc",
"mock_audio_encoder.h",
"mock_audio_encoder_factory.h",
]
deps = [
":test_support",
"../api:array_view",
"../api/audio_codecs:audio_codecs_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
"../rtc_base:rtc_base_approved",
]
}
if (!build_with_chromium && is_android) {
rtc_android_library("native_test_java") {
testonly = true
java_files = [
"android/org/webrtc/native_test/RTCNativeUnitTest.java",
"android/org/webrtc/native_test/RTCNativeUnitTestActivity.java",
]
deps = [
"../rtc_base:base_java",
"//testing/android/native_test:native_test_java",
]
}
}