Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 10/19] unit/AVDTP: Add /TP/SIG/SMG/BV-15-C test
Date: Mon, 25 Nov 2013 15:11:01 +0200	[thread overview]
Message-ID: <1385385070-21010-11-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1385385070-21010-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Verify that the IUT (INT) is able to establish a stream connection to a
previously configured remote SEP by establishing one L2CAP channel
(AVDTP_OPEN_CMD), and reports the related confirmation.
---
 unit/test-avdtp.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 54 insertions(+), 2 deletions(-)

diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c
index a266819..4e46987 100644
--- a/unit/test-avdtp.c
+++ b/unit/test-avdtp.c
@@ -40,7 +40,7 @@
 
 struct test_pdu {
 	bool valid;
-	const void *data;
+	const uint8_t *data;
 	size_t size;
 };
 
@@ -234,11 +234,31 @@ static void sep_setconf_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
 				struct avdtp_stream *stream,
 				struct avdtp_error *err, void *user_data)
 {
+	struct context *context = user_data;
+	const struct test_pdu *pdu;
 	int ret;
 
 	g_assert(err == NULL);
 
-	ret = avdtp_get_configuration(session, stream);
+	if (!context)
+		return;
+
+	pdu = &context->pdu_list[context->pdu_offset];
+
+	if (pdu->size < 2)
+		return;
+
+	switch (pdu->data[1]) {
+	case 0x04:
+		ret = avdtp_get_configuration(session, stream);
+		break;
+	case 0x06:
+		ret = avdtp_open(session, stream);
+		break;
+	default:
+		g_assert_not_reached();
+	}
+
 	g_assert_cmpint(ret, ==, 0);
 }
 
@@ -381,6 +401,28 @@ static void test_get_configuration(gconstpointer data)
 	g_free(test->pdu_list);
 }
 
+static void test_open(gconstpointer data)
+{
+	const struct test_data *test = data;
+	struct context *context = create_context(0x0100);
+	struct avdtp_local_sep *sep;
+
+	context->pdu_list = test->pdu_list;
+
+	sep = avdtp_register_sep(AVDTP_SEP_TYPE_SINK, AVDTP_MEDIA_TYPE_AUDIO,
+					0x00, FALSE, NULL, &sep_cfm,
+					context);
+	context->sep = sep;
+
+	avdtp_discover(context->session, discover_cb, context);
+
+	execute_context(context);
+
+	avdtp_unregister_sep(sep);
+
+	g_free(test->pdu_list);
+}
+
 int main(int argc, char *argv[])
 {
 	g_test_init(&argc, &argv, NULL);
@@ -448,6 +490,16 @@ int main(int argc, char *argv[])
 			raw_pdu(0x30, 0x04, 0x04),
 			raw_pdu(0x32, 0x04, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
 				0x21, 0x02, 0x02, 0x20));
+	define_test("/TP/SIG/SMG/BV-15-C", test_open,
+			raw_pdu(0xa0, 0x01),
+			raw_pdu(0xa2, 0x01, 0x04, 0x00),
+			raw_pdu(0xb0, 0x02, 0x04),
+			raw_pdu(0xb2, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+				0xff, 0xff, 0x02, 0x40),
+			raw_pdu(0xc0, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+				0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+			raw_pdu(0xc2, 0x03),
+			raw_pdu(0xd0, 0x06, 0x04));
 
 	return g_test_run();
 }
-- 
1.8.3.1


  parent reply	other threads:[~2013-11-25 13:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 13:10 [PATCH BlueZ 00/19] Initial AVDTP for Android Luiz Augusto von Dentz
2013-11-25 13:10 ` [PATCH BlueZ 01/19] android: Add initial AVDTP code Luiz Augusto von Dentz
2013-11-25 13:10 ` [PATCH BlueZ 02/19] unit/AVDTP: Add /TP/SIG/SMG/BV-05-C test Luiz Augusto von Dentz
2013-11-25 13:10 ` [PATCH BlueZ 03/19] unit/AVDTP: Add /TP/SIG/SMG/BV-06-C test Luiz Augusto von Dentz
2013-11-25 13:10 ` [PATCH BlueZ 04/19] unit/AVDTP: Add /TP/SIG/SMG/BV-07-C test Luiz Augusto von Dentz
2013-11-25 13:10 ` [PATCH BlueZ 05/19] unit/AVDTP: Add /TP/SIG/SMG/BV-08-C test Luiz Augusto von Dentz
2013-11-25 13:10 ` [PATCH BlueZ 06/19] unit/AVDTP: Add /TP/SIG/SMG/BV-09-C test Luiz Augusto von Dentz
2013-11-25 13:10 ` [PATCH BlueZ 07/19] unit/AVDTP: Add /TP/SIG/SMG/BV-10-C test Luiz Augusto von Dentz
2013-11-25 13:10 ` [PATCH BlueZ 08/19] unit/AVDTP: Add /TP/SIG/SMG/BV-11-C test Luiz Augusto von Dentz
2013-11-25 13:11 ` [PATCH BlueZ 09/19] unit/AVDTP: Add /TP/SIG/SMG/BV-12-C test Luiz Augusto von Dentz
2013-11-25 13:11 ` Luiz Augusto von Dentz [this message]
2013-11-25 13:11 ` [PATCH BlueZ 11/19] unit/AVDTP: Add /TP/SIG/SMG/BV-16-C test Luiz Augusto von Dentz
2013-11-25 13:11 ` [PATCH BlueZ 12/19] unit/AVDTP: Add /TP/SIG/SMG/BV-17-C test Luiz Augusto von Dentz
2013-11-25 13:11 ` [PATCH BlueZ 13/19] unit/AVDTP: Add /TP/SIG/SMG/BV-18-C test Luiz Augusto von Dentz
2013-11-25 13:11 ` [PATCH BlueZ 14/19] unit/AVDTP: Add /TP/SIG/SMG/BV-19-C test Luiz Augusto von Dentz
2013-11-25 13:11 ` [PATCH BlueZ 15/19] unit/AVDTP: Add /TP/SIG/SMG/BV-20-C test Luiz Augusto von Dentz
2013-11-25 13:11 ` [PATCH BlueZ 16/19] unit/AVDTP: Add /TP/SIG/SMG/BV-21-C test Luiz Augusto von Dentz
2013-11-25 13:11 ` [PATCH BlueZ 17/19] unit/AVDTP: Add /TP/SIG/SMG/BV-22-C test Luiz Augusto von Dentz
2013-11-25 13:11 ` [PATCH BlueZ 18/19] unit/AVDTP: Add /TP/SIG/SMG/BV-23-C test Luiz Augusto von Dentz
2013-11-25 13:11 ` [PATCH BlueZ 19/19] unit/AVDTP: Add /TP/SIG/SMG/BV-24-C test Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1385385070-21010-11-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox