chromium/remoting/protocol/BUILD.gn

# Copyright 2014 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")
import("//media/media_options.gni")
import("//remoting/remoting_options.gni")

source_set("errors") {
  sources = [ "errors.h" ]
  deps = [ "//remoting/base:errors" ]
}

static_library("transport") {
  sources = [
    "transport.cc",
    "transport.h",
  ]
  deps = [
    ":errors",
    "//base",
    "//net",
    "//remoting/base:base",
  ]
}

static_library("protocol") {
  sources = [
    "audio_decode_scheduler.cc",
    "audio_decode_scheduler.h",
    "audio_reader.cc",
    "audio_reader.h",
    "audio_stub.h",
    "auth_util.cc",
    "auth_util.h",
    "authenticator.cc",
    "authenticator.h",
    "capability_names.h",
    "channel_authenticator.h",
    "channel_dispatcher_base.cc",
    "channel_dispatcher_base.h",
    "channel_multiplexer.cc",
    "channel_multiplexer.h",
    "channel_socket_adapter.cc",
    "channel_socket_adapter.h",
    "chromium_port_allocator_factory.cc",
    "chromium_port_allocator_factory.h",
    "chromium_socket_factory.cc",
    "chromium_socket_factory.h",
    "client_authentication_config.cc",
    "client_authentication_config.h",
    "client_control_dispatcher.cc",
    "client_control_dispatcher.h",
    "client_event_dispatcher.cc",
    "client_event_dispatcher.h",
    "client_stub.h",
    "client_video_dispatcher.cc",
    "client_video_dispatcher.h",
    "client_video_stats_dispatcher.cc",
    "client_video_stats_dispatcher.h",
    "clipboard_echo_filter.cc",
    "clipboard_echo_filter.h",
    "clipboard_filter.cc",
    "clipboard_filter.h",
    "clipboard_stub.h",
    "clipboard_thread_proxy.cc",
    "clipboard_thread_proxy.h",
    "connection_to_client.h",
    "connection_to_host.cc",
    "connection_to_host.h",
    "content_description.cc",
    "content_description.h",
    "credentials_type.h",
    "data_channel_manager.cc",
    "data_channel_manager.h",
    "datagram_channel_factory.h",
    "desktop_capturer.cc",
    "desktop_capturer.h",
    "display_size.cc",
    "display_size.h",
    "file_transfer_helpers.cc",
    "file_transfer_helpers.h",
    "fractional_input_filter.cc",
    "fractional_input_filter.h",
    "frame_consumer.h",
    "frame_stats.cc",
    "frame_stats.h",
    "host_authentication_config.cc",
    "host_authentication_config.h",
    "host_control_dispatcher.cc",
    "host_control_dispatcher.h",
    "host_event_dispatcher.cc",
    "host_event_dispatcher.h",
    "host_stub.h",
    "host_video_dispatcher.cc",
    "host_video_dispatcher.h",
    "host_video_stats_dispatcher.cc",
    "host_video_stats_dispatcher.h",
    "ice_config.cc",
    "ice_config.h",
    "ice_config_request.h",
    "ice_connection_to_host.cc",
    "ice_connection_to_host.h",
    "ice_transport.cc",
    "ice_transport.h",
    "ice_transport_channel.cc",
    "ice_transport_channel.h",
    "input_event_timestamps.cc",
    "input_event_timestamps.h",
    "input_event_tracker.cc",
    "input_event_tracker.h",
    "input_filter.cc",
    "input_filter.h",
    "input_stub.h",
    "it2me_host_authenticator_factory.cc",
    "it2me_host_authenticator_factory.h",
    "jingle_messages.cc",
    "jingle_messages.h",
    "jingle_session.cc",
    "jingle_session.h",
    "jingle_session_manager.cc",
    "jingle_session_manager.h",
    "keyboard_layout_stub.h",
    "me2me_host_authenticator_factory.cc",
    "me2me_host_authenticator_factory.h",
    "message_decoder.cc",
    "message_decoder.h",
    "message_pipe.h",
    "message_reader.cc",
    "message_reader.h",
    "message_serialization.cc",
    "message_serialization.h",
    "monitored_video_stub.cc",
    "monitored_video_stub.h",
    "mouse_input_filter.cc",
    "mouse_input_filter.h",
    "named_message_pipe_handler.cc",
    "named_message_pipe_handler.h",
    "negotiating_authenticator_base.cc",
    "negotiating_authenticator_base.h",
    "negotiating_client_authenticator.cc",
    "negotiating_client_authenticator.h",
    "negotiating_host_authenticator.cc",
    "negotiating_host_authenticator.h",
    "network_settings.cc",
    "network_settings.h",
    "observing_input_filter.cc",
    "observing_input_filter.h",
    "p2p_datagram_socket.h",
    "p2p_stream_socket.h",
    "pairing_authenticator_base.cc",
    "pairing_authenticator_base.h",
    "pairing_client_authenticator.cc",
    "pairing_client_authenticator.h",
    "pairing_host_authenticator.cc",
    "pairing_host_authenticator.h",
    "pairing_registry.cc",
    "pairing_registry.h",
    "peer_connection_controls.h",
    "performance_tracker.cc",
    "performance_tracker.h",
    "port_allocator.cc",
    "port_allocator.h",
    "port_allocator_factory.cc",
    "port_allocator_factory.h",
    "pseudotcp_adapter.cc",
    "pseudotcp_adapter.h",
    "pseudotcp_channel_factory.cc",
    "pseudotcp_channel_factory.h",
    "rejecting_authenticator.cc",
    "rejecting_authenticator.h",
    "remoting_ice_config_request.cc",
    "remoting_ice_config_request.h",
    "sdp_message.cc",
    "sdp_message.h",
    "secure_channel_factory.cc",
    "secure_channel_factory.h",
    "session.h",
    "session_authz_authenticator.cc",
    "session_authz_authenticator.h",
    "session_authz_reauthorizer.cc",
    "session_authz_reauthorizer.h",
    "session_manager.h",
    "session_observer.h",
    "session_options_provider.h",
    "session_plugin.h",
    "socket_util.cc",
    "socket_util.h",
    "spake2_authenticator.cc",
    "spake2_authenticator.h",
    "ssl_hmac_channel_authenticator.cc",
    "ssl_hmac_channel_authenticator.h",
    "stream_channel_factory.h",
    "stream_message_pipe_adapter.cc",
    "stream_message_pipe_adapter.h",
    "stream_packet_processor.h",
    "stream_packet_socket.cc",
    "stream_packet_socket.h",
    "stun_tcp_packet_processor.cc",
    "stun_tcp_packet_processor.h",
    "transport_context.cc",
    "transport_context.h",
    "validating_authenticator.cc",
    "validating_authenticator.h",
    "video_channel_state_observer.h",
    "video_renderer.h",
    "video_stats_stub.h",
    "video_stub.h",
    "webrtc_audio_module.cc",
    "webrtc_audio_module.h",
    "webrtc_audio_sink_adapter.cc",
    "webrtc_audio_sink_adapter.h",
    "webrtc_connection_to_host.cc",
    "webrtc_connection_to_host.h",
    "webrtc_data_stream_adapter.cc",
    "webrtc_data_stream_adapter.h",
    "webrtc_event_log_data.cc",
    "webrtc_event_log_data.h",
    "webrtc_transport.cc",
    "webrtc_transport.h",
    "webrtc_video_renderer_adapter.cc",
    "webrtc_video_renderer_adapter.h",
  ]

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

  public_deps = [
    ":errors",
    ":session_config",
    ":transport",
    "//remoting/proto",
    "//third_party/webrtc_overrides:webrtc_component",
  ]
  deps = [
    "//base",
    "//build:chromeos_buildflags",
    "//components/webrtc:net_address_utils",
    "//components/webrtc:thread_wrapper",
    "//crypto",
    "//google_apis:google_apis",
    "//net",
    "//remoting/base",
    "//remoting/base:authorization",
    "//remoting/base:logging",
    "//remoting/base:name_value_map",
    "//remoting/base:session_policies",
    "//remoting/codec:decoder",
    "//remoting/proto:internal_structs",
    "//remoting/proto/remoting/v1:network_traversal_proto",
    "//remoting/signaling",
    "//services/network/public/cpp:cpp",
    "//third_party/abseil-cpp:absl",
    "//third_party/boringssl",
    "//third_party/libyuv",
    "//third_party/webrtc_overrides:webrtc_component",
    "//ui/events:dom_keycode_converter",
  ]

  defines = []

  # Must be a subset of the platforms built in //remoting/codec/BUILD.gn
  if (remoting_enable_h264 && is_win) {
    defines += [ "USE_H264_ENCODER" ]
    deps += [
      "//media",
      "//skia",
    ]
  }

  if (enable_remoting_host) {
    sources += [
      "audio_pump.cc",
      "audio_pump.h",
      "audio_writer.cc",
      "audio_writer.h",
      "capture_scheduler.cc",
      "capture_scheduler.h",
      "ice_connection_to_client.cc",
      "ice_connection_to_client.h",
      "no_op_webrtc_frame_scheduler.cc",
      "no_op_webrtc_frame_scheduler.h",
      "video_frame_pump.cc",
      "video_frame_pump.h",
      "video_stream_event_router.cc",
      "video_stream_event_router.h",
      "webrtc_audio_source_adapter.cc",
      "webrtc_audio_source_adapter.h",
      "webrtc_audio_stream.cc",
      "webrtc_audio_stream.h",
      "webrtc_connection_to_client.cc",
      "webrtc_connection_to_client.h",
      "webrtc_frame_scheduler.h",
      "webrtc_frame_scheduler_constant_rate.cc",
      "webrtc_frame_scheduler_constant_rate.h",
      "webrtc_video_encoder_factory.cc",
      "webrtc_video_encoder_factory.h",
      "webrtc_video_encoder_wrapper.cc",
      "webrtc_video_encoder_wrapper.h",
      "webrtc_video_frame_adapter.cc",
      "webrtc_video_frame_adapter.h",
      "webrtc_video_stream.cc",
      "webrtc_video_stream.h",
      "webrtc_video_track_source.cc",
      "webrtc_video_track_source.h",
    ]

    deps += [
      "//media:media",
      "//media:shared_memory_support",
      "//remoting/codec:encoder",
    ]
  }
}

