diff options
author | Lukasz Rymanowski <lukasz.rymanowski@tieto.com> | 2014-11-20 16:55:15 +0100 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-11-24 12:56:40 +0100 |
commit | 7c5c536550a5710b2e610596703dd625b4eb0480 (patch) | |
tree | 14c389779b66ea3cb2cccd8c51ab5039d36dc2fb /unit/test-hfp.c | |
parent | fca4a8c3466c41f0dd56c1074217cfbbce6c5528 (diff) | |
download | bluez-7c5c536550a5710b2e610596703dd625b4eb0480.tar.gz |
unit/test-hfp: Fix parsing empty string test
Empty string shall be ignored by AT parser and no response shall be
sent. Therefore this test should close HFP connection just after empty
string is sent, otherwise test hungs.
Diffstat (limited to 'unit/test-hfp.c')
-rw-r--r-- | unit/test-hfp.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/unit/test-hfp.c b/unit/test-hfp.c index b22b8a535..face9a4c5 100644 --- a/unit/test-hfp.c +++ b/unit/test-hfp.c @@ -358,6 +358,25 @@ static void test_fragmented(gconstpointer data) execute_context(context); } +static void test_send_and_close(gconstpointer data) +{ + struct context *context = create_context(data); + bool ret; + + context->hfp = hfp_gw_new(context->fd_client); + g_assert(context->hfp); + + ret = hfp_gw_set_close_on_unref(context->hfp, true); + g_assert(ret); + + send_pdu(context); + + hfp_gw_unref(context->hfp); + context->hfp = NULL; + + execute_context(context); +} + static void check_ustring_1(struct hfp_context *result, enum hfp_gw_cmd_type type, void *user_data) { @@ -744,7 +763,7 @@ int main(int argc, char *argv[]) '\"', '\r'), type_pdu(HFP_GW_CMD_TYPE_SET, 0), data_end()); - define_test("/hfp/test_empty", test_fragmented, NULL, + define_test("/hfp/test_empty", test_send_and_close, NULL, raw_pdu('\r'), data_end()); define_hf_test("/hfp_hf/test_init", test_hf_init, NULL, NULL, |