# 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",
    ]
  }
}

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" ]
  }

  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",
      ":fileutils",
      ":perf_test",
      ":rtp_test_utils",
      ":test_main",
      ":test_support",
      ":test_support_test_artifacts",
      ":video_test_common",
      ":video_test_support",
      "../api/video:video_frame_i420",
      "../modules/rtp_rtcp:rtp_rtcp",
      "../rtc_base:rtc_base_approved",
      "../test:single_threaded_task_queue",
      "//testing/gtest",
      "//third_party/abseil-cpp/absl/memory",
    ]
    sources = [
      "direct_transport_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("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_proxy_factory.h",
    "encoder_settings.cc",
    "encoder_settings.h",
    "fake_decoder.cc",
    "fake_decoder.h",
    "fake_encoder.cc",
    "fake_encoder.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",
    ":fileutils",
    ":rtp_test_utils",
    ":test_support",
    ":video_test_common",
    "..:webrtc_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:video_frame_i420",
    "../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",
    "../common_video",
    "../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_codec_interface",
    "../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:rtc_task_queue",
    "../rtc_base:sequenced_task_checker",
    "../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",
    ]
  }
}
