[farsight2/master] Check that the upnp service was called

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:25:22 PST 2008


---
 tests/check/transmitter/rawudp-upnp.c |   17 +++++++++++++++--
 tests/check/transmitter/rawudp-upnp.h |    3 +++
 tests/check/transmitter/rawudp.c      |    6 ++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/tests/check/transmitter/rawudp-upnp.c b/tests/check/transmitter/rawudp-upnp.c
index f0b7918..55df3fa 100644
--- a/tests/check/transmitter/rawudp-upnp.c
+++ b/tests/check/transmitter/rawudp-upnp.c
@@ -24,11 +24,23 @@
 
 #include "check-threadsafe.h"
 
+
+gboolean got_address = FALSE;
+gboolean added_mapping = FALSE;
+
+void
+get_vars (gboolean *out_got_address,
+    gboolean *out_added_mapping)
+{
+  *out_got_address = got_address;
+  *out_added_mapping = added_mapping;
+}
+
+
 #ifdef HAVE_GUPNP
 
 #include <libgupnp/gupnp.h>
 
-
 static void
 get_external_ip_address_cb (GUPnPService *service,
     GUPnPServiceAction *action,
@@ -38,7 +50,7 @@ get_external_ip_address_cb (GUPnPService *service,
       "NewExternalIPAddress", G_TYPE_STRING, "127.0.0.1",
       NULL);
   gupnp_service_action_return (action);
-
+  got_address = TRUE;
 }
 
 static void
@@ -73,6 +85,7 @@ add_port_mapping_cb (GUPnPService *service,
   ts_fail_unless (desc != NULL, "no desc");
 
   gupnp_service_action_return (action);
+  added_mapping = TRUE;
 }
 
 
diff --git a/tests/check/transmitter/rawudp-upnp.h b/tests/check/transmitter/rawudp-upnp.h
index d1bb2ee..2c6d84f 100644
--- a/tests/check/transmitter/rawudp-upnp.h
+++ b/tests/check/transmitter/rawudp-upnp.h
@@ -24,4 +24,7 @@
 
 GObject *start_upnp_server (void);
 
+void get_vars (gboolean *out_got_address,
+    gboolean *out_added_mapping);
+
 #endif /* __RAWUDP_UPNP_H__ */
diff --git a/tests/check/transmitter/rawudp.c b/tests/check/transmitter/rawudp.c
index db0a6b3..c06160d 100644
--- a/tests/check/transmitter/rawudp.c
+++ b/tests/check/transmitter/rawudp.c
@@ -654,6 +654,8 @@ GST_START_TEST (test_rawudptransmitter_run_upnp_discovery)
 {
   GParameter params[2];
   GObject *context;
+  gboolean got_address = FALSE;
+  gboolean added_mapping = FALSE;
 
   memset (params, 0, sizeof (GParameter) * 2);
 
@@ -669,6 +671,10 @@ GST_START_TEST (test_rawudptransmitter_run_upnp_discovery)
 
   run_rawudp_transmitter_test (2, params, 0);
 
+
+  get_vars (&got_address, &added_mapping);
+  ts_fail_unless (got_address, "did not get address");
+  ts_fail_unless (added_mapping, "did not add mapping");
   g_object_unref (context);
 }
 GST_END_TEST;
-- 
1.5.6.5




More information about the farsight-commits mailing list