[gupnp] tests: Use IP to create interface, not device name



commit ad3fb713db1abbc435d8445ee9c3abe4dd5ea59f
Author: Jens Georg <mail jensge org>
Date:   Wed Apr 15 20:44:04 2020 +0200

    tests: Use IP to create interface, not device name
    
    Should be more portable to *BSD now
    
    Fixes #15

 tests/gtest/test-bugs.c    | 20 +++++++++++++++-----
 tests/gtest/test-context.c | 14 +++++++++++---
 2 files changed, 26 insertions(+), 8 deletions(-)
---
diff --git a/tests/gtest/test-bugs.c b/tests/gtest/test-bugs.c
index 76d35d6..db94285 100644
--- a/tests/gtest/test-bugs.c
+++ b/tests/gtest/test-bugs.c
@@ -26,6 +26,16 @@
 #include <libgupnp/gupnp.h>
 #include <libgupnp/gupnp-service-private.h>
 
+static GUPnPContext *
+create_context (guint16 port, GError **error) {
+        return GUPNP_CONTEXT (g_initable_new (GUPNP_TYPE_CONTEXT,
+                                              NULL,
+                                              error,
+                                              "host-ip", "127.0.0.1",
+                                              "msearch-port", port,
+                                              NULL));
+}
+
 typedef struct _TestBgo678701Service {
     GUPnPServiceProxy parent_instance;
 }TestBgo678701Service;
@@ -195,7 +205,7 @@ test_bgo_696762 (void)
 
     data.loop = g_main_loop_new (NULL, FALSE);
 
-    context = gupnp_context_new ("lo", 0, &error);
+    context = create_context (0, &error);
     g_assert_no_error (error);
     g_assert (context != NULL);
 
@@ -264,7 +274,7 @@ test_bgo_678701 (void)
 
     data.loop = g_main_loop_new (NULL, FALSE);
 
-    context = gupnp_context_new ("lo", 0, &error);
+    context = create_context (0, &error);
     g_assert_no_error (error);
     g_assert (context != NULL);
 
@@ -321,7 +331,7 @@ test_bgo_690400 (void)
 
     data.loop = g_main_loop_new (NULL, FALSE);
 
-    context = gupnp_context_new ("lo", 0, &error);
+    context = create_context (0, &error);
     g_assert_no_error (error);
     g_assert (context != NULL);
 
@@ -380,7 +390,7 @@ test_bgo_722696 (void)
     char *icon;
     int width;
 
-    context = gupnp_context_new ("lo", 0, &error);
+    context = create_context (0, &error);
     g_assert_no_error (error);
     g_assert (context != NULL);
 
@@ -441,7 +451,7 @@ test_bgo_743233 (void)
     GUPnPControlPoint *cp = NULL;
     GError *error = NULL;
 
-    context = gupnp_context_new ("lo", 0, &error);
+    context = create_context (0, &error);
     g_assert_no_error (error);
     g_assert (context != NULL);
 
diff --git a/tests/gtest/test-context.c b/tests/gtest/test-context.c
index e941b00..1210f7b 100644
--- a/tests/gtest/test-context.c
+++ b/tests/gtest/test-context.c
@@ -28,6 +28,16 @@
 #include <libsoup/soup.h>
 #include "libgupnp/gupnp.h"
 
+static GUPnPContext *
+create_context (guint16 port, GError **error) {
+        return GUPNP_CONTEXT (g_initable_new (GUPNP_TYPE_CONTEXT,
+                                              NULL,
+                                              error,
+                                              "host-ip", "127.0.0.1",
+                                              "msearch-port", port,
+                                              NULL));
+}
+
 static void
 on_message_finished (G_GNUC_UNUSED SoupSession *session,
                      G_GNUC_UNUSED SoupMessage *message,
@@ -134,9 +144,7 @@ test_gupnp_context_http_ranged_requests (void)
         g_assert (error == NULL);
         file_length = g_mapped_file_get_length (file);
 
-        context = gupnp_context_new ("lo",
-                                     0,
-                                     &error);
+        context = create_context (0, &error);
         g_assert (context != NULL);
         g_assert (error == NULL);
         port = gupnp_context_get_port (context);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]