cunit/chanman: perform tests on channel data.
authorVic Lee <llyzs@163.com>
Sun, 10 Jul 2011 14:24:47 +0000 (22:24 +0800)
committerVic Lee <llyzs@163.com>
Sun, 10 Jul 2011 14:24:47 +0000 (22:24 +0800)
CMakeLists.txt
cunit/test_chanman.c

index 4ae4bf5..c2d1458 100644 (file)
@@ -87,5 +87,5 @@ add_subdirectory(libfreerdp-kbd)
 add_subdirectory(libfreerdp-gdi)
 add_subdirectory(libfreerdp-chanman)
 add_subdirectory(libfreerdp-core)
-
+add_subdirectory(channels)
 add_subdirectory(freerdp-ui)
index 931da8d..882368f 100644 (file)
@@ -21,6 +21,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <freerdp/freerdp.h>
+#include <freerdp/constants.h>
 #include <freerdp/chanman.h>
 
 #include "test_chanman.h"
@@ -46,13 +47,31 @@ int add_chanman_suite(void)
        return 0;
 }
 
+static int test_rdp_channel_data(rdpInst* inst, int chan_id, char* data, int data_size)
+{
+       printf("chan_id %d data_size %d\n", chan_id, data_size);
+}
+
 void test_chanman(void)
 {
        rdpChanMan* chan_man;
        rdpSettings settings = { 0 };
+       rdpInst inst = { 0 };
+
+       settings.hostname = "testhost";
+       inst.settings = &settings;
+       inst.rdp_channel_data = test_rdp_channel_data;
 
        chan_man = freerdp_chanman_new();
 
+       freerdp_chanman_load_plugin(chan_man, &settings, "../channels/rdpdbg/rdpdbg.so", NULL);
+       freerdp_chanman_pre_connect(chan_man, &inst);
+       freerdp_chanman_post_connect(chan_man, &inst);
+
+       freerdp_chanman_data(&inst, 0, "testdata", 8, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 8);
+
+       freerdp_chanman_check_fds(chan_man, &inst);
+
        freerdp_chanman_close(chan_man, NULL);
        freerdp_chanman_free(chan_man);
 }