chromium/components/webrtc/BUILD.gn

# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/features.gni")

if (is_android) {
  import("//build/config/android/rules.gni")
}

if (use_blink) {
  source_set("media_stream_device_enumerator") {
    sources = [
      "media_stream_device_enumerator.h",
      "media_stream_device_enumerator_impl.cc",
      "media_stream_device_enumerator_impl.h",
      "media_stream_devices_util.cc",
      "media_stream_devices_util.h",
    ]

    deps = [
      "//base",
      "//content/public/browser",
      "//third_party/blink/public/common",
    ]
  }

  source_set("webrtc") {
    sources = [
      "media_stream_devices_controller.cc",
      "media_stream_devices_controller.h",
    ]

    public_deps = [ ":media_stream_device_enumerator" ]

    deps = [
      "//base",
      "//components/content_settings/core/common",
      "//components/permissions",
      "//content/public/browser",
      "//third_party/blink/public/common",
    ]
    if (is_android) {
      deps += [ "//ui/android" ]
    }
  }
}

source_set("fake_ssl_socket") {
  visibility = [
    ":*",
    "//services/network:*",
  ]
  sources = [
    "fake_ssl_client_socket.cc",
    "fake_ssl_client_socket.h",
  ]
  public_deps = [
    "//base",
    "//net",
    "//net/traffic_annotation",
  ]
}

source_set("net_address_utils") {
  sources = [
    "net_address_utils.cc",
    "net_address_utils.h",
  ]
  public_deps = [
    "//base",
    "//net",
    "//third_party/webrtc_overrides:webrtc_component",
  ]
}

source_set("thread_wrapper") {
  sources = [
    "thread_wrapper.cc",
    "thread_wrapper.h",
  ]
  public_deps = [
    "//base",
    "//third_party/webrtc_overrides:webrtc_component",
  ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "fake_ssl_client_socket_unittest.cc",
    "thread_wrapper_unittest.cc",
  ]

  deps = [
    ":fake_ssl_socket",
    ":thread_wrapper",
    "//base/test:test_support",
    "//net:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/webrtc/api/task_queue:task_queue_test",
    "//third_party/webrtc_overrides:metronome_like_task_queue_test",
  ]

  # Only include this test on blink platforms because dependency on
  # //content/test:test_support requires it.
  if (use_blink) {
    sources += [
      "media_stream_devices_controller_unittest.cc",
      "media_stream_devices_util_unittest.cc",
    ]

    deps += [
      ":webrtc",
      "//content/test:test_support",
    ]

    if (is_android) {
      deps += [ "//ui/android:android" ]
    }
  }
}