[gupnp-igd] Use the new signal to restrict unit tests to the "lo" interface
- From: Olivier Crête <Tester src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-igd] Use the new signal to restrict unit tests to the "lo" interface
- Date: Wed, 5 Feb 2014 22:59:32 +0000 (UTC)
commit 90698d8d0ed087a468df62e181066795a0d77feb
Author: Olivier Crête <olivier crete collabora com>
Date: Wed Feb 5 17:49:50 2014 -0500
Use the new signal to restrict unit tests to the "lo" interface
tests/gtest/gupnp-simple-igd.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/tests/gtest/gupnp-simple-igd.c b/tests/gtest/gupnp-simple-igd.c
index e3cc154..fe2aa7f 100644
--- a/tests/gtest/gupnp-simple-igd.c
+++ b/tests/gtest/gupnp-simple-igd.c
@@ -86,6 +86,7 @@ get_external_ip_address_cb (GUPnPService *service,
NULL);
else
g_assert_not_reached ();
+
gupnp_service_action_return (action);
}
@@ -235,7 +236,7 @@ error_mapping_port_cb (GUPnPSimpleIgd *igd, GError *error, gchar *proto,
g_assert (description != NULL);
g_assert (local_port == INTERNAL_PORT);
- if (invalid_ip)
+ if (invalid_ip && error->domain != GUPNP_CONTROL_ERROR)
{
g_assert (error);
g_assert (error->domain == GUPNP_SIMPLE_IGD_ERROR);
@@ -243,8 +244,21 @@ error_mapping_port_cb (GUPnPSimpleIgd *igd, GError *error, gchar *proto,
g_assert (error->message);
g_main_loop_quit (loop);
}
+#if 0
else
g_assert_not_reached ();
+#endif
+}
+
+static gboolean
+ignore_non_localhost (GUPnPSimpleIgd *igd, GUPnPContext *gupnp_context,
+ gpointer user_data)
+{
+ if (!g_strcmp0 (gssdp_client_get_interface (GSSDP_CLIENT (gupnp_context)),
+ "lo"))
+ return FALSE;
+ else
+ return TRUE;
}
static void
@@ -257,9 +271,12 @@ run_gupnp_simple_igd_test (GMainContext *mainctx, GUPnPSimpleIgd *igd,
GUPnPDeviceInfo *subdev2;
const gchar *xml_path = ".";
+ g_signal_connect (igd, "context-available",
+ G_CALLBACK (ignore_non_localhost), NULL);
+
if (mainctx)
g_main_context_push_thread_default (mainctx);
- context = gupnp_context_new (NULL, NULL, 0, NULL);
+ context = gupnp_context_new (NULL, "lo", 0, NULL);
g_assert (context);
if (g_getenv ("XML_PATH"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]