1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/* A very basic feature test for TpChannelDispatcher
*
* Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
* Copyright (C) 2009 Nokia Corporation
*
* Copying and distribution of this file, with or without modification,
* are permitted in any medium without royalty provided the copyright
* notice and this notice are preserved.
*/
#include "config.h"
#include <telepathy-glib/channel-dispatcher.h>
#include <telepathy-glib/debug.h>
#include "tests/lib/util.h"
typedef struct {
GMainLoop *mainloop;
TpDBusDaemon *dbus;
TpChannelDispatcher *cd;
GError *error /* initialized where needed */;
} Test;
static void
setup (Test *test,
gconstpointer data)
{
tp_debug_set_flags ("all");
test->mainloop = g_main_loop_new (NULL, FALSE);
test->dbus = tp_tests_dbus_daemon_dup_or_die ();
test->cd = NULL;
}
static void
teardown (Test *test,
gconstpointer data)
{
if (test->cd != NULL)
{
g_object_unref (test->cd);
test->cd = NULL;
}
/* make sure any pending things have happened */
tp_tests_proxy_run_until_dbus_queue_processed (test->dbus);
g_object_unref (test->dbus);
test->dbus = NULL;
g_main_loop_unref (test->mainloop);
test->mainloop = NULL;
}
static void
test_new (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
TpClientFactory *factory;
factory = tp_client_factory_new (test->dbus);
test->cd = tp_client_factory_ensure_channel_dispatcher (factory);
g_assert (test->cd != NULL);
g_object_unref (factory);
}
int
main (int argc,
char **argv)
{
tp_tests_init (&argc, &argv);
g_test_bug_base ("http://bugs.freedesktop.org/show_bug.cgi?id=");
g_test_add ("/cd/new", Test, NULL, setup, test_new, teardown);
/* tp_channel_dispatcher_present_channel_async() is tested in
* test-base-client */
return tp_tests_run_with_bus ();
}
|