chromium/components/media_router/common/BUILD.gn

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

static_library("common") {
  sources = [
    # media_sink_internal needs to be included with Android due to typemapping.
    # Ideally, Android shouldn't be the case since it does not use Mojo for
    # Media Router.
    "discovery/media_sink_internal.cc",
    "discovery/media_sink_internal.h",
    "issue.cc",
    "issue.h",
    "media_route.cc",
    "media_route.h",
    "media_route_provider_helper.cc",
    "media_route_provider_helper.h",
    "media_sink.cc",
    "media_sink.h",
    "media_source.cc",
    "media_source.h",
    "route_request_result.cc",
    "route_request_result.h",
  ]

  public_deps = [
    "//base",
    "//base:i18n",
    "//media",
    "//net",
    "//third_party/icu",
    "//url",
  ]

  deps = [
    "mojom:media_route_provider_id",
    "mojom:route_request_result_code",
    "//components/media_router/common/providers/cast/channel:capability",
    "//third_party/blink/public:blink_headers",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  if (!is_android) {
    sources += [
      "discovery/media_sink_service_base.cc",
      "discovery/media_sink_service_base.h",
      "discovery/media_sink_service_util.cc",
      "discovery/media_sink_service_util.h",
      "pref_names.cc",
      "pref_names.h",
      "providers/cast/cast_media_source.cc",
      "providers/cast/cast_media_source.h",
    ]

    deps += [
      "//components/media_router/common/providers/cast/channel",
      "//third_party/openscreen/src/cast/common:public",
    ]
  }
}

static_library("test_support") {
  testonly = true
  sources = [
    "test/mock_logger.cc",
    "test/mock_logger.h",
    "test/test_helper.cc",
    "test/test_helper.h",
  ]
  deps = [
    "//base",
    "//base/test:test_support",
    "//components/media_router/common/mojom:logger",
    "//components/media_router/common/mojom:media_route_provider_id",
  ]
  public_deps = [ ":common" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "issue_unittest.cc",
    "media_route_unittest.cc",
    "media_sink_unittest.cc",
    "media_source_unittest.cc",
  ]

  deps = [
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//components/media_router/common/mojom:media_route_provider_id",
    "//testing/gmock",
    "//testing/gtest",
  ]

  if (!is_android) {
    sources += [
      "discovery/media_sink_internal_unittest.cc",
      "discovery/media_sink_service_base_unittest.cc",
      "mojom/media_router_mojom_traits_unittest.cc",
      "providers/cast/cast_media_source_unittest.cc",
    ]

    deps += [
      "//components/media_router/common/mojom:media_router_test_interfaces",
      "//components/media_router/common/providers/cast/certificate:unit_tests",
      "//components/media_router/common/providers/cast/channel",
      "//third_party/openscreen/src/cast/common:public",
    ]
  }
}