static_library("session_config") {
  sources = [
    "session_config.cc",
    "session_config.h",
  ]

  deps = [ "//base" ]
}

static_library("test_support") {
  testonly = true

  sources = [
    "fake_authenticator.cc",
    "fake_authenticator.h",
    "fake_connection_to_host.cc",
    "fake_connection_to_host.h",
    "fake_datagram_socket.cc",
    "fake_datagram_socket.h",
    "fake_message_pipe.cc",
    "fake_message_pipe.h",
    "fake_message_pipe_wrapper.cc",
    "fake_message_pipe_wrapper.h",
    "fake_session.cc",
    "fake_session.h",
    "fake_stream_socket.cc",
    "fake_stream_socket.h",
    "fake_video_renderer.cc",
    "fake_video_renderer.h",
    "protocol_mock_objects.cc",
    "protocol_mock_objects.h",
  ]

  if (enable_remoting_host) {
    sources += [
      "fake_audio_source.cc",
      "fake_audio_source.h",
      "fake_connection_to_client.cc",
      "fake_connection_to_client.h",
      "fake_desktop_capturer.cc",
      "fake_desktop_capturer.h",
    ]
  }

  public_deps = [
    ":protocol",
    "//testing/gmock",
  ]

  deps = [
    "//base:base",
    "//net:net",
    "//net/traffic_annotation:test_support",
    "//net/traffic_annotation:traffic_annotation",
    "//remoting/base:base",
    "//remoting/codec:encoder",
    "//remoting/signaling:signaling",
    "//testing/gtest:gtest",
    "//third_party/libjingle_xmpp:rtc_xmllite",
  ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "audio_decode_scheduler_unittest.cc",
    "authenticator_test_base.cc",
    "authenticator_test_base.h",
    "channel_multiplexer_unittest.cc",
    "channel_socket_adapter_unittest.cc",
    "chromium_socket_factory_unittest.cc",
    "client_video_dispatcher_unittest.cc",
    "clipboard_echo_filter_unittest.cc",
    "clipboard_filter_unittest.cc",
    "connection_tester.cc",
    "connection_tester.h",
    "content_description_unittest.cc",
    "data_channel_manager_unittest.cc",
    "fractional_input_filter_unittest.cc",
    "frame_stats_unittest.cc",
    "ice_config_unittest.cc",
    "ice_transport_unittest.cc",
    "input_event_tracker_unittest.cc",
    "input_filter_unittest.cc",
    "jingle_messages_unittest.cc",
    "jingle_session_unittest.cc",
    "message_decoder_unittest.cc",
    "message_reader_unittest.cc",
    "monitored_video_stub_unittest.cc",
    "mouse_input_filter_unittest.cc",
    "negotiating_authenticator_unittest.cc",
    "network_settings_unittest.cc",
    "pairing_registry_unittest.cc",
    "pseudotcp_adapter_unittest.cc",
    "remoting_ice_config_request_unittest.cc",
    "sdp_message_unittest.cc",
    "session_authz_authenticator_unittest.cc",
    "session_authz_reauthorizer_unittest.cc",
    "session_config_unittest.cc",
    "spake2_authenticator_unittest.cc",
    "ssl_hmac_channel_authenticator_unittest.cc",
    "validating_authenticator_unittest.cc",
    "webrtc_event_log_data_unittest.cc",
  ]

  if (enable_remoting_host) {
    sources += [
      "audio_pump_unittest.cc",
      "capture_scheduler_unittest.cc",
      "connection_unittest.cc",
      "video_frame_pump_unittest.cc",
      "webrtc_audio_source_adapter_unittest.cc",
      "webrtc_frame_scheduler_unittest.cc",
      "webrtc_transport_unittest.cc",
      "webrtc_video_encoder_wrapper_unittest.cc",
      "webrtc_video_frame_adapter_unittest.cc",
      "webrtc_video_track_source_unittest.cc",
    ]
  }

  deps = [
    ":test_support",
    "//components/webrtc:thread_wrapper",
    "//net:test_support",
    "//remoting/base:base",
    "//remoting/base:session_policies",
    "//remoting/base:test_support",
    "//remoting/codec:encoder",
    "//remoting/proto:internal_structs",
    "//remoting/proto/remoting/v1:network_traversal_proto",
    "//remoting/signaling:test_support",
    "//services/network/public/cpp:cpp",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/libjingle_xmpp:rtc_xmllite",
  ]
}