summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-05-03 16:47:42 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-05-07 15:33:49 +0200
commit3e2db10fc246a1866284483d22b51ba0280af31d (patch)
tree9e8619396d7b22363d643ea40abe5f1de4b6cd80
parent2a4e0ad89d566a5cdd8e7bea131b2c31468ed39a (diff)
test-base-client: test invalidating one channel while calling AddDispatchOperation
-rw-r--r--telepathy-glib/add-dispatch-operation-context.c1
-rw-r--r--tests/dbus/base-client.c29
2 files changed, 28 insertions, 2 deletions
diff --git a/telepathy-glib/add-dispatch-operation-context.c b/telepathy-glib/add-dispatch-operation-context.c
index d7fbcdf0..6e7972a7 100644
--- a/telepathy-glib/add-dispatch-operation-context.c
+++ b/telepathy-glib/add-dispatch-operation-context.c
@@ -542,7 +542,6 @@ channel_prepare_cb (GObject *source,
{
DEBUG ("Failed to prepare channel: %s", error->message);
- g_ptr_array_remove (self->channels, source);
g_error_free (error);
}
diff --git a/tests/dbus/base-client.c b/tests/dbus/base-client.c
index 6fd54522..e9dceb99 100644
--- a/tests/dbus/base-client.c
+++ b/tests/dbus/base-client.c
@@ -208,7 +208,8 @@ teardown (Test *test,
g_object_unref (test->text_chan_service);
g_object_unref (test->text_chan);
- g_object_unref (test->text_chan_service_2);
+ if (test->text_chan_service_2 != NULL)
+ g_object_unref (test->text_chan_service_2);
g_object_unref (test->text_chan_2);
g_object_unref (test->cdo_service);
@@ -580,6 +581,32 @@ test_approver (Test *test,
test->simple_client->add_dispatch_ctx->dispatch_operation);
g_assert_cmpuint (chans->len, ==, 2);
+ /* Another call to AddDispatchOperation, the second channel will be
+ * invalidated during the call */
+ tp_cli_client_approver_call_add_dispatch_operation (test->client, -1,
+ channels, CDO_PATH, properties,
+ no_return_cb, test, NULL, NULL);
+
+ tp_dbus_daemon_unregister_object (test->dbus, test->text_chan_service_2);
+
+ g_object_unref (test->text_chan_service_2);
+ test->text_chan_service_2 = NULL;
+
+ simple_channel_dispatch_operation_lost_channel (test->cdo_service,
+ test->text_chan_2);
+
+ g_main_loop_run (test->mainloop);
+ g_assert_no_error (test->error);
+
+ g_assert (test->simple_client->add_dispatch_ctx != NULL);
+ /* The CDO only contain valid channels */
+ chans = tp_channel_dispatch_operation_borrow_channels (
+ test->simple_client->add_dispatch_ctx->dispatch_operation);
+ g_assert_cmpuint (chans->len, ==, 1);
+ /* But the context contains both */
+ g_assert_cmpuint (test->simple_client->add_dispatch_ctx->channels->len,
+ ==, 2);
+
g_ptr_array_foreach (channels, free_channel_details, NULL);
g_ptr_array_free (channels, TRUE);
g_hash_table_unref (properties);