From: <svn...@op...> - 2009-03-16 16:01:18
|
Author: bellmich Date: Mon Mar 16 17:01:07 2009 New Revision: 978 URL: http://libsyncml.opensync.org/changeset/978 Log: added code to test the transport layer context management Modified: trunk/tests/check_libsoup.c Modified: trunk/tests/check_libsoup.c ============================================================================== --- trunk/tests/check_libsoup.c Mon Mar 16 16:45:40 2009 (r977) +++ trunk/tests/check_libsoup.c Mon Mar 16 17:01:07 2009 (r978) @@ -19,6 +19,7 @@ */ #include "support.h" +#include <libsyncml/sml_queue_internals.h> #include <libsoup/soup-session-async.h> #include <libsoup/soup-uri.h> @@ -44,6 +45,13 @@ server_errors = 0; } +/* dummy callback for the transport queue */ +void transport_dummy_callback(void *message, void *userdata) +{ + /* this function should never be called */ + g_atomic_int_inc(&server_errors); +} + #ifdef HAVE_LIBSOUP22 static void server_callback(SoupServerContext *context, SoupMessage *msg, gpointer data) #else @@ -90,6 +98,13 @@ SmlThread *thread = smlThreadNew(ctx, &error); sml_fail_unless(thread != NULL, "%s", smlErrorPrint(&error)); + /* simulate the transport layer behaviour */ + + SmlQueue *queue = smlQueueNew(&error); + sml_fail_unless(queue != NULL, "%s", smlErrorPrint(&error)); + smlQueueSetHandler(queue, (SmlQueueHandler)transport_dummy_callback, NULL); + smlQueueAttach(queue, ctx); + /* create async server */ SoupServer *server = soup_server_new (SOUP_SERVER_PORT, 13001, SOUP_SERVER_ASYNC_CONTEXT, ctx, NULL); |