summaryrefslogtreecommitdiff
path: root/tests/test-service-proxy.c
blob: f81b1342ef3f3d9c9ba03c5dc4bbcaefe68847c6 (plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
/*
 * Copyright (C) 2021 Jens Georg.
 *
 * Author: Jens Georg <mail@jensge.org>
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include <config.h>

#include "libgupnp/gupnp.h"
#include "libgupnp/gupnp-service-private.h"

#include <string.h>
#include <libsoup/soup.h>

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>

static GUPnPContext *
create_context (const char *localhost, guint16 port, GError **error)
{
        return GUPNP_CONTEXT (g_initable_new (GUPNP_TYPE_CONTEXT,
                                              NULL,
                                              error,
                                              "host-ip",
                                              localhost,
                                              "port",
                                              port,
                                              NULL));
}

typedef struct {
        GMainLoop *loop;
        GUPnPContext *server_context;
        GUPnPContext *client_context;
        GUPnPRootDevice *rd;
        GUPnPServiceInfo *service;
        GUPnPControlPoint *cp;
        GUPnPServiceProxy *proxy;
        gpointer payload;
} ProxyTestFixture;

static gboolean
test_on_timeout (gpointer user_data)
{
        g_print ("Timeout in %s\n", (const char *) user_data);
        g_assert_not_reached ();

        return FALSE;
}

static void
test_run_loop (GMainLoop *loop, const char *name)
{
        guint timeout_id = 0;
        int timeout = 2;

        const char *timeout_str = g_getenv ("GUPNP_TEST_TIMEOUT");
        if (timeout_str != NULL) {
                long t = atol (timeout_str);
                if (t != 0)
                        timeout = t;
        }

        timeout_id = g_timeout_add_seconds (timeout,
                                            test_on_timeout,
                                            (gpointer) name);
        g_main_loop_run (loop);
        g_source_remove (timeout_id);
}

static void
on_proxy_available (G_GNUC_UNUSED GUPnPControlPoint *cp,
                    GUPnPServiceProxy *proxy,
                    gpointer user_data)
{
        ProxyTestFixture *tf = user_data;

        tf->proxy = g_object_ref (proxy);
        g_main_loop_quit (tf->loop);
}

static void
test_fixture_setup (ProxyTestFixture *tf, gconstpointer user_data)
{
        GError *error = NULL;

        tf->loop = g_main_loop_new (NULL, FALSE);
        g_assert_nonnull (tf->loop);

        // Create server part
        tf->server_context =
                create_context ((const char *) user_data, 0, &error);
        g_assert_nonnull (tf->server_context);
        g_assert_no_error (error);
        GUPnPResourceFactory *factory = gupnp_resource_factory_new ();
        tf->rd = gupnp_root_device_new_full (tf->server_context,
                                             factory,
                                             NULL,
                                             "TestDevice.xml",
                                             DATA_PATH,
                                             &error);
        g_object_unref (factory);
        g_assert_no_error (error);
        g_assert_nonnull (tf->rd);
        tf->service = gupnp_device_info_get_service (
                GUPNP_DEVICE_INFO (tf->rd),
                "urn:test-gupnp-org:service:TestService:1");

        // Create client part
        tf->client_context =
                create_context ((const char *) user_data, 0, &error);

        g_assert_nonnull (tf->client_context);
        g_assert_no_error (error);
        tf->cp = gupnp_control_point_new (
                tf->client_context,
                "urn:test-gupnp-org:service:TestService:1");

        gulong id = g_signal_connect (tf->cp,
                                      "service-proxy-available",
                                      G_CALLBACK (on_proxy_available),
                                      tf);
        gupnp_root_device_set_available (tf->rd, TRUE);
        gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (tf->cp),
                                           TRUE);
        test_run_loop (tf->loop, "Test fixture setup");
        g_signal_handler_disconnect (tf->cp, id);
}

static gboolean
delayed_loop_quitter (gpointer user_data)
{
        g_main_loop_quit (user_data);
        return G_SOURCE_REMOVE;
}

static void
test_fixture_teardown (ProxyTestFixture *tf, gconstpointer user_data)
{
        g_clear_object (&tf->proxy);
        g_object_unref (tf->cp);
        g_object_unref (tf->client_context);

        g_object_unref (tf->service);
        g_object_unref (tf->rd);
        g_object_unref (tf->server_context);

        // Make sure the source teardown handlers get run so we don't confuse valgrind
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop);
        g_main_loop_run (tf->loop);
        g_main_loop_unref (tf->loop);
}

// Test that calls a remote function and does not even connect to any callback
// Is is mainly useful to check in combination with ASAN/Valgrind to make sure
// that nothing gets leaked on the way
void
test_fire_and_forget (ProxyTestFixture *tf,
                      G_GNUC_UNUSED gconstpointer user_data)
{
        // Run fire and forget for action that does not have any kind of arguments
        GUPnPServiceProxyAction *action =
                gupnp_service_proxy_action_new ("Ping", NULL);

        gupnp_service_proxy_call_action_async (tf->proxy,
                                               action,
                                               NULL,
                                               NULL,
                                               NULL);
        gupnp_service_proxy_action_unref (action);

        // Spin the loop for a bit...
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop);
        g_main_loop_run (tf->loop);

        // Run fire and forget for a more complex action
        action = gupnp_service_proxy_action_new ("Browse",
                                                 "ObjectID",
                                                 G_TYPE_STRING,
                                                 "0",
                                                 "BrowseFlag",
                                                 G_TYPE_STRING,
                                                 "BrowseDirectChildren",
                                                 "Filter",
                                                 G_TYPE_STRING,
                                                 "res,dc:date,res@size",
                                                 "StartingIndex",
                                                 G_TYPE_UINT,
                                                 0,
                                                 "RequestedCount",
                                                 G_TYPE_UINT,
                                                 0,
                                                 "SortCriteria",
                                                 G_TYPE_STRING,
                                                 "",
                                                 NULL);

        gupnp_service_proxy_call_action_async (tf->proxy,
                                               action,
                                               NULL,
                                               NULL,
                                               NULL);
        gupnp_service_proxy_action_unref (action);

        // Spin the loop for a bit...
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop);
        g_main_loop_run (tf->loop);
}

void
on_test_async_call_ping_success (G_GNUC_UNUSED GUPnPService *service,
                                 G_GNUC_UNUSED GUPnPServiceAction *action,
                                 G_GNUC_UNUSED gpointer user_data)
{
        gupnp_service_action_return_success (action);
}

void
on_test_async_call (GObject *source, GAsyncResult *res, gpointer user_data)
{
        GError *error = NULL;
        g_assert_nonnull (user_data);

        gupnp_service_proxy_call_action_finish (GUPNP_SERVICE_PROXY (source),
                                                res,
                                                &error);
        g_assert_no_error (error);

        ProxyTestFixture *tf = (ProxyTestFixture *) user_data;
        g_main_loop_quit (tf->loop);
}

void
test_async_call (ProxyTestFixture *tf, G_GNUC_UNUSED gconstpointer user_data)
{
        // Run fire and forget for action that does not have any kind of arguments
        GUPnPServiceProxyAction *action =
                gupnp_service_proxy_action_new ("Ping", NULL);

        g_signal_connect (tf->service,
                          "action-invoked::Ping",
                          G_CALLBACK (on_test_async_call_ping_success),
                          tf);

        g_signal_connect (tf->service,
                          "action-invoked::Browse",
                          G_CALLBACK (on_test_async_call_ping_success),
                          tf);

        gupnp_service_proxy_call_action_async (tf->proxy,
                                               action,
                                               NULL,
                                               on_test_async_call,
                                               tf);
        gupnp_service_proxy_action_unref (action);
        test_run_loop(tf->loop, g_test_get_path());

        // Run fire and forget for a more complex action
        action = gupnp_service_proxy_action_new ("Browse",
                                                 "ObjectID",
                                                 G_TYPE_STRING,
                                                 "0",
                                                 "BrowseFlag",
                                                 G_TYPE_STRING,
                                                 "BrowseDirectChildren",
                                                 "Filter",
                                                 G_TYPE_STRING,
                                                 "res,dc:date,res@size",
                                                 "StartingIndex",
                                                 G_TYPE_UINT,
                                                 0,
                                                 "RequestedCount",
                                                 G_TYPE_UINT,
                                                 0,
                                                 "SortCriteria",
                                                 G_TYPE_STRING,
                                                 "",
                                                 NULL);

        gupnp_service_proxy_call_action_async (tf->proxy,
                                               action,
                                               NULL,
                                               on_test_async_call,
                                               tf);
        gupnp_service_proxy_action_unref (action);
        test_run_loop (tf->loop, g_test_get_path ());

        // Spin the loop for a bit...
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop);
        g_main_loop_run (tf->loop);
}

void
on_test_async_call_ping_delay (G_GNUC_UNUSED GUPnPService *service,
                               G_GNUC_UNUSED GUPnPServiceAction *action,
                               gpointer user_data)
{
        g_debug ("=> Ping delay");
        ProxyTestFixture *tf = (ProxyTestFixture *) user_data;
        tf->payload = action;
        g_main_loop_quit (tf->loop);
}

void
on_test_async_cancel_call (GObject *source,
                           GAsyncResult *res,
                           gpointer user_data)
{
        GError *error = NULL;
        g_assert_nonnull (user_data);

        gupnp_service_proxy_call_action_finish (GUPNP_SERVICE_PROXY (source),
                                                res,
                                                &error);

        g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
        g_clear_error (&error);

        ProxyTestFixture *tf = (ProxyTestFixture *) user_data;
        g_main_loop_quit (tf->loop);
}

void
test_async_cancel_call (ProxyTestFixture *tf,
                        G_GNUC_UNUSED gconstpointer user_data)
{
        GUPnPServiceProxyAction *action =
                gupnp_service_proxy_action_new ("Ping", NULL);

        g_signal_connect (tf->service,
                          "action-invoked::Ping",
                          G_CALLBACK (on_test_async_call_ping_delay),
                          tf);

        GCancellable *cancellable = g_cancellable_new ();
        gupnp_service_proxy_call_action_async (tf->proxy,
                                               action,
                                               cancellable,
                                               on_test_async_cancel_call,
                                               tf);

        // This should be called by the action callback
        test_run_loop (tf->loop, g_test_get_path ());
        g_cancellable_cancel (cancellable);

        // This should be finished by the now-cancelled proxy call
        test_run_loop (tf->loop, g_test_get_path ());

        // Free action. There should not be any callback
        gupnp_service_action_return_success (
                (GUPnPServiceAction *) tf->payload);

        GError *error = NULL;
        gupnp_service_proxy_action_get_result (action, &error, NULL);
        g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
        g_clear_error (&error);

        gupnp_service_proxy_action_unref (action);
        g_object_unref (cancellable);

        // Spin the loop for a bit...
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop);
        g_main_loop_run (tf->loop);
}


void
test_async_call_destroy_with_pending (ProxyTestFixture *tf,
                                      gconstpointer user_data)
{

        GList *actions = NULL;
        // Since the session in the context is using defaults, we can only have
        // two concurrent connections on a remote host
        for (int i = 0; i < 2; i++) {
                GUPnPServiceProxyAction *action =
                        gupnp_service_proxy_action_new ("Ping", NULL);

                gupnp_service_proxy_call_action_async (tf->proxy,
                                                       action,
                                                       NULL,
                                                       NULL,
                                                       NULL);
                gupnp_service_proxy_action_unref (action);

                // This should be called by the action callback
                gulong id = g_signal_connect (
                        tf->service,
                        "action-invoked::Ping",
                        G_CALLBACK (on_test_async_call_ping_delay),
                        tf);
                test_run_loop (tf->loop, g_test_get_path ());
                g_signal_handler_disconnect (tf->service, id);

                actions = g_list_prepend (actions, tf->payload);
        }

        // free the actions
        g_list_free_full (actions, (GDestroyNotify) gupnp_service_action_unref);

        g_clear_object (&tf->proxy);

        // Spin the loop for a bit...
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop);
        g_main_loop_run (tf->loop);
}

typedef struct {
        GMainLoop *outer_loop;
        GMainContext *outer_context;
        const char *address;
        GCancellable *cancellable;
        GError expected_error;
} ThreadData;

typedef struct {
        GMainLoop *loop;
        GUPnPServiceProxy *p;
} GetProxyData;

void
thead_on_proxy_available (GUPnPControlPoint *cp,
                          GUPnPServiceProxy *p,
                          gpointer user_data)
{
        GetProxyData *d = (GetProxyData *) user_data;
        d->p = g_object_ref (p);
        g_main_loop_quit (d->loop);
}

gboolean
exit_outer_loop (gpointer user_data)
{
        ThreadData *d = (ThreadData *) user_data;
        g_main_loop_quit (d->outer_loop);

        return G_SOURCE_REMOVE;
}

gpointer
thread_func (gpointer data)
{
        ThreadData *d = (ThreadData *) data;
        GMainContext *context = g_main_context_new ();
        GError *error = NULL;
        g_main_context_push_thread_default (context);

        GUPnPContext *ctx = create_context (d->address, 0, &error);
        g_assert_no_error (error);
        g_assert_nonnull (ctx);

        GUPnPControlPoint *cp = gupnp_control_point_new (
                ctx,
                "urn:test-gupnp-org:service:TestService:1");
        GetProxyData gpd;
        gulong id = g_signal_connect (cp,
                                      "service-proxy-available",
                                      G_CALLBACK (thead_on_proxy_available),
                                      &gpd);
        gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (cp), TRUE);

        gpd.loop = g_main_loop_new (context, FALSE);
        test_run_loop (gpd.loop, "Test thread setup");
        g_signal_handler_disconnect (cp, id);

        GUPnPServiceProxyAction *action =
                gupnp_service_proxy_action_new ("Ping", NULL);

        gupnp_service_proxy_call_action (gpd.p, action, d->cancellable, &error);
        gupnp_service_proxy_action_unref (action);

        if (d->expected_error.domain != 0)
                g_assert_error (error,
                                d->expected_error.domain,
                                d->expected_error.code);

        g_object_unref (gpd.p);
        g_object_unref (cp);
        g_object_unref (ctx);

        // Spin the loop for a bit...
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, gpd.loop);
        g_main_loop_run (gpd.loop);

        g_main_loop_unref (gpd.loop);
        g_main_context_pop_thread_default (context);
        g_main_context_unref (context);

        g_main_context_invoke (d->outer_context, exit_outer_loop, d);

        return NULL;
}

void
test_sync_call (ProxyTestFixture *tf, gconstpointer user_data)
{
        g_signal_connect (tf->service,
                          "action-invoked::Ping",
                          G_CALLBACK (on_test_async_call_ping_success),
                          tf);
        ThreadData d;
        d.address = (const char *) user_data;
        d.outer_context = g_main_context_get_thread_default ();
        d.outer_loop = tf->loop;
        d.cancellable = NULL;
        d.expected_error.domain = 0;

        GThread *t = g_thread_new ("Sync call test", thread_func, &d);
        test_run_loop (tf->loop, g_test_get_path());
        g_thread_join (t);

        // Spin the loop for a bit...
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop);
        g_main_loop_run (tf->loop);

        g_thread_unref (t);
}

gboolean
cancel_sync_call (gpointer user_data)
{
        ThreadData *d = (ThreadData *) user_data;

        g_print ("Cancelling...\n");
        g_cancellable_cancel (d->cancellable);

        return G_SOURCE_REMOVE;
}

void
test_cancel_sync_call (ProxyTestFixture *tf, gconstpointer user_data)
{
        g_signal_connect (tf->service,
                          "action-invoked::Ping",
                          G_CALLBACK (on_test_async_call_ping_delay),
                          tf);
        ThreadData d;
        d.address = (const char *) user_data;
        d.outer_context = g_main_context_get_thread_default ();
        d.outer_loop = tf->loop;
        d.cancellable = g_cancellable_new ();
        d.expected_error.domain = G_IO_ERROR;
        d.expected_error.code = G_IO_ERROR_CANCELLED;

        GThread *t = g_thread_new ("Sync call cancel test", thread_func, &d);
        test_run_loop (tf->loop, g_test_get_path());

        g_timeout_add_seconds (1, (GSourceFunc) cancel_sync_call, &d);
        test_run_loop (tf->loop, g_test_get_path());

        g_thread_join (t);

        // Spin the loop for a bit...
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop);
        g_main_loop_run (tf->loop);
        g_thread_unref (t);
}

void
on_test_async_call_ping_error (G_GNUC_UNUSED GUPnPService *service,
                               GUPnPServiceAction *action,
                               gpointer user_data)
{
        gupnp_service_action_return_error (action,
                                           GUPNP_CONTROL_ERROR_OUT_OF_SYNC,
                                           "Test error");
}

void
on_test_soap_error (GObject *source, GAsyncResult *res, gpointer user_data)
{
        GError *error = NULL;
        g_assert_nonnull (user_data);

        gupnp_service_proxy_call_action_finish (GUPNP_SERVICE_PROXY (source),
                                                res,
                                                &error);
        g_assert_error (error,
                        GUPNP_CONTROL_ERROR,
                        GUPNP_CONTROL_ERROR_OUT_OF_SYNC);

        g_clear_error (&error);

        ProxyTestFixture *tf = (ProxyTestFixture *) user_data;
        g_main_loop_quit (tf->loop);
}

void
test_finish_soap_error (ProxyTestFixture *tf, gconstpointer user_data)
{
        g_signal_connect (tf->service,
                          "action-invoked::Ping",
                          G_CALLBACK (on_test_async_call_ping_error),
                          tf);

        GUPnPServiceProxyAction *action =
                gupnp_service_proxy_action_new ("Ping", NULL);

        gupnp_service_proxy_call_action_async (tf->proxy,
                                               action,
                                               NULL,
                                               on_test_soap_error,
                                               tf);

        gupnp_service_proxy_action_unref (action);
        test_run_loop (tf->loop, g_test_get_path ());

        // Spin the loop for a bit...
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop);
        g_main_loop_run (tf->loop);
}

void
test_finish_soap_error_sync (ProxyTestFixture *tf, gconstpointer user_data)
{
        g_signal_connect (tf->service,
                          "action-invoked::Ping",
                          G_CALLBACK (on_test_async_call_ping_error),
                          tf);
        ThreadData d;
        d.address = (const char *) user_data;
        d.outer_context = g_main_context_get_thread_default ();
        d.outer_loop = tf->loop;
        d.cancellable = NULL;
        d.expected_error.domain = GUPNP_CONTROL_ERROR;
        d.expected_error.code = GUPNP_CONTROL_ERROR_OUT_OF_SYNC;

        GThread *t = g_thread_new ("Sync call test", thread_func, &d);
        test_run_loop (tf->loop, g_test_get_path ());
        g_thread_join (t);

        // Spin the loop for a bit...
        g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop);
        g_main_loop_run (tf->loop);
        g_thread_unref (t);
}

int
main (int argc, char *argv[])
{
        g_test_init (&argc, &argv, NULL);

        g_test_add ("/service-proxy/async/fire-and-forget",
                    ProxyTestFixture,
                    "127.0.0.1",
                    test_fixture_setup,
                    test_fire_and_forget,
                    test_fixture_teardown);

        g_test_add ("/service-proxy/async/call",
                    ProxyTestFixture,
                    "127.0.0.1",
                    test_fixture_setup,
                    test_async_call,
                    test_fixture_teardown);

        g_test_add ("/service-proxy/async/cancel",
                    ProxyTestFixture,
                    "127.0.0.1",
                    test_fixture_setup,
                    test_async_cancel_call,
                    test_fixture_teardown);

        g_test_add ("/service-proxy/async/destroy-with-pending",
                    ProxyTestFixture,
                    "127.0.0.1",
                    test_fixture_setup,
                    test_async_call_destroy_with_pending,
                    test_fixture_teardown);

        g_test_add ("/service-proxy/async/soap-error-in-finish",
                    ProxyTestFixture,
                    "127.0.0.1",
                    test_fixture_setup,
                    test_finish_soap_error,
                    test_fixture_teardown);

        g_test_add ("/service-proxy/sync/call",
                    ProxyTestFixture,
                    "127.0.0.1",
                    test_fixture_setup,
                    test_sync_call,
                    test_fixture_teardown);

        g_test_add ("/service-proxy/sync/cancel-call",
                    ProxyTestFixture,
                    "127.0.0.1",
                    test_fixture_setup,
                    test_cancel_sync_call,
                    test_fixture_teardown);

        g_test_add ("/service-proxy/sync/soap-error-in-finish",
                    ProxyTestFixture,
                    "127.0.0.1",
                    test_fixture_setup,
                    test_finish_soap_error_sync,
                    test_fixture_teardown);

        return g_test_run ();
}