chromium/chromecast/cast_core/grpc/BUILD.gn

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

import("//third_party/cast_core/public/src/proto/proto.gni")

source_set("grpc") {
  sources = [
    "cancellable_reactor.h",
    "grpc_call.h",
    "grpc_call_options.cc",
    "grpc_call_options.h",
    "grpc_client_reactor.h",
    "grpc_handler.cc",
    "grpc_handler.h",
    "grpc_server.cc",
    "grpc_server.h",
    "grpc_server_reactor.h",
    "grpc_server_streaming_call.h",
    "grpc_server_streaming_handler.h",
    "grpc_status_or.cc",
    "grpc_status_or.h",
    "grpc_stub.h",
    "grpc_unary_call.h",
    "grpc_unary_handler.h",
    "server_reactor_tracker.cc",
    "server_reactor_tracker.h",
    "trackable_reactor.h",
  ]

  public_deps = [
    "//base",
    "//third_party/abseil-cpp:absl",
    "//third_party/grpc:grpc++",
  ]
}

source_set("status_matchers") {
  testonly = true

  sources = [
    "status_matchers.cc",
    "status_matchers.h",
  ]

  deps = [ "//testing/gmock" ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "grpc_server_streaming_test.cc",
    "grpc_server_test.cc",
    "grpc_status_or_test.cc",
    "grpc_unary_test.cc",
  ]

  deps = [
    ":grpc",
    ":test_service_proto_castcore",
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]
}

source_set("test_support") {
  testonly = true

  sources = [
    "test_utils.cc",
    "test_utils.h",
  ]

  deps = [
    ":grpc",
    "//base",
    "//testing/gmock",
    "//third_party/grpc:grpc++",
  ]

  public_deps = [ ":status_matchers" ]
}

cast_core_proto_library("test_service_messages_proto") {
  sources = [ "test_service_messages.proto" ]
}

cast_core_grpc_library("test_service_proto") {
  sources = [
    "test_service.proto",
    "test_service_extra.proto",
  ]

  deps = [ ":test_service_messages_proto" ]

  generate_castcore_stubs = true
}