| # Copyright 2021 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/components.gni") |
| import("//build/rust/rustc_test.gni") |
| |
| fuchsia_component_manifest("bt-a2dp-sink-manifest") { |
| component_name = "bt-a2dp-sink" |
| manifest = "//src/connectivity/bluetooth/profiles/bt-a2dp/meta/bt-a2dp.cml" |
| } |
| |
| fuchsia_component("bt-a2dp-sink") { |
| cm_label = ":bt-a2dp-sink-manifest" |
| deps = [ "//src/connectivity/bluetooth/profiles/bt-a2dp:bin" ] |
| } |
| |
| fuchsia_structured_config_values("sink_only_config") { |
| cm_label = ":bt-a2dp-sink-manifest" |
| values = { |
| domain = "Bluetooth" |
| source_type = "none" |
| channel_mode = "basic" |
| enable_sink = true |
| enable_avrcp_target = false |
| enable_aac = true |
| initiator_delay = 0 |
| } |
| } |
| |
| rustc_test("bin") { |
| edition = "2021" |
| output_name = "bt_a2dp_loopback" |
| source_root = "src/main.rs" |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.bluetooth.bredr:fuchsia.bluetooth.bredr_rust", |
| "//sdk/fidl/fuchsia.media:fuchsia.media_rust", |
| "//sdk/fidl/fuchsia.mediacodec:fuchsia.mediacodec_rust", |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust", |
| "//sdk/fidl/fuchsia.sysmem2:fuchsia.sysmem2_rust", |
| "//sdk/fidl/fuchsia.tracing.provider:fuchsia.tracing.provider_rust", |
| "//src/connectivity/bluetooth/testing/mock-piconet-server:lib", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component-test", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| sources = [ "src/main.rs" ] |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| fuchsia_test_component("bt-a2dp-loopback-component") { |
| restricted_features = [ "allow_non_hermetic_packages" ] |
| manifest = "meta/bt-a2dp-loopback.cml" |
| deps = [ ":bin" ] |
| test_type = "system" |
| } |
| |
| fuchsia_test_package("bt-a2dp-loopback-test") { |
| test_components = [ ":bt-a2dp-loopback-component" ] |
| |
| test_specs = { |
| # The max severity is set to ERROR due to the Cobalt connector ERROR message if the `Logger` |
| # capability is unavailable. This occurs in some cases when the `mock-cobalt` component exits |
| # (because the test has completed) before the A2DP component attempts to connect to it. This is |
| # not a bug in the test, and may be fixed if we enforce ordering in component shut down. |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| |
| # Ensures that the loopback test is only run on devices that support audio. |
| environments = [ |
| astro_env, |
| sherlock_env, |
| nelson_env, |
| ] |
| } |
| |
| deps = [ |
| # The v2 A2DP component with only Source mode enabled. |
| "//src/connectivity/bluetooth/profiles/bt-a2dp:component", |
| "//src/connectivity/bluetooth/profiles/bt-a2dp:source_only_config", |
| |
| # The v2 A2DP component with only Sink mode enabled. |
| ":bt-a2dp-sink", |
| ":sink_only_config", |
| |
| # Mock Piconet Server |
| "//src/connectivity/bluetooth/testing/mock-piconet-server:component", |
| |
| # Mock cobalt component that provides Cobalt services to A2DP. |
| "//src/cobalt/bin/testing/mock_cobalt:component_v2", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":bt-a2dp-loopback-test", |
| |
| # Codec Factory package with the CFv2 component providing the `fuchsia.mediacodec.CodecFactory` |
| # capability. |
| "//src/media/codec:codec_factory", |
| ] |
| } |