~ubuntu-branches/ubuntu/vivid/freerdp/vivid

« back to all changes in this revision

Viewing changes to cunit/test_channels.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2014-11-11 12:20:50 UTC
  • mfrom: (1.1.9) (9.1.17 sid)
  • Revision ID: package-import@ubuntu.com-20141111122050-wyr8hrnwco9fcmum
Tags: 1.1.0~git20140921.1.440916e+dfsg1-2ubuntu1
* Merge with Debian unstable, remaining changes
  - Disable ffmpeg support
* Disable gstreamer support, this relies on gstreamer 0.10 and we don't want
  to add any more deps on that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * FreeRDP: A Remote Desktop Protocol Client
3
 
 * Channel Manager Unit Tests
4
 
 *
5
 
 * Copyright 2011 Vic Lee
6
 
 *
7
 
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 
 * you may not use this file except in compliance with the License.
9
 
 * You may obtain a copy of the License at
10
 
 *
11
 
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 
 *
13
 
 * Unless required by applicable law or agreed to in writing, software
14
 
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 
 * See the License for the specific language governing permissions and
17
 
 * limitations under the License.
18
 
 */
19
 
 
20
 
#include <stdio.h>
21
 
#include <string.h>
22
 
#include <stdlib.h>
23
 
#include <freerdp/freerdp.h>
24
 
#include <freerdp/constants.h>
25
 
#include <freerdp/channels/channels.h>
26
 
#include <freerdp/utils/event.h>
27
 
 
28
 
#include "test_channels.h"
29
 
 
30
 
int init_chanman_suite(void)
31
 
{
32
 
        freerdp_channels_global_init();
33
 
        return 0;
34
 
}
35
 
 
36
 
int clean_chanman_suite(void)
37
 
{
38
 
        freerdp_channels_global_uninit();
39
 
        return 0;
40
 
}
41
 
 
42
 
int add_chanman_suite(void)
43
 
{
44
 
        add_test_suite(chanman);
45
 
 
46
 
        add_test_function(chanman);
47
 
 
48
 
        return 0;
49
 
}
50
 
 
51
 
static int test_rdp_channel_data(freerdp* instance, int chan_id, uint8* data, int data_size)
52
 
{
53
 
        printf("chan_id %d data_size %d\n", chan_id, data_size);
54
 
        return 0;
55
 
}
56
 
 
57
 
void test_chanman(void)
58
 
{
59
 
        rdpChannels* chan_man;
60
 
        rdpSettings settings = { 0 };
61
 
        freerdp instance = { 0 };
62
 
        RDP_EVENT* event;
63
 
 
64
 
        settings.hostname = "testhost";
65
 
        instance.settings = &settings;
66
 
        instance.SendChannelData = test_rdp_channel_data;
67
 
 
68
 
        chan_man = freerdp_channels_new();
69
 
 
70
 
        freerdp_channels_load_plugin(chan_man, &settings, "../channels/rdpdbg/rdpdbg.so", NULL);
71
 
        freerdp_channels_pre_connect(chan_man, &instance);
72
 
        freerdp_channels_post_connect(chan_man, &instance);
73
 
 
74
 
        freerdp_channels_data(&instance, 0, "testdata", 8, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 8);
75
 
        freerdp_channels_data(&instance, 0, "testdata1", 9, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 9);
76
 
        freerdp_channels_data(&instance, 0, "testdata11", 10, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 10);
77
 
        freerdp_channels_data(&instance, 0, "testdata111", 11, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 11);
78
 
 
79
 
        event = freerdp_event_new(RDP_EVENT_CLASS_DEBUG, 0, NULL, NULL);
80
 
        freerdp_channels_send_event(chan_man, event);
81
 
 
82
 
        while ((event = freerdp_channels_pop_event(chan_man)) == NULL)
83
 
        {
84
 
                freerdp_channels_check_fds(chan_man, &instance);
85
 
        }
86
 
        printf("responded event_type %d\n", event->event_type);
87
 
        freerdp_event_free(event);
88
 
 
89
 
        freerdp_channels_close(chan_man, &instance);
90
 
        freerdp_channels_free(chan_man);
91
 
}