chromium/components/media_router/browser/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.

source_set("browser") {
  sources = [
    "media_router.h",
    "media_router_base.cc",
    "media_router_base.h",
    "media_router_dialog_controller.cc",
    "media_router_dialog_controller.h",
    "media_router_factory.cc",
    "media_router_factory.h",
    "media_router_metrics.cc",
    "media_router_metrics.h",
    "media_routes_observer.cc",
    "media_routes_observer.h",
    "media_sinks_observer.cc",
    "media_sinks_observer.h",
    "mirroring_media_controller_host.h",
    "mirroring_media_controller_host_impl.cc",
    "mirroring_media_controller_host_impl.h",
    "presentation/browser_presentation_connection_proxy.cc",
    "presentation/browser_presentation_connection_proxy.h",
    "presentation/local_presentation_manager.cc",
    "presentation/local_presentation_manager.h",
    "presentation/local_presentation_manager_factory.cc",
    "presentation/local_presentation_manager_factory.h",
    "presentation/presentation_media_sinks_observer.cc",
    "presentation/presentation_media_sinks_observer.h",
    "presentation/presentation_service_delegate_impl.cc",
    "presentation/presentation_service_delegate_impl.h",
    "presentation/presentation_service_delegate_observers.cc",
    "presentation/presentation_service_delegate_observers.h",
    "presentation/receiver_presentation_service_delegate_impl.cc",
    "presentation/receiver_presentation_service_delegate_impl.h",
    "presentation/start_presentation_context.cc",
    "presentation/start_presentation_context.h",
    "presentation/web_contents_presentation_manager.cc",
    "presentation/web_contents_presentation_manager.h",
    "presentation_connection_message_observer.cc",
    "presentation_connection_message_observer.h",
    "route_message_util.cc",
    "route_message_util.h",
  ]

  deps = [
    "//base",
    "//components/keyed_service/content",
    "//components/keyed_service/core",
    "//components/media_router/common/providers/cast/channel",
    "//components/prefs",
    "//components/sessions",
    "//components/user_prefs",
    "//content/public/browser",
    "//content/public/common",
    "//crypto",
    "//net",
    "//net/traffic_annotation",
    "//services/network:network_service",
    "//services/network/public/mojom",
    "//third_party/icu",
    "//url",
  ]
  public_deps = [
    "//components/media_router/common",
    "//components/media_router/common/mojom:media_router",
  ]
  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  if (is_android) {
    sources += [
      "android/flinging_controller_bridge.cc",
      "android/flinging_controller_bridge.h",
      "android/media_router_android.cc",
      "android/media_router_android.h",
      "android/media_router_android_bridge.cc",
      "android/media_router_android_bridge.h",
      "android/media_router_dialog_controller_android.cc",
      "android/media_router_dialog_controller_android.h",
    ]
    deps += [ "android:jni_headers" ]
  } else {
    sources += [
      "issue_manager.cc",
      "issue_manager.h",
      "issues_observer.cc",
      "issues_observer.h",
      "log_util.cc",
      "log_util.h",
      "logger_impl.cc",
      "logger_impl.h",
      "media_router_debugger.h",
      "mirroring_to_flinging_switcher.cc",
      "mirroring_to_flinging_switcher.h",
      "presentation/presentation_navigation_policy.cc",
      "presentation/presentation_navigation_policy.h",
    ]
  }
}

source_set("test_support") {
  testonly = true
  sources = [
    "test/mock_media_router.cc",
    "test/mock_media_router.h",
    "test/mock_screen_availability_listener.cc",
    "test/mock_screen_availability_listener.h",
    "test/test_helper.cc",
    "test/test_helper.h",
  ]
  deps = [
    "//base/test:test_support",
    "//content/public/browser",
    "//testing/gmock",
  ]
  public_deps = [ ":browser" ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "media_router_base_unittest.cc",
    "media_router_dialog_controller_unittest.cc",
    "media_router_factory_unittest.cc",
    "media_router_metrics_unittest.cc",
    "media_sinks_observer_unittest.cc",
    "mirroring_media_controller_host_impl_unittest.cc",
    "presentation/browser_presentation_connection_proxy_unittest.cc",
    "presentation/local_presentation_manager_unittest.cc",
    "presentation/presentation_media_sinks_observer_unittest.cc",
  ]

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

  if (is_android) {
    sources += [ "android/media_router_android_unittest.cc" ]
    deps += [ "android:test_jni_headers" ]
  } else {
    sources += [
      "issue_manager_unittest.cc",
      "logger_impl_unittest.cc",
      "mirroring_to_flinging_switcher_unittest.cc",
    ]
  }
}