[libsoup] Remove deprecated SoupSessionAsync usage
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] Remove deprecated SoupSessionAsync usage
- Date: Sat, 19 Sep 2020 22:41:57 +0000 (UTC)
commit 635a4efeacc6f489e13af19a35c80456629f8121
Author: Patrick Griffis <pgriffis igalia com>
Date: Thu Mar 12 18:29:56 2020 -0700
Remove deprecated SoupSessionAsync usage
connection-test: Remove all deprecated session usage
misc-test: Remove sync session usage
no-ssl-test: Remove deprecated session usage
proxy-test: Remove deprecated session usage
resource-test: Remove deprecated session usage
redirect-tests: Remove deprecated session usage
xmlrpc-test: Remove deprecated session usage
timeout-test: Remove sync session usage
ssl-test: Remove deprecated session usage
session-test: Remove deprecated session usage
server-test: Remove sync session usage
tests/connection-test.c | 64 +++++++------------------------------
tests/misc-test.c | 41 +++++-------------------
tests/no-ssl-test.c | 11 -------
tests/proxy-test.c | 65 ++++++++++++++------------------------
tests/redirect-test.c | 34 +++-----------------
tests/resource-test.c | 64 +++++--------------------------------
tests/server-test.c | 10 +++---
tests/session-test.c | 26 +--------------
tests/ssl-test.c | 84 ++++++-------------------------------------------
tests/timeout-test.c | 4 +--
tests/xmlrpc-test.c | 2 +-
11 files changed, 71 insertions(+), 334 deletions(-)
---
diff --git a/tests/connection-test.c b/tests/connection-test.c
index dea95fd7..bacace3b 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -180,7 +180,7 @@ do_content_length_framing_test (void)
g_test_bug ("611481");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
debug_printf (1, " Content-Length larger than message body length\n");
request_uri = soup_uri_new_with_base (base_uri, "/content-length/long");
@@ -379,27 +379,17 @@ do_persistent_connection_timeout_test (void)
g_test_bug ("631525");
- debug_printf (1, " Async session, message API\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
+ debug_printf (1, " Normal session, message API\n");
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
do_timeout_test_for_session (session);
soup_test_session_abort_unref (session);
- debug_printf (1, " Async session, request API\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
+ debug_printf (1, " Normal session, request API\n");
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
NULL);
do_timeout_req_test_for_session (session);
soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session, message API\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
- do_timeout_test_for_session (session);
- soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session, request API\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
- do_timeout_req_test_for_session (session);
- soup_test_session_abort_unref (session);
}
static void
@@ -421,7 +411,7 @@ do_persistent_connection_timeout_test_with_cancellation (void)
int i;
char buf[8192];
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
g_signal_connect (session, "request-started",
G_CALLBACK (request_started_socket_collector),
@@ -608,15 +598,7 @@ do_max_conns_test (void)
g_test_bug ("634422");
- debug_printf (1, " Async session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
- SOUP_SESSION_MAX_CONNS, MAX_CONNS,
- NULL);
- do_max_conns_test_for_session (session);
- soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_MAX_CONNS, MAX_CONNS,
NULL);
do_max_conns_test_for_session (session);
@@ -687,13 +669,7 @@ do_non_persistent_connection_test (void)
g_test_bug ("578990");
- debug_printf (1, " Async session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
- do_non_persistent_test_for_session (session);
- soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
do_non_persistent_test_for_session (session);
soup_test_session_abort_unref (session);
}
@@ -739,13 +715,7 @@ do_non_idempotent_connection_test (void)
{
SoupSession *session;
- debug_printf (1, " Async session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
- do_non_idempotent_test_for_session (session);
- soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
do_non_idempotent_test_for_session (session);
soup_test_session_abort_unref (session);
}
@@ -853,13 +823,7 @@ do_connection_state_test (void)
SOUP_TEST_SKIP_IF_NO_APACHE;
- debug_printf (1, " Async session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
- do_connection_state_test_for_session (session);
- soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
do_connection_state_test_for_session (session);
soup_test_session_abort_unref (session);
}
@@ -996,13 +960,7 @@ do_connection_event_test (void)
SOUP_TEST_SKIP_IF_NO_APACHE;
- debug_printf (1, " Async session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
- do_connection_event_test_for_session (session);
- soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
do_connection_event_test_for_session (session);
soup_test_session_abort_unref (session);
}
diff --git a/tests/misc-test.c b/tests/misc-test.c
index 9e7eef2e..f717a18e 100644
--- a/tests/misc-test.c
+++ b/tests/misc-test.c
@@ -101,7 +101,7 @@ do_host_test (void)
g_test_bug ("539803");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
one = soup_message_new_from_uri ("GET", base_uri);
two = soup_message_new_from_uri ("GET", base_uri);
@@ -133,7 +133,7 @@ do_host_big_header (void)
g_test_bug ("792173");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
msg = soup_message_new_from_uri ("GET", base_uri);
for (i = 0; i < 2048; i++) {
@@ -624,7 +624,7 @@ do_one_accept_language_test (const char *language, const char *expected_header)
debug_printf (1, " LANGUAGE=%s\n", language);
g_setenv ("LANGUAGE", language, TRUE);
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_ACCEPT_LANGUAGE_AUTO, TRUE,
NULL);
msg = soup_message_new_from_uri ("GET", base_uri);
@@ -732,13 +732,7 @@ do_cancel_while_reading_test (void)
g_test_bug ("637741");
g_test_bug ("676038");
- debug_printf (1, " Async session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
- do_cancel_while_reading_test_for_session (session);
- soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
do_cancel_while_reading_test_for_session (session);
soup_test_session_abort_unref (session);
}
@@ -775,18 +769,11 @@ do_cancel_while_reading_immediate_req_test (void)
flags = SOUP_TEST_REQUEST_CANCEL_CANCELLABLE | SOUP_TEST_REQUEST_CANCEL_IMMEDIATE;
- debug_printf (1, " Async session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
NULL);
do_cancel_while_reading_req_test_for_session (session, flags);
soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC,
- NULL);
- do_cancel_while_reading_req_test_for_session (session, flags);
- soup_test_session_abort_unref (session);
}
static void
@@ -797,18 +784,11 @@ do_cancel_while_reading_delayed_req_test (void)
flags = SOUP_TEST_REQUEST_CANCEL_CANCELLABLE | SOUP_TEST_REQUEST_CANCEL_SOON;
- debug_printf (1, " Async session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
NULL);
do_cancel_while_reading_req_test_for_session (session, flags);
soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC,
- NULL);
- do_cancel_while_reading_req_test_for_session (session, flags);
- soup_test_session_abort_unref (session);
}
static void
@@ -821,18 +801,11 @@ do_cancel_while_reading_preemptive_req_test (void)
flags = SOUP_TEST_REQUEST_CANCEL_CANCELLABLE | SOUP_TEST_REQUEST_CANCEL_PREEMPTIVE;
- debug_printf (1, " Async session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
NULL);
do_cancel_while_reading_req_test_for_session (session, flags);
soup_test_session_abort_unref (session);
-
- debug_printf (1, " Sync session\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC,
- NULL);
- do_cancel_while_reading_req_test_for_session (session, flags);
- soup_test_session_abort_unref (session);
}
static void
diff --git a/tests/no-ssl-test.c b/tests/no-ssl-test.c
index e67d5250..8cb4ffa2 100644
--- a/tests/no-ssl-test.c
+++ b/tests/no-ssl-test.c
@@ -31,20 +31,9 @@ do_ssl_tests (gconstpointer data)
g_test_bug ("700518");
- debug_printf (1, " plain\n");
session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
do_ssl_test_for_session (session, uri);
soup_test_session_abort_unref (session);
-
- debug_printf (1, " async\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
- do_ssl_test_for_session (session, uri);
- soup_test_session_abort_unref (session);
-
- debug_printf (1, " sync\n");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
- do_ssl_test_for_session (session, uri);
- soup_test_session_abort_unref (session);
}
static void
diff --git a/tests/proxy-test.c b/tests/proxy-test.c
index 21d99366..2a3d4d41 100644
--- a/tests/proxy-test.c
+++ b/tests/proxy-test.c
@@ -76,8 +76,7 @@ set_close_on_connect (SoupMessage *msg,
}
static void
-test_url (const char *url, int proxy, guint expected,
- gboolean sync, gboolean close)
+test_url (const char *url, int proxy, guint expected, gboolean close)
{
SoupSession *session;
SoupMessage *msg;
@@ -94,7 +93,7 @@ test_url (const char *url, int proxy, guint expected,
/* We create a new session for each request to ensure that
* connections/auth aren't cached between tests.
*/
- session = soup_test_session_new (sync ? SOUP_TYPE_SESSION_SYNC : SOUP_TYPE_SESSION_ASYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_PROXY_RESOLVER, proxy_resolvers[proxy],
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
SOUP_SESSION_SSL_STRICT, FALSE,
@@ -124,8 +123,7 @@ test_url (const char *url, int proxy, guint expected,
}
static void
-test_url_new_api (const char *url, int proxy, guint expected,
- gboolean sync, gboolean close)
+test_url_new_api (const char *url, int proxy, guint expected, gboolean close)
{
SoupSession *session;
SoupMessage *msg;
@@ -146,7 +144,7 @@ test_url_new_api (const char *url, int proxy, guint expected,
/* We create a new session for each request to ensure that
* connections/auth aren't cached between tests.
*/
- session = soup_test_session_new (sync ? SOUP_TYPE_SESSION_SYNC : SOUP_TYPE_SESSION_ASYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
SOUP_SESSION_PROXY_RESOLVER, proxy_resolvers[proxy],
SOUP_SESSION_SSL_STRICT, FALSE,
@@ -185,7 +183,7 @@ test_url_new_api (const char *url, int proxy, guint expected,
}
static void
-do_proxy_test (SoupProxyTest *test, gboolean sync)
+do_proxy_test (SoupProxyTest *test)
{
char *http_url, *https_url;
@@ -210,22 +208,22 @@ do_proxy_test (SoupProxyTest *test, gboolean sync)
https_url = g_strconcat (HTTPS_SERVER, test->url, NULL);
}
- test_url (http_url, SIMPLE_PROXY, test->final_status, sync, FALSE);
- test_url_new_api (http_url, SIMPLE_PROXY, test->final_status, sync, FALSE);
- test_url (https_url, SIMPLE_PROXY, test->final_status, sync, FALSE);
- test_url_new_api (https_url, SIMPLE_PROXY, test->final_status, sync, FALSE);
+ test_url (http_url, SIMPLE_PROXY, test->final_status, FALSE);
+ test_url_new_api (http_url, SIMPLE_PROXY, test->final_status, FALSE);
+ test_url (https_url, SIMPLE_PROXY, test->final_status, FALSE);
+ test_url_new_api (https_url, SIMPLE_PROXY, test->final_status, FALSE);
- test_url (http_url, AUTH_PROXY, test->final_status, sync, FALSE);
- test_url_new_api (http_url, AUTH_PROXY, test->final_status, sync, FALSE);
- test_url (https_url, AUTH_PROXY, test->final_status, sync, FALSE);
- test_url_new_api (https_url, AUTH_PROXY, test->final_status, sync, FALSE);
- test_url (https_url, AUTH_PROXY, test->final_status, sync, TRUE);
- test_url_new_api (https_url, AUTH_PROXY, test->final_status, sync, TRUE);
+ test_url (http_url, AUTH_PROXY, test->final_status, FALSE);
+ test_url_new_api (http_url, AUTH_PROXY, test->final_status, FALSE);
+ test_url (https_url, AUTH_PROXY, test->final_status, FALSE);
+ test_url_new_api (https_url, AUTH_PROXY, test->final_status, FALSE);
+ test_url (https_url, AUTH_PROXY, test->final_status, TRUE);
+ test_url_new_api (https_url, AUTH_PROXY, test->final_status, TRUE);
- test_url (http_url, UNAUTH_PROXY, test->final_status, sync, FALSE);
- test_url_new_api (http_url, UNAUTH_PROXY, test->final_status, sync, FALSE);
- test_url (https_url, UNAUTH_PROXY, test->final_status, sync, FALSE);
- test_url_new_api (https_url, UNAUTH_PROXY, test->final_status, sync, FALSE);
+ test_url (http_url, UNAUTH_PROXY, test->final_status, FALSE);
+ test_url_new_api (http_url, UNAUTH_PROXY, test->final_status, FALSE);
+ test_url (https_url, UNAUTH_PROXY, test->final_status, FALSE);
+ test_url_new_api (https_url, UNAUTH_PROXY, test->final_status, FALSE);
g_free (http_url);
g_free (https_url);
@@ -238,17 +236,7 @@ do_async_proxy_test (gconstpointer data)
SOUP_TEST_SKIP_IF_NO_APACHE;
- do_proxy_test (test, FALSE);
-}
-
-static void
-do_sync_proxy_test (gconstpointer data)
-{
- SoupProxyTest *test = (SoupProxyTest *)data;
-
- SOUP_TEST_SKIP_IF_NO_APACHE;
-
- do_proxy_test (test, TRUE);
+ do_proxy_test (test);
}
static void
@@ -271,7 +259,7 @@ do_proxy_fragment_test (gconstpointer data)
SOUP_TEST_SKIP_IF_NO_APACHE;
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_PROXY_RESOLVER, proxy_resolvers[SIMPLE_PROXY],
NULL);
@@ -298,7 +286,7 @@ do_proxy_redirect_test (void)
SOUP_TEST_SKIP_IF_NO_APACHE;
SOUP_TEST_SKIP_IF_NO_TLS;
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_PROXY_RESOLVER, proxy_resolvers[SIMPLE_PROXY],
NULL);
@@ -376,7 +364,7 @@ do_proxy_auth_cache_test (void)
cache = soup_cache_new (cache_dir, SOUP_CACHE_SINGLE_USER);
g_free (cache_dir);
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_PROXY_RESOLVER, proxy_resolvers[AUTH_PROXY],
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
SOUP_SESSION_ADD_FEATURE, cache,
@@ -419,15 +407,10 @@ main (int argc, char **argv)
base_uri = soup_test_server_get_uri (server, "http", NULL);
for (i = 0; i < ntests; i++) {
- path = g_strdup_printf ("/proxy/async/%s", tests[i].explanation);
+ path = g_strdup_printf ("/proxy/%s", tests[i].explanation);
g_test_add_data_func (path, &tests[i], do_async_proxy_test);
g_free (path);
}
- for (i = 0; i < ntests; i++) {
- path = g_strdup_printf ("/proxy/sync/%s", tests[i].explanation);
- g_test_add_data_func (path, &tests[i], do_sync_proxy_test);
- g_free (path);
- }
g_test_add_data_func ("/proxy/fragment", base_uri, do_proxy_fragment_test);
g_test_add_func ("/proxy/redirect", do_proxy_redirect_test);
diff --git a/tests/redirect-test.c b/tests/redirect-test.c
index e5f5fa6d..4e5b0ea8 100644
--- a/tests/redirect-test.c
+++ b/tests/redirect-test.c
@@ -7,7 +7,7 @@
SoupURI *base_uri;
char *server2_uri;
-SoupSession *async_session, *sync_session;
+SoupSession *async_session;
typedef struct {
const char *method;
@@ -283,18 +283,6 @@ do_async_req_api_test (gconstpointer test)
do_request_api_test (async_session, (TestCase *)test);
}
-static void
-do_sync_msg_api_test (gconstpointer test)
-{
- do_message_api_test (sync_session, (TestCase *)test);
-}
-
-static void
-do_sync_req_api_test (gconstpointer test)
-{
- do_request_api_test (sync_session, (TestCase *)test);
-}
-
static void
server_callback (SoupServer *server, SoupMessage *msg,
const char *path, GHashTable *query,
@@ -418,35 +406,22 @@ main (int argc, char **argv)
loop = g_main_loop_new (NULL, TRUE);
- async_session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
+ async_session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
NULL);
- sync_session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
for (n = 0; n < n_tests; n++) {
- path = g_strdup_printf ("/redirect/async/msg/%d-%s-%d", n,
+ path = g_strdup_printf ("/redirect/msg/%d-%s-%d", n,
tests[n].requests[0].method,
tests[n].requests[0].status_code);
g_test_add_data_func (path, &tests[n], do_async_msg_api_test);
g_free (path);
- path = g_strdup_printf ("/redirect/async/req/%d-%s-%d", n,
+ path = g_strdup_printf ("/redirect/req/%d-%s-%d", n,
tests[n].requests[0].method,
tests[n].requests[0].status_code);
g_test_add_data_func (path, &tests[n], do_async_req_api_test);
g_free (path);
-
- path = g_strdup_printf ("/redirect/sync/msg/%d-%s-%d", n,
- tests[n].requests[0].method,
- tests[n].requests[0].status_code);
- g_test_add_data_func (path, &tests[n], do_sync_msg_api_test);
- g_free (path);
-
- path = g_strdup_printf ("/redirect/sync/req/%d-%s-%d", n,
- tests[n].requests[0].method,
- tests[n].requests[0].status_code);
- g_test_add_data_func (path, &tests[n], do_sync_req_api_test);
- g_free (path);
}
ret = g_test_run ();
@@ -458,7 +433,6 @@ main (int argc, char **argv)
soup_test_server_quit_unref (server2);
soup_test_session_abort_unref (async_session);
- soup_test_session_abort_unref (sync_session);
test_cleanup ();
return ret;
diff --git a/tests/resource-test.c b/tests/resource-test.c
index 6fcb899e..4c184a88 100644
--- a/tests/resource-test.c
+++ b/tests/resource-test.c
@@ -89,43 +89,6 @@ do_async_request (SoupRequest *request)
g_string_free (data.body, TRUE);
}
-static void
-do_sync_request (SoupRequest *request)
-{
- GInputStream *in;
- GString *body;
- char buffer[1024];
- gssize nread;
- GError *error = NULL;
-
- in = soup_request_send (request, NULL, &error);
- if (!in) {
- g_assert_no_error (error);
- g_clear_error (&error);
- return;
- }
-
- body = g_string_new (NULL);
- do {
- nread = g_input_stream_read (in, buffer, sizeof (buffer),
- NULL, &error);
- if (nread == -1) {
- g_assert_no_error (error);
- g_clear_error (&error);
- break;
- }
- g_string_append_len (body, buffer, nread);
- } while (nread > 0);
-
- g_input_stream_close (in, NULL, &error);
- g_assert_no_error (error);
- g_clear_error (&error);
- g_object_unref (in);
-
- soup_assert_cmpmem (body->str, body->len, index_buffer->data, index_buffer->length);
- g_string_free (body, TRUE);
-}
-
static void
do_request (const char *uri_string, gconstpointer type)
{
@@ -140,10 +103,7 @@ do_request (const char *uri_string, gconstpointer type)
request = soup_session_request (session, uri_string, &error);
g_assert_no_error (error);
- if (SOUP_IS_SESSION_ASYNC (session))
- do_async_request (request);
- else
- do_sync_request (request);
+ do_async_request (request);
g_object_unref (request);
soup_test_session_abort_unref (session);
@@ -193,24 +153,14 @@ main (int argc, char **argv)
index_buffer = soup_test_get_index ();
soup_test_register_resources ();
- g_test_add_data_func ("/resource/sync/file",
- GSIZE_TO_POINTER (SOUP_TYPE_SESSION_SYNC),
- do_request_file_test);
- g_test_add_data_func ("/resource/sync/data",
- GSIZE_TO_POINTER (SOUP_TYPE_SESSION_SYNC),
- do_request_data_test);
- g_test_add_data_func ("/resource/sync/gresource",
- GSIZE_TO_POINTER (SOUP_TYPE_SESSION_SYNC),
- do_request_gresource_test);
-
- g_test_add_data_func ("/resource/async/file",
- GSIZE_TO_POINTER (SOUP_TYPE_SESSION_ASYNC),
+ g_test_add_data_func ("/resource/file",
+ GSIZE_TO_POINTER (SOUP_TYPE_SESSION),
do_request_file_test);
- g_test_add_data_func ("/resource/async/data",
- GSIZE_TO_POINTER (SOUP_TYPE_SESSION_ASYNC),
+ g_test_add_data_func ("/resource/data",
+ GSIZE_TO_POINTER (SOUP_TYPE_SESSION),
do_request_data_test);
- g_test_add_data_func ("/resource/async/gresource",
- GSIZE_TO_POINTER (SOUP_TYPE_SESSION_ASYNC),
+ g_test_add_data_func ("/resource/gresource",
+ GSIZE_TO_POINTER (SOUP_TYPE_SESSION),
do_request_gresource_test);
ret = g_test_run ();
diff --git a/tests/server-test.c b/tests/server-test.c
index 3cc8e706..940b2583 100644
--- a/tests/server-test.c
+++ b/tests/server-test.c
@@ -124,7 +124,7 @@ do_star_test (ServerData *sd, gconstpointer test_data)
g_test_bug ("590751");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
star_uri = soup_uri_copy (sd->base_uri);
soup_uri_set_path (star_uri, "*");
@@ -265,7 +265,7 @@ do_dot_dot_test (ServerData *sd, gconstpointer test_data)
g_test_bug ("667635");
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
uri = soup_uri_new_with_base (sd->base_uri, "/..%2ftest");
msg = soup_message_new_from_uri ("GET", uri);
@@ -984,7 +984,7 @@ do_early_stream_test (ServerData *sd, gconstpointer test_data)
server_add_early_handler (sd, NULL, early_stream_callback, NULL, NULL);
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
msg = soup_message_new_from_uri ("POST", sd->base_uri);
@@ -1022,7 +1022,7 @@ do_early_respond_test (ServerData *sd, gconstpointer test_data)
server_add_early_handler (sd, NULL, early_respond_callback, NULL, NULL);
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
/* The early handler will intercept, and the normal handler will be skipped */
msg = soup_message_new_from_uri ("GET", sd->base_uri);
@@ -1083,7 +1083,7 @@ do_early_multi_test (ServerData *sd, gconstpointer test_data)
server_add_handler (sd, "/both", server_callback, NULL, NULL);
server_add_early_handler (sd, "/both", early_multi_callback, NULL, NULL);
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
for (i = 0; i < G_N_ELEMENTS (multi_tests); i++) {
uri = soup_uri_new_with_base (sd->base_uri, multi_tests[i].path);
diff --git a/tests/session-test.c b/tests/session-test.c
index b9e1d00e..246c847e 100644
--- a/tests/session-test.c
+++ b/tests/session-test.c
@@ -157,28 +157,6 @@ do_plain_tests (gconstpointer data)
soup_test_session_abort_unref (session);
}
-static void
-do_async_tests (gconstpointer data)
-{
- SoupURI *uri = (SoupURI *)data;
- SoupSession *session;
-
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
- do_test_for_session (session, uri, TRUE, FALSE, TRUE);
- soup_test_session_abort_unref (session);
-}
-
-static void
-do_sync_tests (gconstpointer data)
-{
- SoupURI *uri = (SoupURI *)data;
- SoupSession *session;
-
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
- do_test_for_session (session, uri, FALSE, TRUE, FALSE);
- soup_test_session_abort_unref (session);
-}
-
static void
priority_test_finished_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
{
@@ -208,7 +186,7 @@ do_priority_tests (gconstpointer data)
g_test_bug ("696277");
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
g_object_set (session, "max-conns", 1, NULL);
expected_priorities[0] = SOUP_MESSAGE_PRIORITY_HIGH;
@@ -393,8 +371,6 @@ main (int argc, char **argv)
uri = soup_test_server_get_uri (server, "http", NULL);
g_test_add_data_func ("/session/SoupSession", uri, do_plain_tests);
- g_test_add_data_func ("/session/SoupSessionAsync", uri, do_async_tests);
- g_test_add_data_func ("/session/SoupSessionSync", uri, do_sync_tests);
g_test_add_data_func ("/session/priority", uri, do_priority_tests);
g_test_add_func ("/session/property", do_property_tests);
g_test_add_func ("/session/features", do_features_test);
diff --git a/tests/ssl-test.c b/tests/ssl-test.c
index 11f04c99..77ce6f36 100644
--- a/tests/ssl-test.c
+++ b/tests/ssl-test.c
@@ -4,86 +4,22 @@
SoupURI *uri;
-static void
-do_properties_test_for_session (SoupSession *session)
-{
- SoupMessage *msg;
- GTlsCertificate *cert;
- GTlsCertificateFlags flags;
-
- msg = soup_message_new_from_uri ("GET", uri);
- soup_session_send_message (session, msg);
- soup_test_assert_message_status (msg, SOUP_STATUS_OK);
-
- if (soup_message_get_https_status (msg, &cert, &flags)) {
- g_assert_true (G_IS_TLS_CERTIFICATE (cert));
- g_assert_cmpuint (flags, ==, G_TLS_CERTIFICATE_UNKNOWN_CA);
- } else
- soup_test_assert (FALSE, "Response not https");
-
- g_test_bug ("665182");
- g_assert_false (soup_message_get_flags (msg) & SOUP_MESSAGE_CERTIFICATE_TRUSTED);
-
- g_object_unref (msg);
-}
-
-static void
-do_async_properties_tests (void)
-{
- SoupSession *session;
-
- SOUP_TEST_SKIP_IF_NO_TLS;
-
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
- g_object_set (G_OBJECT (session),
- SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
- SOUP_SESSION_SSL_STRICT, FALSE,
- NULL);
- do_properties_test_for_session (session);
- soup_test_session_abort_unref (session);
-}
-
-static void
-do_sync_properties_tests (void)
-{
- SoupSession *session;
-
- SOUP_TEST_SKIP_IF_NO_TLS;
-
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
- g_object_set (G_OBJECT (session),
- SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
- SOUP_SESSION_SSL_STRICT, FALSE,
- NULL);
- do_properties_test_for_session (session);
- soup_test_session_abort_unref (session);
-}
-
typedef struct {
const char *name;
- gboolean sync;
gboolean strict;
gboolean with_ca_list;
guint expected_status;
} StrictnessTest;
static const StrictnessTest strictness_tests[] = {
- { "/ssl/strictness/async/strict/with-ca",
- FALSE, TRUE, TRUE, SOUP_STATUS_OK },
- { "/ssl/strictness/async/strict/without-ca",
- FALSE, TRUE, FALSE, SOUP_STATUS_SSL_FAILED },
- { "/ssl/strictness/async/non-strict/with-ca",
- FALSE, FALSE, TRUE, SOUP_STATUS_OK },
- { "/ssl/strictness/async/non-strict/without-ca",
- FALSE, FALSE, FALSE, SOUP_STATUS_OK },
- { "/ssl/strictness/sync/strict/with-ca",
- TRUE, TRUE, TRUE, SOUP_STATUS_OK },
- { "/ssl/strictness/sync/strict/without-ca",
- TRUE, TRUE, FALSE, SOUP_STATUS_SSL_FAILED },
- { "/ssl/strictness/sync/non-strict/with-ca",
- TRUE, FALSE, TRUE, SOUP_STATUS_OK },
- { "/ssl/strictness/sync/non-strict/without-ca",
- TRUE, FALSE, FALSE, SOUP_STATUS_OK },
+ { "/ssl/strictness/strict/with-ca",
+ TRUE, TRUE, SOUP_STATUS_OK },
+ { "/ssl/strictness/strict/without-ca",
+ TRUE, FALSE, SOUP_STATUS_SSL_FAILED },
+ { "/ssl/strictness/non-strict/with-ca",
+ FALSE, TRUE, SOUP_STATUS_OK },
+ { "/ssl/strictness/non-strict/without-ca",
+ FALSE, FALSE, SOUP_STATUS_OK },
};
static void
@@ -96,7 +32,7 @@ do_strictness_test (gconstpointer data)
SOUP_TEST_SKIP_IF_NO_TLS;
- session = soup_test_session_new (test->sync ? SOUP_TYPE_SESSION_SYNC : SOUP_TYPE_SESSION_ASYNC,
+ session = soup_test_session_new (SOUP_TYPE_SESSION,
NULL);
if (!test->strict) {
g_object_set (G_OBJECT (session),
@@ -384,8 +320,6 @@ main (int argc, char **argv)
uri = NULL;
g_test_add_func ("/ssl/session-properties", do_session_property_tests);
- g_test_add_func ("/ssl/message-properties/async", do_async_properties_tests);
- g_test_add_func ("/ssl/message-properties/sync", do_sync_properties_tests);
g_test_add_func ("/ssl/tls-interaction", do_tls_interaction_test);
for (i = 0; i < G_N_ELEMENTS (strictness_tests); i++) {
diff --git a/tests/timeout-test.c b/tests/timeout-test.c
index 96505e9b..03bc33fe 100644
--- a/tests/timeout-test.c
+++ b/tests/timeout-test.c
@@ -255,11 +255,11 @@ do_sync_timeout_tests (gconstpointer data)
} else
extra_slow = FALSE;
- timeout_session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC,
+ timeout_session = soup_test_session_new (SOUP_TYPE_SESSION,
SOUP_SESSION_TIMEOUT, extra_slow ? 3 : 1,
NULL);
/* SOUP_SESSION_TIMEOUT doesn't work with sync sessions */
- plain_session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC,
+ plain_session = soup_test_session_new (SOUP_TYPE_SESSION,
NULL);
do_msg_tests_for_session (timeout_session, NULL, plain_session, fast_uri, slow_uri);
do_req_tests_for_session (timeout_session, NULL, plain_session, fast_uri, slow_uri);
diff --git a/tests/xmlrpc-test.c b/tests/xmlrpc-test.c
index 8b1f9dab..8fa26bac 100644
--- a/tests/xmlrpc-test.c
+++ b/tests/xmlrpc-test.c
@@ -717,7 +717,7 @@ main (int argc, char **argv)
uri = default_uri;
}
- session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
g_test_add_func ("/xmlrpc/variant/serializer", test_serializer);
g_test_add_func ("/xmlrpc/variant/deserializer", test_deserializer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]