tests: Bluetooth: ascs: Get chan pointer from test_preamble_state_disabling

This adds a possibility to get the ISO channel pointer from
test_preamble_state_disabling function that can be further used in
tests.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
Mariusz Skamra 2023-08-02 10:36:59 +02:00 committed by Carles Cufí
parent e85a0bc572
commit c7476fd7c9
4 changed files with 9 additions and 7 deletions

View file

@ -65,4 +65,4 @@ void test_preamble_state_streaming(struct bt_conn *conn, uint8_t ase_id,
struct bt_bap_stream *stream, struct bt_iso_chan **chan,
bool source);
void test_preamble_state_disabling(struct bt_conn *conn, uint8_t ase_id,
struct bt_bap_stream *stream);
struct bt_bap_stream *stream, struct bt_iso_chan **chan);

View file

@ -830,8 +830,9 @@ static void test_receiver_stop_ready_expect_invalid_length(struct bt_conn *conn,
0x02, /* Response_Code[0] = Invalid Length */
0x00, /* Reason[0] */
};
struct bt_iso_chan *chan;
test_preamble_state_disabling(conn, ase_id, stream);
test_preamble_state_disabling(conn, ase_id, stream, &chan);
ase_cp->write(conn, ase_cp, buf, len, 0, 0);

View file

@ -432,12 +432,13 @@ ZTEST_F(test_ase_state_transition_invalid, test_client_source_state_disabling)
const struct bt_gatt_attr *ase_cp = fixture->ase_cp;
struct bt_bap_stream *stream = &fixture->stream;
struct bt_conn *conn = &fixture->conn;
struct bt_iso_chan *chan;
uint8_t ase_id;
Z_TEST_SKIP_IFNDEF(CONFIG_BT_ASCS_ASE_SRC);
ase_id = test_ase_id_get(fixture->ase_src);
test_preamble_state_disabling(conn, ase_id, stream);
test_preamble_state_disabling(conn, ase_id, stream, &chan);
test_client_config_codec_expect_transition_error(conn, ase_id, ase_cp);
test_client_config_qos_expect_transition_error(conn, ase_id, ase_cp);
@ -679,12 +680,13 @@ ZTEST_F(test_ase_state_transition_invalid, test_server_source_state_disabling)
{
struct bt_bap_stream *stream = &fixture->stream;
struct bt_conn *conn = &fixture->conn;
struct bt_iso_chan *chan;
uint8_t ase_id;
Z_TEST_SKIP_IFNDEF(CONFIG_BT_ASCS_ASE_SRC);
ase_id = test_ase_id_get(fixture->ase_src);
test_preamble_state_disabling(conn, ase_id, stream);
test_preamble_state_disabling(conn, ase_id, stream, &chan);
test_server_config_codec_expect_error(stream);
test_server_config_qos_expect_error(stream);

View file

@ -330,16 +330,15 @@ void test_preamble_state_streaming(struct bt_conn *conn, uint8_t ase_id,
}
void test_preamble_state_disabling(struct bt_conn *conn, uint8_t ase_id,
struct bt_bap_stream *stream)
struct bt_bap_stream *stream, struct bt_iso_chan **chan)
{
struct bt_iso_chan *chan;
int err;
test_ase_control_client_config_codec(conn, ase_id, stream);
test_ase_control_client_config_qos(conn, ase_id);
test_ase_control_client_enable(conn, ase_id);
err = mock_bt_iso_accept(conn, 0x01, 0x01, &chan);
err = mock_bt_iso_accept(conn, 0x01, 0x01, chan);
zassert_equal(0, err, "Failed to connect iso: err %d", err);
test_ase_control_client_receiver_start_ready(conn, ase_id);