tests: Bluetooth: ascs: Add prohibited audio context metadata test

This adds for receiving and handling Enable operation with
prohibited audio context value.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
Mariusz Skamra 2023-08-01 16:07:32 +02:00 committed by Carles Cufí
parent d28f180473
commit 02f399dc1d

View file

@ -670,6 +670,32 @@ ZTEST_F(test_ase_control_params, test_enable_invalid_ase_id)
fixture->ase_cp, data_expected, sizeof(data_expected));
}
ZTEST_F(test_ase_control_params, test_enable_metadata_prohibited_context)
{
const uint8_t ase_id_valid = 0x01;
const uint8_t buf[] = {
0x03, /* Opcode = Enable */
0x01, /* Number_of_ASEs */
ase_id_valid, /* ASE_ID[0] */
0x04, /* Metadata_Length[0] */
0x03, 0x02, 0x00, 0x00, /* Metadata[0] = Streaming Context (Prohibited) */
};
const uint8_t data_expected[] = {
0x03, /* Opcode = Enable */
0x01, /* Number_of_ASEs */
ase_id_valid, /* ASE_ID[0] */
0x0C, /* Response_Code[0] = Invalid Metadata */
0x02, /* Reason[0] = Streaming Context */
};
test_preamble_state_qos_configured(&fixture->conn, ase_id_valid, &fixture->stream);
fixture->ase_cp->write(&fixture->conn, fixture->ase_cp, buf, sizeof(buf), 0, 0);
expect_bt_gatt_notify_cb_called_once(&fixture->conn, BT_UUID_ASCS_ASE_CP,
fixture->ase_cp, data_expected, sizeof(data_expected));
}
static void test_receiver_start_ready_expect_invalid_length(struct bt_conn *conn, uint8_t ase_id,
const struct bt_gatt_attr *ase_cp,
struct bt_bap_stream *stream,