Skip to content

Commit 0d49bb3

Browse files
MariuszSkamracarlescufi
authored andcommitted
tests: Bluetooth: ascs: Add CIS connection retry test case
This adds test case testing whether ASE in Enabling state will accept releated CIS Request if previous CIS establishment procedure failed. Signed-off-by: Mariusz Skamra <[email protected]>
1 parent 1ff7b49 commit 0d49bb3

File tree

1 file changed

+47
-0
lines changed
  • tests/bluetooth/audio/ascs/src

1 file changed

+47
-0
lines changed

tests/bluetooth/audio/ascs/src/main.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,3 +605,50 @@ ZTEST_F(ascs_test_suite, test_cis_link_loss_in_enabling_state)
605605

606606
bt_bap_unicast_server_unregister_cb(&mock_bap_unicast_server_cb);
607607
}
608+
609+
ZTEST_F(ascs_test_suite, test_cis_link_loss_in_enabling_state_client_retries)
610+
{
611+
struct bt_bap_stream *stream = &fixture->stream;
612+
struct bt_conn *conn = &fixture->conn;
613+
const struct bt_gatt_attr *ase;
614+
struct bt_iso_chan *chan;
615+
uint8_t ase_id;
616+
int err;
617+
618+
if (IS_ENABLED(CONFIG_BT_ASCS_ASE_SNK)) {
619+
ase = fixture->ase_snk.attr;
620+
ase_id = fixture->ase_snk.id;
621+
} else {
622+
ase = fixture->ase_src.attr;
623+
ase_id = fixture->ase_src.id;
624+
}
625+
zexpect_not_null(ase);
626+
zexpect_true(ase_id != 0x00);
627+
628+
bt_bap_unicast_server_register_cb(&mock_bap_unicast_server_cb);
629+
630+
test_preamble_state_enabling(conn, ase_id, stream);
631+
err = mock_bt_iso_accept(conn, 0x01, 0x01, &chan);
632+
zassert_equal(0, err, "Failed to connect iso: err %d", err);
633+
634+
/* Mock CIS disconnection */
635+
mock_bt_iso_disconnected(chan, BT_HCI_ERR_CONN_FAIL_TO_ESTAB);
636+
637+
/* Expected to not notify the upper layers */
638+
expect_bt_bap_stream_ops_qos_set_not_called();
639+
expect_bt_bap_stream_ops_released_not_called();
640+
641+
/* Client retries to establish CIS */
642+
err = mock_bt_iso_accept(conn, 0x01, 0x01, &chan);
643+
zassert_equal(0, err, "Failed to connect iso: err %d", err);
644+
if (!IS_ENABLED(CONFIG_BT_ASCS_ASE_SNK)) {
645+
test_ase_control_client_receiver_start_ready(conn, ase_id);
646+
} else {
647+
err = bt_bap_stream_start(stream);
648+
zassert_equal(0, err, "bt_bap_stream_start err %d", err);
649+
}
650+
651+
expect_bt_bap_stream_ops_started_called_once(stream);
652+
653+
bt_bap_unicast_server_unregister_cb(&mock_bap_unicast_server_cb);
654+
}

0 commit comments

Comments
 (0)