summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2012-12-10 17:30:21 +0100
committerDan Winship <danw@gnome.org>2012-12-10 17:30:21 +0100
commit64272f77902c91145f6dcbaad5919791b4bc7e36 (patch)
tree0cd6057c7289b00854f9bf89549553fca1f620ae /tests
parent17499abfc0c1fc23c54114f09e8fec348a8bd42d (diff)
downloadlibsoup-64272f77902c91145f6dcbaad5919791b4bc7e36.tar.gz
libsoup-64272f77902c91145f6dcbaad5919791b4bc7e36.tar.bz2
libsoup-64272f77902c91145f6dcbaad5919791b4bc7e36.zip
tests: fix SoupRequester deprecation warnings
Fix multipart-test and resource-test to use the new SoupSession APIs rather than SoupRequester. Fix requester-test (which intentionally tests that SoupRequester still works too) to not show deprecation warnings.
Diffstat (limited to 'tests')
-rw-r--r--tests/multipart-test.c8
-rw-r--r--tests/requester-test.c3
-rw-r--r--tests/resource-test.c37
3 files changed, 20 insertions, 28 deletions
diff --git a/tests/multipart-test.c b/tests/multipart-test.c
index a299684e..8bcc4cd4 100644
--- a/tests/multipart-test.c
+++ b/tests/multipart-test.c
@@ -20,7 +20,7 @@ typedef enum {
} MultipartMode;
char *buffer;
-SoupRequester *requester;
+SoupSession *session;
char *base_uri_string;
SoupURI *base_uri;
SoupMultipartInputStream *multipart;
@@ -494,7 +494,7 @@ static void
test_multipart (int headers_expected, int sniffed_expected, MultipartMode multipart_mode)
{
GError* error = NULL;
- SoupRequest* request = soup_requester_request (requester, base_uri_string, &error);
+ SoupRequest* request = soup_session_request (session, base_uri_string, &error);
SoupMessage *msg = soup_request_http_get_message (SOUP_REQUEST_HTTP (request));
GMainLoop *loop = g_main_loop_new (NULL, TRUE);
@@ -571,7 +571,6 @@ int
main (int argc, char **argv)
{
SoupServer *server;
- SoupSession *session;
test_init (argc, argv, NULL);
@@ -591,11 +590,8 @@ main (int argc, char **argv)
"max-conns", 20,
"max-conns-per-host", 20,
NULL);
- soup_session_add_feature_by_type (session, SOUP_TYPE_REQUESTER);
soup_session_add_feature_by_type (session, SOUP_TYPE_CONTENT_SNIFFER);
- requester = SOUP_REQUESTER (soup_session_get_feature (session, SOUP_TYPE_REQUESTER));
-
test_multipart (1, 1, NO_MULTIPART);
test_multipart (1, 1, SYNC_MULTIPART);
test_multipart (1, 1, ASYNC_MULTIPART);
diff --git a/tests/requester-test.c b/tests/requester-test.c
index 4a276783..0a61815b 100644
--- a/tests/requester-test.c
+++ b/tests/requester-test.c
@@ -3,6 +3,9 @@
* Copyright (C) 2011 Red Hat, Inc.
*/
+/* Kill SoupRequester-related deprecation warnings */
+#define SOUP_VERSION_MIN_REQUIRED SOUP_VERSION_2_40
+
#include "test-utils.h"
SoupServer *server;
diff --git a/tests/resource-test.c b/tests/resource-test.c
index 449820a4..21e2f98e 100644
--- a/tests/resource-test.c
+++ b/tests/resource-test.c
@@ -185,8 +185,8 @@ do_sync_request (SoupRequest *request)
}
static void
-do_request_file_test (SoupRequester *requester,
- gboolean async)
+do_request_file_test (SoupSession *session,
+ gboolean async)
{
SoupRequest *request;
GFile *index;
@@ -200,7 +200,7 @@ do_request_file_test (SoupRequester *requester,
uri = soup_uri_new (uri_string);
g_free (uri_string);
- request = soup_requester_request_uri (requester, uri, NULL);
+ request = soup_session_request_uri (session, uri, NULL);
if (async)
do_async_request (request);
else
@@ -211,8 +211,8 @@ do_request_file_test (SoupRequester *requester,
}
static void
-do_request_data_test (SoupRequester *requester,
- gboolean async)
+do_request_data_test (SoupSession *session,
+ gboolean async)
{
SoupRequest *request;
gchar *base64;
@@ -226,7 +226,7 @@ do_request_data_test (SoupRequester *requester,
uri = soup_uri_new (uri_string);
g_free (uri_string);
- request = soup_requester_request_uri (requester, uri, NULL);
+ request = soup_session_request_uri (session, uri, NULL);
if (async)
do_async_request (request);
else
@@ -237,14 +237,14 @@ do_request_data_test (SoupRequester *requester,
}
static void
-do_request_gresource_test (SoupRequester *requester,
- gboolean async)
+do_request_gresource_test (SoupSession *session,
+ gboolean async)
{
SoupRequest *request;
SoupURI *uri;
uri = soup_uri_new ("resource:///org/gnome/libsoup/tests/index.txt");
- request = soup_requester_request_uri (requester, uri, NULL);
+ request = soup_session_request_uri (session, uri, NULL);
if (async)
do_async_request (request);
else
@@ -258,7 +258,6 @@ int
main (int argc, char **argv)
{
SoupSession *session;
- SoupRequester *requester;
test_init (argc, argv, NULL);
@@ -267,13 +266,10 @@ main (int argc, char **argv)
/* Sync tests */
session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
- requester = soup_requester_new ();
- soup_session_add_feature (session, SOUP_SESSION_FEATURE (requester));
- g_object_unref (requester);
- do_request_file_test (requester, FALSE);
- do_request_data_test (requester, FALSE);
- do_request_gresource_test (requester, FALSE);
+ do_request_file_test (session, FALSE);
+ do_request_data_test (session, FALSE);
+ do_request_gresource_test (session, FALSE);
soup_test_session_abort_unref (session);
@@ -281,13 +277,10 @@ main (int argc, char **argv)
session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
NULL);
- requester = soup_requester_new ();
- soup_session_add_feature (session, SOUP_SESSION_FEATURE (requester));
- g_object_unref (requester);
- do_request_file_test (requester, TRUE);
- do_request_data_test (requester, TRUE);
- do_request_gresource_test (requester, TRUE);
+ do_request_file_test (session, TRUE);
+ do_request_data_test (session, TRUE);
+ do_request_gresource_test (session, TRUE);
soup_test_session_abort_unref (session);