chromium/chromecast/bindings/BUILD.gn

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

import("//tools/grit/grit_rule.gni")

if (is_fuchsia) {
  import("//build/config/fuchsia/generate_runner_scripts.gni")
}

# TODO(crbug.com/40139651): Deprecated. Delete after off-tree clients
# are migrated to use NamedMessagePortConnector directly.
source_set("named_message_port_connector_resources") {
  data_deps = [ ":bindings_resources" ]
  deps = [ ":bindings_resources" ]
}

# TODO(crbug.com/40139651): Deprecated. Delete after off-tree clients
# are migrated to use NamedMessagePortConnector directly.
grit("bindings_resources") {
  source = "bindings_resources.grd"
  outputs = [
    "grit/resources.h",
    "bindings_resources.pak",
  ]
  resource_ids = ""
}

# Transitional target for //components/cast_api_bindings/bindings_manager.
# TODO(crbug.com/40139651): Remove this and replace platform-specific
# subclasses with cross-platform implementation.
source_set("bindings_manager") {
  sources = [ "bindings_manager.h" ]
  deps = [ "//components/cast/api_bindings:manager" ]
}

if (is_fuchsia) {
  source_set("bindings_manager_fuchsia") {
    sources = [
      "bindings_manager_fuchsia.cc",
      "bindings_manager_fuchsia.h",
    ]
    public_deps = [
      ":bindings_manager",
      "//fuchsia_web/runners/cast/fidl:fidl_hlcpp",
      "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.mem:fuchsia.mem_hlcpp",
    ]
    deps = [
      "//base",
      "//components/cast/message_port",
    ]
  }
}

if (is_linux || is_chromeos || is_android) {
  source_set("bindings_manager_cast") {
    sources = [
      "bindings_manager_cast.cc",
      "bindings_manager_cast.h",
    ]

    deps = [
      ":bindings_manager",
      "//base",
      "//chromecast/bindings/public/mojom",
      "//components/cast/api_bindings:manager",
      "//components/cast/message_port:message_port_cast",
      "//mojo/public/cpp/bindings",
      "//third_party/blink/public/common",
    ]
  }

  source_set("browsertests_cast") {
    testonly = true

    sources = [ "bindings_manager_cast_browsertest.cc" ]

    defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

    data = [ "//chromecast/bindings/testdata" ]

    deps = [
      "//base",
      "//chromecast:chromecast_buildflags",
      "//chromecast/base",
      "//chromecast/base:chromecast_switches",
      "//chromecast/bindings:bindings_manager_cast",
      "//chromecast/browser:browser",
      "//chromecast/browser:client",
      "//chromecast/browser:public",
      "//components/cast/message_port:test_message_port_receiver",
      "//components/cast/named_message_port_connector:resources",
      "//content/public/browser",
      "//content/test:test_support",
      "//net:test_support",
    ]
  }
}

source_set("browsertests") {
  testonly = true
  deps = []
  if (is_linux || is_chromeos || is_android) {
    deps += [ "//chromecast/bindings:browsertests_cast" ]
  }
}