chromium/remoting/BUILD.gn

# Copyright 2015 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/chromeos/ui_mode.gni")
import("//remoting/build/config/remoting_build.gni")

group("remoting_all") {
  testonly = true

  deps = [ ":remoting_unittests" ]

  if (is_win) {
    deps += [
      "//remoting/host/win:all",
      "//remoting/tools:remoting_breakpad_tester",
    ]

    if (is_chrome_branded) {
      deps += [ "//remoting/host:remoting_host_installation" ]
    }
  }

  if (is_ios) {
    deps += [
      "//remoting/ios:all",
      "//remoting/ios:ios_remoting_unittests",
    ]
  }

  if (enable_remoting_host) {
    deps += [
      ":remoting_perftests",
      "//remoting/host",
    ]

    if (!is_chromeos_ash && !is_android) {
      deps += [
        "//remoting/host:remoting_native_messaging_manifests",
        "//remoting/host:remoting_start_host",
      ]
      if (!is_ios) {
        deps += [ "//remoting/host:remoting_native_messaging_host" ]
      }

      # it2me.
      deps += [ "//remoting/host/it2me:remote_assistance_host" ]
      if (is_win) {
        deps += [ "//remoting/host/it2me:remote_assistance_host_uiaccess" ]
      }
    }

    if (is_linux) {
      deps += [
        "//remoting/host/crash:remoting_crash_uploader",
        "//remoting/host/linux:remoting_dev_me2me_host",
        "//remoting/host/linux:remoting_user_session",
      ]
    }
  }

  if (enable_me2me_host) {
    deps += [ "//remoting/host:remoting_me2me_host" ]
    if (is_chrome_branded) {
      deps += [ "//remoting/host:remoting_me2me_host_archive" ]
    }
  }
}

group("test_support") {
  testonly = true

  deps = [
    "//base",
    "//net",
    "//remoting/base:test_support",
    "//remoting/client",
    "//remoting/codec:decoder",
    "//remoting/codec:encoder",
    "//remoting/protocol:test_support",
    "//remoting/resources",
    "//remoting/signaling:test_support",
    "//remoting/test:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]

  if (!is_ios) {
    deps += [ "//components/policy/core/browser:test_support" ]
  }

  if (enable_remoting_host) {
    deps += [ "//remoting/host:test_support" ]
  }
}

test("remoting_unittests") {
  defines = []
  libs = []

  configs += [ "//remoting/build/config:version" ]

  deps = [
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//google_apis",
    "//remoting/base:unit_tests",
    "//remoting/client:unit_tests",
    "//remoting/client/audio:unit_tests",
    "//remoting/client/input:unit_tests",
    "//remoting/client/notification:unit_tests",
    "//remoting/client/ui:unit_tests",
    "//remoting/protocol:unit_tests",
    "//remoting/signaling:unit_tests",
    "//testing/gmock",
    "//testing/gtest",
  ]

  if (enable_remoting_host) {
    deps += [
      "//remoting/codec:unit_tests",
      "//remoting/host:unit_tests",
      "//ui/gfx",
    ]
  }

  deps += [ "//third_party/webrtc_overrides:webrtc_component" ]

  if (is_android) {
    deps += [ "//net/android:net_java" ]

    libs += [ "android" ]
  }

  if (is_win) {
    defines += [ "_ALT_NO_EXCEPTIONS" ]

    libs += [
      "comctl32.lib",
      "rpcrt4.lib",
      "wtsapi32.lib",
    ]
  }

  # TODO(crbug.com/40118868): Change to !is_chromeos once lacros-chrome is switched to target_os=chromeos.
  if (!is_chromeos) {
    deps += [ "//remoting/client/display:unit_tests" ]
  }
}

if (enable_remoting_host) {
  test("remoting_perftests") {
    defines = []
    libs = []

    sources = [
      "test/codec_perftest.cc",
      "test/protocol_perftest.cc",
    ]

    configs += [ "//remoting/build/config:version" ]

    deps = [
      ":test_support",
      "//base",
      "//base/test:run_all_unittests",
      "//base/test:test_support",
      "//components/webrtc:thread_wrapper",
      "//net:test_support",
      "//remoting/base",
      "//remoting/client:client",
      "//remoting/client/audio:audio",
      "//remoting/codec:encoder",
      "//remoting/host:common",
      "//remoting/host:test_support",
      "//remoting/protocol:protocol",
      "//remoting/signaling:test_support",
      "//remoting/test:test_support",
      "//testing/gtest",
      "//third_party/webrtc_overrides:webrtc_component",
    ]

    if (is_win) {
      defines += [ "_ALT_NO_EXCEPTIONS" ]

      libs += [
        "rpcrt4.lib",
        "wtsapi32.lib",
      ]
    }
  }
}