diff options
author | Lukasz Rymanowski <lukasz.rymanowski@tieto.com> | 2014-10-24 13:59:31 +0200 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-10-28 08:12:24 +0100 |
commit | fff97d80860ff037b580625e392a1396ce611a39 (patch) | |
tree | d2a447c5656dbbbc16da711a5544c5a0e90c4cd3 /unit/test-hfp.c | |
parent | d68c6e6fe695219e73c808621e839d1d8e9d0036 (diff) | |
download | bluez-fff97d80860ff037b580625e392a1396ce611a39.tar.gz |
unit/test-hfp: Provide test_handler function via struct data
This patch allows us to use user defined test handler depends on needs.
Will use it in following patches which implements tests for HFP HF.
Diffstat (limited to 'unit/test-hfp.c')
-rw-r--r-- | unit/test-hfp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/unit/test-hfp.c b/unit/test-hfp.c index a8801b0dc..4b3473b6a 100644 --- a/unit/test-hfp.c +++ b/unit/test-hfp.c @@ -52,6 +52,7 @@ struct test_data { char *test_name; struct test_pdu *pdu_list; hfp_result_func_t result_func; + GIOFunc test_handler; }; #define data(args...) ((const unsigned char[]) { args }) @@ -95,6 +96,7 @@ struct test_data { data.result_func = result_function; \ memcpy(data.pdu_list, pdus, sizeof(pdus)); \ g_test_add_data_func(name, &data, function); \ + data.test_handler = test_handler; \ } while (0) static void context_quit(struct context *context) @@ -158,6 +160,7 @@ static struct context *create_context(gconstpointer data) struct context *context = g_new0(struct context, 1); GIOChannel *channel; int err, sv[2]; + const struct test_data *d = data; context->main_loop = g_main_loop_new(NULL, FALSE); g_assert(context->main_loop); @@ -173,7 +176,8 @@ static struct context *create_context(gconstpointer data) context->watch_id = g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, - test_handler, context); + d->test_handler, context); + g_assert(context->watch_id > 0); g_io_channel_unref(channel); |