diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/test-tpl-channel.c | 62 | ||||
-rw-r--r-- | tests/tpl-channel-test.c | 165 | ||||
-rw-r--r-- | tests/tpl-channel-test.h | 87 |
4 files changed, 0 insertions, 317 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 53bebc5..dfef5a7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,7 +3,6 @@ SUBDIRS = $(CHECKTWISTED) suppressions lib dbus EXTRA_DIST = logs noinst_PROGRAMS = \ - test-tpl-channel \ test-tpl-conf \ $(NULL) @@ -14,7 +13,6 @@ LDADD = \ $(TPL_LIBS) test_tpl_channel_SOURCES = \ - test-tpl-channel.c \ tpl-channel-test.c \ tpl-channel-test.h \ $(NULL) @@ -50,7 +48,6 @@ check-valgrind: $(TESTS) check_c_sources = \ $(dbus_test_sources) \ tpl-channel-test.c \ - test-tpl-channel.c \ test-tpl-conf.c \ $(NULL) diff --git a/tests/test-tpl-channel.c b/tests/test-tpl-channel.c deleted file mode 100644 index a737372..0000000 --- a/tests/test-tpl-channel.c +++ /dev/null @@ -1,62 +0,0 @@ -#include "tpl-channel-test.h" - -#include <telepathy-logger/conf-internal.h> - -#define CONNECTION_PATH "org.freedesktop.Telepathy.Connection.gabble.jabber.cosimo_2ealfarano_40collabora_2eco_2euk_2fKazoo" -#define ACCOUNT_PATH "/org/freedesktop/Telepathy/Account/FOO/BAR/BAZ" -#define CHANNEL_PATH "/BAZ" - -int main (int argc, char **argv) -{ -/* - TpDBusDaemon *tp_bus_daemon; - TpAccount *acc; - TpConnection *conn; - TplChannelTest *chan; - GError *error = NULL; - - g_type_init (); - - g_debug ("FOO"); - tp_bus_daemon = tp_dbus_daemon_dup (&error); - if (tp_bus_daemon == NULL) - { - g_critical ("%s", error->message); - g_clear_error (&error); - g_error_free (error); - return 1; - } - - g_debug ("FOO"); - acc = tp_account_new (tp_bus_daemon, ACCOUNT_PATH, &error); - if (acc == NULL) - { - g_critical ("%s", error->message); - g_clear_error (&error); - g_error_free (error); - return 1; - } - - g_debug ("FOO"); - conn = tp_connection_new (tp_bus_daemon, CONNECTION_PATH, NULL, &error); - if (conn == NULL) - { - g_critical ("%s", error->message); - g_clear_error (&error); - g_error_free (error); - return 1; - } - - g_debug ("FOO"); - chan = tpl_channel_test_new (conn, CHANNEL_PATH, NULL, acc, &error); - if (chan == NULL) - { - g_critical ("%s", error->message); - g_clear_error (&error); - g_error_free (error); - return 1; - } -*/ - - return 0; -} diff --git a/tests/tpl-channel-test.c b/tests/tpl-channel-test.c deleted file mode 100644 index f571e6b..0000000 --- a/tests/tpl-channel-test.c +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2009 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> - */ - -/* - * This object acts as a Text Channel context, handling a automaton to - * set up all the needed information before connect to Text iface - * signals. - */ - -#include "tpl-channel-test.h" - -#include <telepathy-logger/action-chain-internal.h> -#include <telepathy-logger/channel-internal.h> - -static void call_when_ready_wrapper (TplChannel *tpl_chan, GAsyncReadyCallback - cb, gpointer user_data); -static void pendingproc_prepare_tpl_channel (TplActionChain *ctx, - gpointer user_data); -static void got_tpl_chan_ready_cb (GObject *obj, GAsyncResult *result, - gpointer user_data); - - -struct _TplChannelTestPriv -{ - gpointer nonempty; -}; - -G_DEFINE_TYPE (TplChannelTest, tpl_channel_test, TPL_TYPE_CHANNEL) - -static void -dispose (GObject *obj) -{ - G_OBJECT_CLASS (tpl_channel_test_parent_class)->dispose (obj); -} - -static void -finalize (GObject *obj) -{ - G_OBJECT_CLASS (tpl_channel_test_parent_class)->finalize (obj); -} - - -static void -tpl_channel_test_class_init (TplChannelTestClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - TplChannelClass *tpl_chan_class = TPL_CHANNEL_CLASS (klass); - - object_class->dispose = dispose; - object_class->finalize = finalize; - - tpl_chan_class->call_when_ready = call_when_ready_wrapper; - - g_type_class_add_private (object_class, sizeof (TplChannelTestPriv)); -} - - -static void -tpl_channel_test_init (TplChannelTest *self) -{ - TplChannelTestPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - TPL_TYPE_CHANNEL_TEST, TplChannelTestPriv); - self->priv = priv; -} - - -/** - * @conn: TpConnection instance owning the channel - * @object_path: the channel's DBus path - * @tp_chan_props: channel's immutable properties, obtained for example by - * %tp_channel_borrow_immutable_properties() - * @error: location of the GError, used in case a problem is raised while - * creating the channel - * - * Convenience function to create a new TPL Channel Text proxy. The returned - * #TplChannelTest is not guaranteed to be ready at the point of return. Use #TpChannel - * methods casting the #TplChannelTest instance to a TpChannel - * - * TplChannelTest instances are subclasses or the abstract TplChannel which is - * subclass of TpChannel. - * - * Returns: the TplChannelTest instance or %NULL in @object_path is not valid - */ -TplChannelTest * -tpl_channel_test_new (TpConnection *conn, - const gchar *object_path, - GHashTable *tp_chan_props, - TpAccount *account, - GError **error) -{ - return g_object_new (TPL_TYPE_CHANNEL_TEST, - "account", account, - NULL); -} - - -static void -call_when_ready_wrapper (TplChannel *tpl_chan, - GAsyncReadyCallback cb, - gpointer user_data) -{ - tpl_channel_test_call_when_ready (TPL_CHANNEL_TEST (tpl_chan), cb, user_data); -} - -void -tpl_channel_test_call_when_ready (TplChannelTest *self, - GAsyncReadyCallback cb, gpointer user_data) -{ - TplActionChain *actions; - - /* first: connect signals, so none are lost - * second: prepare all TplChannel - * then: us TpContact to cache my contact and the remote one. - * If for any reason, the order is changed, it's need to check what objects - * are unreferenced by g_object_unref: after the order change, it might - * happend that an object still has to be created after the change */ - actions = _tpl_action_chain_new_async (G_OBJECT (self), cb, user_data); - _tpl_action_chain_append (actions, pendingproc_prepare_tpl_channel, NULL); - /* start the queue consuming */ - _tpl_action_chain_continue (actions); -} - - -static void -pendingproc_prepare_tpl_channel (TplActionChain *ctx, - gpointer user_data) -{ - TplChannel *tpl_chan = TPL_CHANNEL (_tpl_action_chain_get_object (ctx)); - - g_debug ("prepare tpl"); - TPL_CHANNEL_GET_CLASS (tpl_chan)->call_when_ready_protected (tpl_chan, - got_tpl_chan_ready_cb, ctx); -} - - -static void -got_tpl_chan_ready_cb (GObject *obj, - GAsyncResult *result, - gpointer user_data) -{ - TplActionChain *ctx = user_data; - g_debug ("PREPARE"); - - if (_tpl_action_chain_new_finish (result) == TRUE) - _tpl_action_chain_continue (ctx); - return; -} diff --git a/tests/tpl-channel-test.h b/tests/tpl-channel-test.h deleted file mode 100644 index 4a0c23e..0000000 --- a/tests/tpl-channel-test.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2009 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> - */ - -#ifndef __TPL_CHANNEL_TEST_H__ -#define __TPL_CHANNEL_TEST_H__ - -/* - * http://telepathy.freedesktop.org/doc/telepathy-glib/telepathy-glib-channel-text.html#tp-cli-channel-type-text-connect-to-received - */ - -#include <glib-object.h> -#include <telepathy-glib/account.h> -#include <telepathy-glib/channel.h> -#include <telepathy-glib/connection.h> -#include <telepathy-glib/contact.h> -#include <telepathy-glib/svc-client.h> - -#include <telepathy-logger/channel-internal.h> -#include <telepathy-logger/observer-internal.h> - -G_BEGIN_DECLS -#define TPL_TYPE_CHANNEL_TEST (tpl_channel_test_get_type ()) -#define TPL_CHANNEL_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPL_TYPE_CHANNEL_TEST, TplChannelTest)) -#define TPL_CHANNEL_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPL_TYPE_CHANNEL_TEST, TplChannelTestClass)) -#define TPL_IS_CHANNEL_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPL_TYPE_CHANNEL_TEST)) -#define TPL_IS_CHANNEL_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPL_TYPE_CHANNEL_TEST)) -#define TPL_CHANNEL_TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_CHANNEL_TEST, TplChannelTestClass)) - -typedef struct _TplChannelTestPriv TplChannelTestPriv; -typedef struct -{ - TplChannel parent; - - /* private */ - TplChannelTestPriv *priv; -} TplChannelTest; - -typedef struct -{ - TplChannelClass parent_class; -} TplChannelTestClass; - -GType tpl_channel_test_get_type (void); - -TplChannelTest *tpl_channel_test_new (TpConnection *conn, - const gchar *object_path, GHashTable *tp_chan_props, TpAccount *account, - GError **error); - -TplChannel *tpl_channel_test_get_tpl_channel (TplChannelTest * self); -TpContact *tpl_channel_test_get_remote_contact (TplChannelTest * self); -TpContact *tpl_channel_test_get_my_contact (TplChannelTest * self); -gboolean tpl_channel_test_is_chatroom (TplChannelTest * self); -const gchar *tpl_channel_test_get_chatroom_id (TplChannelTest * self); - -void tpl_channel_test_set_tpl_channel (TplChannelTest * self, - TplChannel * tpl_chan); -void tpl_channel_test_set_remote_contact (TplChannelTest * self, - TpContact * data); -void tpl_channel_test_set_my_contact (TplChannelTest * self, - TpContact * data); -void tpl_channel_test_set_chatroom (TplChannelTest * self, gboolean data); -void tpl_channel_test_set_chatroom_id (TplChannelTest * self, - const gchar * data); - -void tpl_channel_test_call_when_ready (TplChannelTest *self, - GAsyncReadyCallback cb, gpointer user_data); - -G_END_DECLS -#endif /* __TPL_CHANNEL_TEST_H__ */ |