diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2011-12-05 14:35:19 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2011-12-08 14:25:18 +0200 |
commit | 2228a2d49dcd7edb6feab2ca02be610028d23063 (patch) | |
tree | a88af4cc2191970e775e75543a1f1580d3c2ba4e /unit/test-gobex-transfer.c | |
parent | ee6075b4c53550a07d2072f8f93297236cf383fc (diff) | |
download | obexd-2228a2d49dcd7edb6feab2ca02be610028d23063.tar.gz |
gobex: add unit test for packet PUT request with random data
Diffstat (limited to 'unit/test-gobex-transfer.c')
-rw-r--r-- | unit/test-gobex-transfer.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/unit/test-gobex-transfer.c b/unit/test-gobex-transfer.c index 5bdd71b..f677503 100644 --- a/unit/test-gobex-transfer.c +++ b/unit/test-gobex-transfer.c @@ -447,7 +447,7 @@ static void handle_get(GObex *obex, GObexPacket *req, gpointer user_data) g_main_loop_quit(d->mainloop); } -static void test_put_req_random(void) +static void test_put_req_random(int sock_type) { GIOChannel *io; GIOCondition cond; @@ -463,7 +463,7 @@ static void test_put_req_random(void) { put_rsp_first, sizeof(put_rsp_first) }, { put_rsp_last, sizeof(put_rsp_last) } } }; - create_endpoints(&obex, &io, SOCK_STREAM); + create_endpoints(&obex, &io, sock_type); d.obex = obex; cond = G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL; @@ -493,6 +493,16 @@ static void test_put_req_random(void) g_assert_no_error(d.err); } +static void test_stream_put_req_random(void) +{ + test_put_req_random(SOCK_STREAM); +} + +static void test_packet_put_req_random(void) +{ + test_put_req_random(SOCK_SEQPACKET); +} + static void test_put_req_eagain(void) { GIOChannel *io; @@ -1350,7 +1360,10 @@ int main(int argc, char *argv[]) g_test_add_func("/gobex/test_put_req_eagain", test_put_req_eagain); g_test_add_func("/gobex/test_get_req_eagain", test_get_rsp_eagain); - g_test_add_func("/gobex/test_put_req_random", test_put_req_random); + g_test_add_func("/gobex/test_stream_put_req_random", + test_stream_put_req_random); + g_test_add_func("/gobex/test_packet_put_req_random", + test_packet_put_req_random); g_test_add_func("/gobex/test_conn_get_req", test_conn_get_req); g_test_add_func("/gobex/test_conn_get_rsp", test_conn_get_rsp); |