chromium/remoting/host/security_key/BUILD.gn

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

import("//remoting/build/config/remoting_build.gni")

source_set("security_key") {
  sources = [
    "security_key_auth_handler.h",
    "security_key_extension.cc",
    "security_key_extension.h",
    "security_key_extension_session.cc",
    "security_key_extension_session.h",
    "security_key_ipc_constants.cc",
    "security_key_ipc_constants.h",
    "security_key_message.cc",
    "security_key_message.h",
    "security_key_message_reader.h",
    "security_key_message_reader_impl.cc",
    "security_key_message_reader_impl.h",
    "security_key_message_writer.h",
    "security_key_message_writer_impl.cc",
    "security_key_message_writer_impl.h",
    "security_key_socket.cc",
    "security_key_socket.h",
  ]

  deps = [
    "//mojo/public/cpp/platform",
    "//mojo/public/cpp/system",
    "//net:net",
    "//net/traffic_annotation:traffic_annotation",
    "//remoting/base:logging",
    "//remoting/host:host_extension",
    "//remoting/host/mojom",
    "//remoting/proto",
    "//remoting/protocol:protocol",
    "//third_party/webrtc_overrides:webrtc_component",
  ]
  public_deps = [ "//remoting/host:common_headers" ]

  if (is_posix) {
    sources += [ "security_key_auth_handler_posix.cc" ]
  }

  if (is_win) {
    sources += [
      "security_key_auth_handler_win.cc",
      "security_key_ipc_client.cc",
      "security_key_ipc_client.h",
      "security_key_message_handler.cc",
      "security_key_message_handler.h",
    ]
    deps += [ "//remoting/host:chromoting_host_services_client" ]
  }
}

if (is_win) {
  source_set("main") {
    configs += [ "//remoting/build/config:host_implementation" ]

    sources = [ "remote_security_key_main.cc" ]
    deps = [
      ":remote_security_key_main_headers",
      ":security_key",
      "//base:debugging_buildflags",
      "//mojo/core/embedder",
      "//remoting/base",
      "//remoting/base:breakpad",
      "//remoting/host:chromoting_host_services_client",
      "//remoting/host:common",
      "//remoting/host/base",
      "//remoting/host/win:acl_util",
    ]
  }

  executable("remote_security_key") {
    configs += [ "//build/config/compiler:wexit_time_destructors" ]

    defines =
        host_predefines + [ "REMOTING_HOST_BINARY=BINARY_REMOTE_SECURITY_KEY" ]

    deps = [
      ":remote_security_key_main_headers",
      "//build/win:default_exe_manifest",
      "//remoting/host/win:remoting_core",
      "//remoting/host/win:remoting_windows_resources",
    ]

    sources = [
      "$root_gen_dir/remoting/version.rc",
      "remote_security_key_entry_point.cc",
    ]
  }

  source_set("remote_security_key_main_headers") {
    sources = [ "remote_security_key_main.h" ]
    deps = [ "//remoting/host:host_main_headers" ]
  }
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "security_key_extension_session_unittest.cc",
    "security_key_message_reader_impl_unittest.cc",
    "security_key_message_writer_impl_unittest.cc",
  ]

  public_deps = [ ":test_support" ]
  deps = [
    ":security_key",
    "//mojo/core/test:test_support",
    "//net:net",
    "//net:test_support",
    "//net/traffic_annotation:test_support",
    "//remoting:test_support",
    "//remoting/host:common",
    "//remoting/host:test_support",
    "//remoting/host/mojom",
    "//remoting/host/setup:common",
    "//remoting/protocol:protocol",
  ]

  if (is_posix) {
    sources += [ "security_key_auth_handler_posix_unittest.cc" ]
  }

  if (is_win) {
    sources += [
      "security_key_auth_handler_win_unittest.cc",
      "security_key_ipc_client_unittest.cc",
      "security_key_message_handler_unittest.cc",
    ]
  }
}

static_library("test_support") {
  testonly = true

  sources = [
    "fake_security_key_message_reader.cc",
    "fake_security_key_message_reader.h",
    "fake_security_key_message_writer.cc",
    "fake_security_key_message_writer.h",
  ]

  if (is_win) {
    sources += [
      "fake_security_key_ipc_client.cc",
      "fake_security_key_ipc_client.h",
    ]
  }

  deps = [
    ":security_key",
    "//remoting/host:common",
    "//remoting/host/mojom",
    "//remoting/proto",
    "//testing/gtest",
  ]

  public_deps = [
    "//testing/gmock",
    "//third_party/protobuf:protobuf_lite",
    "//third_party/webrtc_overrides:webrtc_component",
  ]
}