[libsoup/carlosgc/thread-safe] Move http-1-1-required test from http2-test to connection-test




commit 8e812932d58858958ae271146f96fa6da2c16d19
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Tue May 3 12:40:55 2022 +0200

    Move http-1-1-required test from http2-test to connection-test

 tests/connection-test.c | 40 ++++++++++++++++++++++++++++++++++++++++
 tests/http2-test.c      | 39 ---------------------------------------
 2 files changed, 40 insertions(+), 39 deletions(-)
---
diff --git a/tests/connection-test.c b/tests/connection-test.c
index 3ee74b60..4f454f39 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -1645,6 +1645,45 @@ do_connection_force_http2_test (void)
         soup_test_session_abort_unref (session);
 }
 
+static void
+message_restarted (SoupMessage *msg,
+                   gboolean    *was_restarted)
+{
+        *was_restarted = TRUE;
+}
+
+static void
+do_connection_http_1_1_required_test (void)
+{
+        SoupSession *session;
+        SoupMessage *msg;
+        GBytes *body;
+        gboolean was_restarted = FALSE;
+        GError *error = NULL;
+
+        SOUP_TEST_SKIP_IF_NO_TLS;
+        SOUP_TEST_SKIP_IF_NO_APACHE;
+
+        session = soup_test_session_new (NULL);
+
+        msg = soup_message_new ("GET", "https://127.0.0.1:47525/client-cert";);
+        soup_message_set_force_http_version (msg, SOUP_HTTP_2_0);
+        g_signal_connect (msg, "restarted",
+                          G_CALLBACK (message_restarted), &was_restarted);
+        body = soup_test_session_async_send (session, msg, NULL, &error);
+        g_assert_no_error (error);
+        g_assert_cmpuint (soup_message_get_status (msg), ==, 403);
+        g_assert_true (was_restarted);
+        g_assert_nonnull (body);
+        g_bytes_unref (body);
+        g_object_unref (msg);
+
+        while (g_main_context_pending (NULL))
+                g_main_context_iteration (NULL, FALSE);
+
+        soup_test_session_abort_unref (session);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -1669,6 +1708,7 @@ main (int argc, char **argv)
        g_test_add_func ("/connection/preconnect", do_connection_preconnect_test);
         g_test_add_func ("/connection/metrics", do_connection_metrics_test);
         g_test_add_func ("/connection/force-http2", do_connection_force_http2_test);
+        g_test_add_func ("/connection/http2/http-1-1-required", do_connection_http_1_1_required_test);
 
        ret = g_test_run ();
 
diff --git a/tests/http2-test.c b/tests/http2-test.c
index 689fa2f5..cbc6c41b 100644
--- a/tests/http2-test.c
+++ b/tests/http2-test.c
@@ -1013,39 +1013,6 @@ do_timeout_test (Test *test, gconstpointer data)
                 g_main_context_iteration (NULL, FALSE);
 }
 
-static void
-message_restarted (SoupMessage *msg,
-                   gboolean    *was_restarted)
-{
-        *was_restarted = TRUE;
-}
-
-static void
-do_http_1_1_required_test (Test *test, gconstpointer data)
-{
-        SoupMessage *msg;
-        GBytes *response;
-        gboolean was_restarted = FALSE;
-        GError *error = NULL;
-
-        SOUP_TEST_SKIP_IF_NO_APACHE;
-
-        msg = soup_message_new (SOUP_METHOD_GET, "https://127.0.0.1:47525/client-cert";);
-        soup_message_set_force_http_version (msg, SOUP_HTTP_2_0);
-        g_signal_connect (msg, "restarted",
-                          G_CALLBACK (message_restarted), &was_restarted);
-        response = soup_test_session_async_send (test->session, msg, NULL, &error);
-        g_assert_no_error (error);
-        g_assert_cmpuint (soup_message_get_status (msg), ==, 403);
-        g_assert_true (was_restarted);
-        g_assert_nonnull (response);
-        g_bytes_unref (response);
-        g_object_unref (msg);
-
-        while (g_main_context_pending (NULL))
-                g_main_context_iteration (NULL, FALSE);
-}
-
 int
 main (int argc, char **argv)
 {
@@ -1058,8 +1025,6 @@ main (int argc, char **argv)
                 return 1;
         }
 
-        apache_init ();
-
         g_test_add ("/http2/basic/async", Test, NULL,
                     setup_session,
                     do_basic_async_test,
@@ -1160,10 +1125,6 @@ main (int argc, char **argv)
                     setup_session,
                     do_timeout_test,
                     teardown_session);
-        g_test_add ("/http2/http-1-1-required", Test, NULL,
-                    setup_session,
-                    do_http_1_1_required_test,
-                    teardown_session);
 
        ret = g_test_run ();
 


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