From d85344395423f46a92f8cb2d10a9ecd3c8bd1b3b Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 17 Dec 2013 18:05:50 +0200 Subject: [PATCH] unit/AVDTP: Add /TP/SIG/FRA/BV-02-C test Verify ithat the IUT (SNK) is able to receive streaming media data on an established stream. --- unit/test-avdtp.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c index 5458d446d..8a5f1f45e 100644 --- a/unit/test-avdtp.c +++ b/unit/test-avdtp.c @@ -131,11 +131,14 @@ static gboolean send_pdu(gpointer user_data) if (g_test_verbose()) util_hexdump('<', pdu->data, len, test_debug, "AVDTP: "); - g_assert(len == (ssize_t) pdu->size); + g_assert_cmpint(len, ==, pdu->size); if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-02-C")) g_timeout_add_seconds(1, context_quit, context); + if (pdu->fragmented) + return send_pdu(user_data); + return FALSE; } @@ -617,6 +620,12 @@ static void discover_cb(struct avdtp *session, GSList *seps, g_assert(err == NULL); g_assert_cmpint(g_slist_length(seps), !=, 0); + if (g_str_equal(context->data->test_name, "/TP/SIG/FRA/BV-02-C")) { + g_assert(err == NULL); + context_quit(context); + return; + } + rsep = avdtp_find_remote_sep(session, context->sep); g_assert(rsep != NULL); @@ -677,6 +686,23 @@ static void test_client_1_3(gconstpointer data) avdtp_unregister_sep(sep); } +static void test_client_frg(gconstpointer data) +{ + struct context *context = context_new(0x0100, 48, 48, data); + struct avdtp_local_sep *sep; + + sep = avdtp_register_sep(AVDTP_SEP_TYPE_SINK, AVDTP_MEDIA_TYPE_AUDIO, + 0x00, TRUE, NULL, &sep_cfm, + context); + context->sep = sep; + + avdtp_discover(context->session, discover_cb, context); + + execute_context(context); + + avdtp_unregister_sep(sep); +} + int main(int argc, char *argv[]) { g_test_init(&argc, &argv, NULL); @@ -1186,6 +1212,27 @@ int main(int argc, char *argv[]) raw_pdu(0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)); + define_test("/TP/SIG/FRA/BV-02-C", test_client_frg, + raw_pdu(0xb0, 0x01), + raw_pdu(0xb2, 0x01, 0x04, 0x00), + raw_pdu(0xc0, 0x02, 0x04), + frg_pdu(0xc6, 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, + 0x00, 0xff, 0xff, 0x02, 0x40, 0x04, 0x60, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00), + frg_pdu(0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00), + raw_pdu(0xce, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00)); return g_test_run(); } -- 2.47.3