# 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/buildflag_header.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/util/process_version.gni")
import("//remoting/build/config/remoting_build.gni")
import("//remoting/build/config/remoting_logging.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/protobuf/proto_library.gni")
proto_library("protobuf_http_client_messages_proto") {
sources = [ "protobuf_http_client_messages.proto" ]
}
process_version("remoting_base_version") {
sources = [ "//chrome/VERSION" ]
template_file = "//remoting/base/version.h.in"
output = "$target_gen_dir/version.h"
}
buildflag_header("buildflags") {
header = "buildflags.h"
flags = [ "REMOTING_INTERNAL=$remoting_internal" ]
}
source_set("base") {
sources = [
"auto_thread.cc",
"auto_thread.h",
"auto_thread_task_runner.cc",
"auto_thread_task_runner.h",
"buffered_socket_writer.cc",
"buffered_socket_writer.h",
"capabilities.cc",
"capabilities.h",
"certificate_helpers.cc",
"certificate_helpers.h",
"chromoting_event.cc",
"chromoting_event.h",
"cloud_service_client.cc",
"cloud_service_client.h",
"compound_buffer.cc",
"compound_buffer.h",
"constants.cc",
"constants.h",
"corp_auth_util.cc",
"corp_auth_util.h",
"corp_logging_service_client.cc",
"corp_logging_service_client.h",
"corp_service_client.cc",
"corp_service_client.h",
"corp_session_authz_service_client.cc",
"corp_session_authz_service_client.h",
"corp_session_authz_service_client_factory.cc",
"corp_session_authz_service_client_factory.h",
"cpu_utils.cc",
"cpu_utils.h",
"directory_service_client.cc",
"directory_service_client.h",
"fqdn.cc",
"fqdn.h",
"internal_headers.h",
"is_google_email.cc",
"is_google_email.h",
"leaky_bucket.cc",
"leaky_bucket.h",
"local_session_policies_provider.cc",
"local_session_policies_provider.h",
"logging_service_client.h",
"protobuf_http_client.cc",
"protobuf_http_client.h",
"protobuf_http_request.cc",
"protobuf_http_request.h",
"protobuf_http_request_base.cc",
"protobuf_http_request_base.h",
"protobuf_http_request_config.cc",
"protobuf_http_request_config.h",
"protobuf_http_status.cc",
"protobuf_http_status.h",
"protobuf_http_stream_parser.cc",
"protobuf_http_stream_parser.h",
"protobuf_http_stream_request.cc",
"protobuf_http_stream_request.h",
"queued_task_poster.cc",
"queued_task_poster.h",
"rate_counter.cc",
"rate_counter.h",
"result.h",
"rsa_key_pair.cc",
"rsa_key_pair.h",
"running_samples.cc",
"running_samples.h",
"scoped_protobuf_http_request.cc",
"scoped_protobuf_http_request.h",
"service_urls.cc",
"service_urls.h",
"session_authz_service_client.h",
"session_authz_service_client_factory.h",
"session_options.cc",
"session_options.h",
"socket_reader.cc",
"socket_reader.h",
"task_util.h",
"telemetry_log_writer.cc",
"telemetry_log_writer.h",
"typed_buffer.h",
"url_loader_network_service_observer.cc",
"url_loader_network_service_observer.h",
"url_request_context_getter.cc",
"url_request_context_getter.h",
"util.cc",
"util.h",
"vlog_net_log.cc",
"vlog_net_log.h",
"weighted_samples.cc",
"weighted_samples.h",
]
configs += [
"//build/config/compiler:wexit_time_destructors",
"//remoting/build/config:version",
]
public_deps = [
"//base",
"//net",
"//remoting/proto",
"//remoting/proto/remoting/v1:chromoting_event_proto",
"//third_party/protobuf:protobuf_lite",
]
deps = [
":authorization",
":buildflags",
":logging",
":name_value_map",
":protobuf_http_client_messages_proto",
":remoting_base_version",
":session_policies",
"//build:chromeos_buildflags",
"//google_apis",
"//google_apis/common:request_util",
"//remoting/proto:internal_structs",
"//remoting/proto/google/internal/remoting/cloud/v1alpha:messages",
"//remoting/proto/remoting/v1:cloud_proto",
"//remoting/proto/remoting/v1:directory_proto",
"//remoting/proto/remoting/v1:telemetry_messages",
"//services/network/public/cpp",
"//services/network/public/mojom",
"//third_party/abseil-cpp:absl",
"//third_party/libvpx",
"//third_party/libyuv",
"//third_party/webrtc_overrides:webrtc_component",
"//url",
]
if (remoting_internal) {
deps += [
"//remoting/internal/base",
"//remoting/internal/proto",
]
} else {
deps += [
":api_key_stubs",
"//remoting/proto:internal_stubs",
]
}
if (is_win) {
sources += [ "scoped_sc_handle_win.h" ]
libs = [ "crypt32.lib" ] # For CryptoAPI functions in certificate_helpers
} else if (is_linux || is_chromeos) {
sources += [
"file_path_util_linux.cc",
"file_path_util_linux.h",
]
}
}
source_set("name_value_map") {
sources = [ "name_value_map.h" ]
deps = [ "//base" ]
}
source_set("errors") {
sources = [
"errors.cc",
"errors.h",
]
deps = [
":name_value_map",
"//base",
"//remoting/proto:error_code_proto",
]
}
source_set("session_policies") {
public = [
"port_range.h",
"session_policies.h",
]
sources = [
"port_range.cc",
"session_policies.cc",
]
deps = [ "//base" ]
}
source_set("authorization") {
sources = [
"gaia_oauth_client.cc",
"gaia_oauth_client.h",
"oauth_client.h",
"oauth_token_getter.cc",
"oauth_token_getter.h",
"oauth_token_getter_impl.cc",
"oauth_token_getter_impl.h",
"oauth_token_getter_proxy.cc",
"oauth_token_getter_proxy.h",
"passthrough_oauth_token_getter.cc",
"passthrough_oauth_token_getter.h",
]
configs += [
"//build/config/compiler:wexit_time_destructors",
"//remoting/build/config:version",
]
deps = [
":logging",
"//services/network/public/cpp",
]
public_deps = [
"//base",
"//google_apis",
"//net",
]
}
source_set("breakpad") {
sources = [
"breakpad.h",
"breakpad_utils.cc",
"breakpad_utils.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
deps = [
":remoting_base_version",
"//base",
]
if (is_linux || is_chromeos) {
sources += [ "breakpad_linux.cc" ]
deps += [ "//third_party/breakpad:client" ]
} else if (is_mac) {
sources += [ "breakpad_mac.mm" ]
} else if (is_win) {
sources += [
"breakpad_server.cc",
"breakpad_win.cc",
]
deps += [
":logging",
"//third_party/breakpad:breakpad_handler",
]
}
}
source_set("logging") {
public = [ "logging.h" ]
sources = [
"logging.cc",
"logging_internal.h",
]
if (is_linux || is_chromeos) {
sources += [ "logging_linux.cc" ]
}
if (is_mac) {
sources += [ "logging_mac.cc" ]
}
if (is_win) {
sources += [ "logging_win.cc" ]
}
if (remoting_webrtc_verbose_logging) {
defines = [ "WEBRTC_VERBOSE_LOGGING" ]
}
deps = [ "//base" ]
}
source_set("settings") {
sources = [
"host_settings.cc",
"host_settings.h",
"user_settings.cc",
"user_settings.h",
]
deps = [
":logging",
"//base",
"//remoting/base",
]
if (is_win) {
sources += [
"host_settings_win.cc",
"host_settings_win.h",
"user_settings_win.cc",
"user_settings_win.h",
]
} else if (is_mac || is_linux) {
sources += [
"file_host_settings.cc",
"file_host_settings.h",
]
if (is_linux) {
sources += [ "file_host_settings_linux.cc" ]
} else if (is_mac) {
sources += [ "file_host_settings_mac.cc" ]
}
}
}
static_library("test_support") {
testonly = true
sources = [
"fake_oauth_token_getter.cc",
"fake_oauth_token_getter.h",
"mock_oauth_client.cc",
"mock_oauth_client.h",
"mock_session_authz_service_client.cc",
"mock_session_authz_service_client.h",
"protobuf_http_test_responder.cc",
"protobuf_http_test_responder.h",
"test_rsa_key_pair.h",
]
deps = [
":logging",
":protobuf_http_client_messages_proto",
"//base/test:test_support",
"//remoting/proto",
"//remoting/proto:internal_structs",
"//services/network:test_support",
"//testing/gmock",
]
public_deps = [
":authorization",
":base",
":breakpad",
"//base",
"//testing/gmock",
"//testing/gtest",
"//third_party/protobuf:protobuf_lite",
]
}
proto_library("test_proto") {
testonly = true
sources = [ "protobuf_http_client_test_messages.proto" ]
}
source_set("api_key_stubs") {
public = [ "api_key_stubs.h" ]
sources = [
"api_key_stubs.cc",
"api_key_stubs.h",
]
}
source_set("run_all_unittests") {
testonly = true
sources = [ "run_all_unittests.cc" ]
if (is_chromeos_ash) {
sources += [
"chromeos_remoting_test_suite.cc",
"chromeos_remoting_test_suite.h",
]
}
deps = [
"//base",
"//base/test:test_support",
"//mojo/core/embedder",
"//testing/gtest",
]
if (is_chromeos_ash) {
deps += [
"//ui/aura:test_support",
"//ui/gl:test_support",
]
data = [ "$root_out_dir/locales/en-US.pak" ]
data_deps = [ "//ui/resources:ui_test_pak_data" ]
}
}
source_set("unit_tests") {
testonly = true
sources = [
"auto_thread_task_runner_unittest.cc",
"auto_thread_unittest.cc",
"buffered_socket_writer_unittest.cc",
"capabilities_unittest.cc",
"compound_buffer_unittest.cc",
"leaky_bucket_unittest.cc",
"local_session_policies_provider_unittest.cc",
"oauth_token_getter_proxy_unittest.cc",
"port_range_unittest.cc",
"protobuf_http_client_unittest.cc",
"protobuf_http_stream_parser_unittest.cc",
"queued_task_poster_unittest.cc",
"rate_counter_unittest.cc",
"result_unittest.cc",
"rsa_key_pair_unittest.cc",
"running_samples_unittest.cc",
"session_options_unittest.cc",
"session_policies_unittest.cc",
"telemetry_log_writer_unittest.cc",
"typed_buffer_unittest.cc",
"util_unittest.cc",
"weighted_samples_unittest.cc",
]
deps = [
":logging",
":protobuf_http_client_messages_proto",
":run_all_unittests",
":session_policies",
":test_proto",
":test_support",
"//base",
"//net:test_support",
"//remoting/proto/remoting/v1:telemetry_messages",
"//services/network:test_support",
"//services/network/public/cpp",
"//third_party/libyuv",
"//third_party/webrtc_overrides:webrtc_component",
]
if (is_win || is_chromeos_ash) {
deps += [ "//third_party/breakpad:client" ]
}
}
fuzzer_test("remoting_protobuf_http_stream_parser_fuzzer") {
sources = [ "protobuf_http_stream_parser_fuzzer.cc" ]
deps = [
":base",
"//base",
"//base/test:test_support",
"//third_party/protobuf:protobuf_lite",
]
}