# 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("//extensions/buildflags/buildflags.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
assert(!is_fuchsia, "Fuchsia shouldn't use anything in //chrome")
declare_args() {
# Set to true to build code that supports the Open Screen Protocol.
# OSP is experimental and not yet feature-complete.
enable_openscreen_protocol = false
}
source_set("data_decoder_util") {
sources = [
"data_decoder_util.cc",
"data_decoder_util.h",
]
deps = [
"//base",
"//services/data_decoder/public/cpp",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
}
source_set("logger_list") {
sources = [
"logger_list.cc",
"logger_list.h",
]
deps = [
"//base",
"//components/media_router/browser",
"//content/public/browser",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
}
static_library("media_router_feature") {
sources = [
"media_router_feature.cc",
"media_router_feature.h",
]
public_deps = [ "//base" ]
deps = [
"//chrome/browser/profiles",
"//chrome/browser/profiles:profile",
"//chrome/common:constants",
"//components/media_router/common:common",
"//components/prefs",
"//components/user_prefs",
"//content/public/browser",
"//content/public/common",
"//crypto",
"//media",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
if (is_chromeos_ash) {
deps += [ "//chromeos/ash/components/browser_context_helper" ]
}
}
static_library("router") {
sources = [
"chrome_media_router_factory.cc",
"chrome_media_router_factory.h",
"presentation/chrome_local_presentation_manager_factory.cc",
"presentation/chrome_local_presentation_manager_factory.h",
]
public_deps = [
"//chrome/browser:browser_public_dependencies",
"//chrome/browser/media/webrtc",
"//components/media_router/browser",
"//components/media_router/common",
"//components/media_router/common/mojom:media_router",
]
deps = [
":data_decoder_util",
":media_router_feature",
"//base",
"//chrome:strings",
"//chrome/browser/profiles",
"//chrome/browser/profiles:profile",
"//chrome/common:constants",
"//components/keyed_service/content",
"//components/keyed_service/core",
"//components/media_router/common/providers/cast/channel",
"//components/media_router/common/providers/cast/channel:capability",
"//components/openscreen_platform",
"//content/public/browser",
"//content/public/common",
"//crypto",
"//net",
"//net/traffic_annotation",
"//services/network:network_service",
"//services/network/public/mojom",
"//third_party/icu",
"//url",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
if (!is_android) {
sources += [
"mojo/media_router_debugger_impl.cc",
"mojo/media_router_debugger_impl.h",
"mojo/media_router_desktop.cc",
"mojo/media_router_desktop.h",
"mojo/media_router_mojo_metrics.cc",
"mojo/media_router_mojo_metrics.h",
"mojo/media_sink_service_status.cc",
"mojo/media_sink_service_status.h",
"providers/cast/app_activity.cc",
"providers/cast/app_activity.h",
"providers/cast/cast_activity.cc",
"providers/cast/cast_activity.h",
"providers/cast/cast_activity_manager.cc",
"providers/cast/cast_activity_manager.h",
"providers/cast/cast_app_availability_tracker.cc",
"providers/cast/cast_app_availability_tracker.h",
"providers/cast/cast_app_discovery_service.cc",
"providers/cast/cast_app_discovery_service.h",
"providers/cast/cast_internal_message_util.cc",
"providers/cast/cast_internal_message_util.h",
"providers/cast/cast_media_controller.cc",
"providers/cast/cast_media_controller.h",
"providers/cast/cast_media_route_provider.cc",
"providers/cast/cast_media_route_provider.h",
"providers/cast/cast_media_route_provider_metrics.cc",
"providers/cast/cast_media_route_provider_metrics.h",
"providers/cast/cast_session_client.cc",
"providers/cast/cast_session_client.h",
"providers/cast/cast_session_client_impl.cc",
"providers/cast/cast_session_client_impl.h",
"providers/cast/cast_session_tracker.cc",
"providers/cast/cast_session_tracker.h",
"providers/cast/chrome_cast_message_handler.cc",
"providers/cast/chrome_cast_message_handler.h",
"providers/cast/dual_media_sink_service.cc",
"providers/cast/dual_media_sink_service.h",
"providers/cast/mirroring_activity.cc",
"providers/cast/mirroring_activity.h",
"providers/dial/dial_activity_manager.cc",
"providers/dial/dial_activity_manager.h",
"providers/dial/dial_internal_message_util.cc",
"providers/dial/dial_internal_message_util.h",
"providers/dial/dial_media_route_provider.cc",
"providers/dial/dial_media_route_provider.h",
"providers/dial/dial_media_route_provider_metrics.cc",
"providers/dial/dial_media_route_provider_metrics.h",
"providers/wired_display/wired_display_media_route_provider.cc",
"providers/wired_display/wired_display_media_route_provider.h",
"providers/wired_display/wired_display_presentation_receiver.h",
"providers/wired_display/wired_display_presentation_receiver_factory.cc",
"providers/wired_display/wired_display_presentation_receiver_factory.h",
]
public_deps += [
"//components/media_router/common/mojom:debugger",
"//components/media_router/common/mojom:logger",
]
deps += [
# We can't depend on //chrome/browser/ui due to introducing a cyclic
# dependency. Remove this target from the `allow_circular_includes_from`
# list in chrome/browser/ui/BUILD.gn once the issues is resolved.
# TODO(crbug.com/40110173): Resolve circular dependencies.
":logger_list",
"//chrome/browser:browser_process",
"//chrome/browser/media/router/discovery",
"//chrome/browser/media/router/discovery/access_code:access_code_cast_feature",
"//chrome/browser/profiles:profile",
"//components/access_code_cast/common:metrics",
"//components/embedder_support:browser_util",
"//components/mirroring/mojom:service",
"//components/ukm/content:content",
"//components/version_info:version_info",
"//media/cast:common",
"//media/remoting:remoting_device_capability",
"//mojo/public/cpp/bindings",
"//services/metrics/public/cpp:ukm_builders",
"//third_party/openscreen/src/cast/common/channel/proto:channel_proto",
]
if (is_win) {
sources += [
"mojo/media_route_provider_util_win.cc",
"mojo/media_route_provider_util_win.h",
]
deps += [ "//chrome/installer/util:with_no_strings" ]
}
if (enable_openscreen_protocol) {
sources += [
"providers/openscreen/discovery/open_screen_listener.cc",
"providers/openscreen/discovery/open_screen_listener.h",
"providers/openscreen/network_service_async_packet_sender.cc",
"providers/openscreen/network_service_async_packet_sender.h",
"providers/openscreen/network_service_quic_packet_writer.cc",
"providers/openscreen/network_service_quic_packet_writer.h",
]
deps += [
"//third_party/openscreen/src/osp/public",
"//third_party/openscreen/src/platform",
]
}
}
if (enable_extensions) {
deps += [
"//extensions/buildflags",
"//extensions/common",
]
}
}
if (!is_android) {
static_library("test_support") {
testonly = true
deps = [
"//chrome/browser/media/router/discovery",
"//chrome/browser/media/router/discovery/access_code:access_code_sink_service",
"//chrome/browser/media/router/discovery/access_code:discovery_resources_proto",
"//chrome/test:test_support",
"//components/media_router/browser:test_support",
"//components/media_router/common:test_support",
"//components/media_router/common/mojom:media_router",
"//components/media_router/common/mojom:media_router_test_interfaces",
"//components/media_router/common/providers/cast/channel",
"//components/media_router/common/providers/cast/channel:capability",
"//components/media_router/common/providers/cast/channel:test_support",
"//testing/gmock",
]
public_deps = [ ":router" ]
sources = [
"discovery/access_code/access_code_test_util.cc",
"discovery/access_code/access_code_test_util.h",
"discovery/mdns/cast_media_sink_service_test_helpers.cc",
"discovery/mdns/cast_media_sink_service_test_helpers.h",
"providers/test/test_media_route_provider.cc",
"providers/test/test_media_route_provider.h",
"test/media_router_mojo_test.cc",
"test/media_router_mojo_test.h",
"test/mock_dns_sd_registry.cc",
"test/mock_dns_sd_registry.h",
"test/mock_mojo_media_router.cc",
"test/mock_mojo_media_router.h",
"test/provider_test_helpers.cc",
"test/provider_test_helpers.h",
]
}
}
source_set("unittests") {
testonly = true
sources = [
"chrome_media_router_factory_unittest.cc",
"presentation/chrome_local_presentation_manager_factory_unittest.cc",
]
deps = [
":media_router_feature",
":router",
"//base",
"//base/test:test_support",
"//chrome/test:test_support",
"//components/endpoint_fetcher",
"//components/media_router/browser:test_support",
"//components/media_router/common:test_support",
"//components/media_router/common/providers/cast/channel",
"//components/media_router/common/providers/cast/channel:capability",
"//components/media_router/common/providers/cast/channel:test_support",
"//components/webapps/common",
"//content/test:test_support",
"//media:test_support",
"//services/data_decoder/public/cpp:test_support",
"//testing/gmock",
"//testing/gtest",
"//ui/display:test_support",
]
if (!is_android) {
sources += [
# In-browser discovery is not used by Android for now.
"discovery/access_code/access_code_cast_discovery_interface_unittest.cc",
"discovery/access_code/access_code_cast_feature_unittest.cc",
"discovery/access_code/access_code_cast_pref_updater_unittest.cc",
"discovery/access_code/access_code_cast_sink_service_factory_unittest.cc",
"discovery/access_code/access_code_cast_sink_service_unittest.cc",
"discovery/access_code/access_code_media_sink_util_unittest.cc",
"discovery/dial/device_description_fetcher_unittest.cc",
"discovery/dial/device_description_service_unittest.cc",
"discovery/dial/dial_app_discovery_service_unittest.cc",
"discovery/dial/dial_device_data_unittest.cc",
"discovery/dial/dial_media_sink_service_impl_unittest.cc",
"discovery/dial/dial_registry_unittest.cc",
"discovery/dial/dial_service_impl_unittest.cc",
"discovery/dial/dial_url_fetcher_unittest.cc",
"discovery/dial/safe_dial_app_info_parser_unittest.cc",
"discovery/dial/safe_dial_device_description_parser_unittest.cc",
"discovery/discovery_network_list_unittest.cc",
"discovery/discovery_network_monitor_unittest.cc",
"discovery/mdns/cast_media_sink_service_impl_unittest.cc",
"discovery/mdns/cast_media_sink_service_unittest.cc",
"discovery/mdns/dns_sd_registry_unittest.cc",
"discovery/media_sink_discovery_metrics_unittest.cc",
"logger_list_unittest.cc",
"media_router_feature_unittest.cc",
"mojo/media_router_debugger_impl_unittest.cc",
"mojo/media_router_desktop_unittest.cc",
"mojo/media_sink_service_status_unittest.cc",
"providers/cast/app_activity_unittest.cc",
"providers/cast/cast_activity_manager_unittest.cc",
"providers/cast/cast_activity_test_base.cc",
"providers/cast/cast_activity_test_base.h",
"providers/cast/cast_app_availability_tracker_unittest.cc",
"providers/cast/cast_app_discovery_service_unittest.cc",
"providers/cast/cast_internal_message_util_unittest.cc",
"providers/cast/cast_media_controller_unittest.cc",
"providers/cast/cast_media_route_provider_metrics_unittest.cc",
"providers/cast/cast_media_route_provider_unittest.cc",
"providers/cast/cast_session_client_unittest.cc",
"providers/cast/cast_session_tracker_unittest.cc",
"providers/cast/dual_media_sink_service_unittest.cc",
"providers/cast/mirroring_activity_unittest.cc",
"providers/cast/mock_app_activity.cc",
"providers/cast/mock_app_activity.h",
"providers/cast/mock_mirroring_activity.cc",
"providers/cast/mock_mirroring_activity.h",
"providers/cast/mock_mirroring_service_host.cc",
"providers/cast/mock_mirroring_service_host.h",
"providers/cast/test_util.cc",
"providers/cast/test_util.h",
"providers/dial/dial_activity_manager_unittest.cc",
"providers/dial/dial_internal_message_util_unittest.cc",
"providers/dial/dial_media_route_provider_unittest.cc",
"providers/wired_display/wired_display_media_route_provider_unittest.cc",
]
if (is_win) {
sources += [ "discovery/discovery_network_list_win_unittest.cc" ]
}
deps += [
":logger_list",
":test_support",
"//chrome/browser/media/router/discovery",
"//chrome/browser/media/router/discovery:test_support",
"//chrome/browser/media/router/discovery/access_code:access_code_cast_feature",
"//chrome/browser/media/router/discovery/access_code:access_code_sink_service",
"//chrome/browser/media/router/discovery/access_code:discovery_resources_proto",
"//chrome/test:test_support",
"//components/sync_preferences:test_support",
"//content/test:test_support",
"//media/cast:common",
"//services/preferences/public/cpp",
"//third_party/openscreen/src/cast/common:public",
]
if (is_chromeos_lacros) {
deps += [
"//chromeos/crosapi/mojom",
"//chromeos/lacros",
]
} else {
sources += [
"discovery/access_code/access_code_cast_pref_updater_impl_unittest.cc",
]
}
}
if (enable_openscreen_protocol) {
include_dirs = [ "//third_party/openscreen/src" ]
sources += [
"providers/openscreen/discovery/open_screen_listener_unittest.cc",
"providers/openscreen/network_service_quic_packet_writer_unittest.cc",
]
}
}
# TODO(issuetracker.google.com/236160471): CDDL compiler doesn't build
# on Windows.
if (!is_win) {
test("openscreen_unittests") {
deps = [
"//base/test:run_all_unittests",
"//components/media_router/common/providers/cast/certificate:openscreen_certificate_verifier",
"//components/openscreen_platform",
"//testing/gmock",
"//third_party/openscreen/src:openscreen_unittests_all",
]
}
}
fuzzer_test("dial_internal_message_fuzzer") {
sources = [ "providers/dial/dial_internal_message_fuzzer.cc" ]
deps = [
":router",
"//base",
"//base/test:test_support",
"//chrome/browser",
"//chrome/test:test_support",
"//components/mirroring/mojom:service",
"//components/translate/content/common",
]
dict = "providers/dial/fuzzer_data/dial_internal_message_fuzzer.dict"
seed_corpus = "providers/dial/fuzzer_data/corpus/"
}