# 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") } if (rtc_use_memcheck) { import("//tools-webrtc/valgrind/valgrind-webrtc.gni") } group("test") { testonly = true deps = [ ":field_trial", ":rtp_test_utils", ":test_common", ":test_main", ":test_renderer", ":test_support", ":test_support_unittests", ":video_test_common", ] } rtc_source_set("video_test_common") { 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", "vcm_capturer.cc", "vcm_capturer.h", "video_capturer.cc", "video_capturer.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 = [ "../common_video", "../media:rtc_media_base", "../modules/video_capture:video_capture_module", ] } 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", "../modules/rtp_rtcp", "//testing/gtest", ] } rtc_source_set("field_trial") { testonly = true sources = [ "field_trial.cc", "field_trial.h", ] deps = [ "..:webrtc_common", "../system_wrappers", "../system_wrappers:field_trial_default", ] } rtc_source_set("test_main") { testonly = true sources = [ "test_main.cc", ] public_deps = [ ":test_support", ] deps = [ ":field_trial", "../system_wrappers:metrics_default", "//testing/gmock", "//testing/gtest", "//third_party/gflags", ] } rtc_source_set("fileutils") { testonly = true sources = [ "testsupport/fileutils.cc", "testsupport/fileutils.h", ] if (is_ios) { sources += [ "testsupport/iosfileutils.mm" ] configs += [ "//build/config/compiler:enable_arc" ] } visibility = [ ":*" ] } rtc_source_set("video_test_support") { testonly = true sources = [ "testsupport/frame_reader.h", "testsupport/frame_writer.h", "testsupport/metrics/video_metrics.cc", "testsupport/metrics/video_metrics.h", "testsupport/mock/mock_frame_reader.h", "testsupport/mock/mock_frame_writer.h", "testsupport/y4m_frame_writer.cc", "testsupport/yuv_frame_reader.cc", "testsupport/yuv_frame_writer.cc", ] deps = [ "../base:rtc_base_approved", "../common_video", "../system_wrappers", "//testing/gmock", "//testing/gtest", "//third_party/gflags", ] public_deps = [ ":fileutils", ] 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 += [ "//webrtc/sdk:rtc_sdk_common_objc" ] } if (rtc_use_memcheck) { data = valgrind_webrtc_dependencies } } rtc_source_set("test_support") { testonly = true sources = [ "gmock.h", "gtest.h", "testsupport/isolated_output.cc", "testsupport/isolated_output.h", "testsupport/packet_reader.cc", "testsupport/packet_reader.h", "testsupport/perf_test.cc", "testsupport/perf_test.h", "testsupport/trace_to_stderr.cc", "testsupport/trace_to_stderr.h", "testsupport/unittest_utils.h", ] deps = [ "../base:gtest_prod", "../base:rtc_base_approved", "../common_video", "../system_wrappers", "//testing/gmock", "//testing/gtest", "//third_party/gflags", ] public_deps = [ ":fileutils", ] 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 += [ "//webrtc/sdk:rtc_sdk_common_objc" ] } if (rtc_use_memcheck) { data = valgrind_webrtc_dependencies } } rtc_source_set("run_test") { testonly = true sources = [ "run_test.h", ] if (is_mac) { sources += [ "mac/run_test.mm" ] } else { sources += [ "run_test.cc" ] } } 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 = [] sources = [ "fake_audio_device_unittest.cc", "fake_network_pipe_unittest.cc", "frame_generator_unittest.cc", "rtp_file_reader_unittest.cc", "rtp_file_writer_unittest.cc", "testsupport/always_passing_unittest.cc", "testsupport/isolated_output_unittest.cc", "testsupport/metrics/video_metrics_unittest.cc", "testsupport/packet_reader_unittest.cc", "testsupport/perf_test_unittest.cc", "testsupport/y4m_frame_writer_unittest.cc", "testsupport/yuv_frame_reader_unittest.cc", "testsupport/yuv_frame_writer_unittest.cc", ] # TODO(jschuh): Bug 1348: fix this warning. configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] if (is_win) { cflags = [ "/wd4373" ] # virtual override w/different const/volatile signature. } 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" ] } deps += [ ":direct_transport", ":fileutils_unittests", ":test_common", ":test_main", ":video_test_common", ":video_test_support", "../modules/video_capture", "//testing/gmock", "//testing/gtest", "//third_party/gflags", ] } rtc_source_set("fileutils_unittests") { testonly = true sources = [ "testsupport/fileutils_unittest.cc", ] deps = [ ":fileutils", "//testing/gmock", "//testing/gtest", ] } rtc_source_set("direct_transport") { testonly = true sources = [ "direct_transport.cc", "direct_transport.h", "fake_network_pipe.cc", "fake_network_pipe.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 = [ "../api:transport_api", "../base:rtc_base_approved", "../call", ] } rtc_source_set("fake_audio_device") { testonly = true sources = [ "fake_audio_device.cc", "fake_audio_device.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 = [ "../base:rtc_base_approved", "../modules/audio_device:audio_device", ] } rtc_source_set("test_common") { testonly = true sources = [ "call_test.cc", "call_test.h", "configurable_frame_size_encoder.cc", "configurable_frame_size_encoder.h", "constants.cc", "constants.h", "drifting_clock.cc", "drifting_clock.h", "encoder_settings.cc", "encoder_settings.h", "fake_decoder.cc", "fake_decoder.h", "fake_encoder.cc", "fake_encoder.h", "fake_videorenderer.h", "layer_filtering_transport.cc", "layer_filtering_transport.h", "mock_transport.h", "mock_voe_channel_proxy.h", "mock_voice_engine.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_audio_device", ":rtp_test_utils", ":test_support", ":video_test_common", "..:webrtc_common", "../audio", "../base:rtc_base_approved", "../call", "../modules/audio_mixer:audio_mixer_impl", "../modules/audio_processing", "../video", "//testing/gmock", "//testing/gtest", ] if (!is_android) { deps += [ "../modules/video_capture:video_capture_internal_impl" ] } } config("test_renderer_exported_config") { if (is_win && is_clang) { # GN orders flags on a target before flags from configs. The default config # adds -Wall, and this flag have to be after -Wall -- so they need to # come from a config and cannot be on the target directly. cflags = [ "-Wno-bool-conversion", "-Wno-comment", "-Wno-delete-non-virtual-dtor", ] } } rtc_source_set("test_renderer") { testonly = true libs = [] sources = [ "linux/glx_renderer.cc", "linux/glx_renderer.h", "linux/video_renderer_linux.cc", "mac/video_renderer_mac.h", "mac/video_renderer_mac.mm", "video_renderer.cc", "video_renderer.h", "win/d3d_renderer.cc", "win/d3d_renderer.h", ] if (!is_linux && !is_mac && !is_win) { sources += [ "null_platform_renderer.cc" ] } if (is_linux || is_mac) { sources += [ "gl/gl_renderer.cc", "gl/gl_renderer.h", ] } if (is_linux) { libs += [ "Xext", "X11", "GL", ] } if (is_android) { libs += [ "GLESv2", "log", ] } if (is_mac) { libs = [ "Cocoa.framework", "OpenGL.framework", "CoreVideo.framework", ] } public_configs = [ ":test_renderer_exported_config" ] 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 = [ ":test_support", "../modules/media_file", "//testing/gtest", ] }