[librest/wip/teuf/fixes: 10/10] fixup! tests/proxy-continuous: Use GTest API



commit eeca2007e34cec264718fa662ef664efe43cfdac
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Tue Jul 19 14:24:30 2016 +0200

    fixup! tests/proxy-continuous: Use GTest API

 tests/proxy-continuous.c |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/tests/proxy-continuous.c b/tests/proxy-continuous.c
index abcf78f..8f4b7a8 100644
--- a/tests/proxy-continuous.c
+++ b/tests/proxy-continuous.c
@@ -66,14 +66,13 @@ server_callback (SoupServer *server, SoupMessage *msg,
                  const char *path, GHashTable *query,
                  SoupClientContext *client, gpointer user_data)
 {
-  if (g_str_equal (path, "/stream")) {
-    soup_message_set_status (msg, SOUP_STATUS_OK);
-    soup_message_headers_set_encoding (msg->response_headers,
-                                       SOUP_ENCODING_CHUNKED);
-    soup_server_pause_message (server, msg);
+  g_assert_cmpstr (path, ==, "/stream");
+  soup_message_set_status (msg, SOUP_STATUS_OK);
+  soup_message_headers_set_encoding (msg->response_headers,
+                                     SOUP_ENCODING_CHUNKED);
+  soup_server_pause_message (server, msg);
 
-    g_idle_add (send_chunks, msg);
-  }
+  g_idle_add (send_chunks, msg);
 }
 
 static void
@@ -134,13 +133,11 @@ continuous ()
   GSList *uris;
 
 
-  server = soup_server_new (NULL, NULL);
-  soup_server_listen_all (server, 0, 0, &error);
+  server = soup_server_new (NULL);
+  soup_server_listen_local (server, 0, 0, &error);
   g_assert_no_error (error);
 
   soup_server_add_handler (server, NULL, server_callback, NULL, NULL);
-  soup_server_add_handler (server, "/ping", server_callback,
-                           NULL, NULL);
 
   uris = soup_server_get_uris (server);
   g_assert (g_slist_length (uris) > 0);
@@ -151,11 +148,8 @@ continuous ()
 
   proxy = rest_proxy_new (url, FALSE);
   stream_test (proxy);
-
-  g_main_loop_run (loop);
-
-
   g_slist_free_full (uris, (GDestroyNotify)soup_uri_free);
+
   g_main_loop_run (loop);
   g_free (url);
   g_main_loop_unref (loop);


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