diff options
author | Dan Winship <danw@gnome.org> | 2013-04-17 17:38:37 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2013-04-24 11:39:50 -0400 |
commit | d3b3e50ce850b2357dda3b2b046650fc1e1d30b0 (patch) | |
tree | 4a3721af32169126b23f380f72fb029131d18a46 | |
parent | c48b661a18bad9e98737be9522ebadf54be29fd6 (diff) | |
download | libsoup-d3b3e50ce850b2357dda3b2b046650fc1e1d30b0.tar.gz libsoup-d3b3e50ce850b2357dda3b2b046650fc1e1d30b0.tar.bz2 libsoup-d3b3e50ce850b2357dda3b2b046650fc1e1d30b0.zip |
tests: fix to pass when glib-networking TLS isn't available
-rw-r--r-- | tests/connection-test.c | 28 | ||||
-rw-r--r-- | tests/misc-test.c | 32 | ||||
-rw-r--r-- | tests/proxy-test.c | 3 |
3 files changed, 43 insertions, 20 deletions
diff --git a/tests/connection-test.c b/tests/connection-test.c index 6dc7c005..cdc4cced 100644 --- a/tests/connection-test.c +++ b/tests/connection-test.c @@ -771,8 +771,11 @@ do_connection_state_test_for_session (SoupSession *session) debug_printf (1, " http\n"); do_one_connection_state_test (session, HTTP_SERVER); - debug_printf (1, " https\n"); - do_one_connection_state_test (session, HTTPS_SERVER); + if (tls_available) { + debug_printf (1, " https\n"); + do_one_connection_state_test (session, HTTPS_SERVER); + } else + debug_printf (1, " https -- SKIPPING\n"); proxy_uri = soup_uri_new (HTTP_PROXY); g_object_set (G_OBJECT (session), @@ -783,8 +786,11 @@ do_connection_state_test_for_session (SoupSession *session) debug_printf (1, " http with proxy\n"); do_one_connection_state_test (session, HTTP_SERVER); - debug_printf (1, " https with proxy\n"); - do_one_connection_state_test (session, HTTPS_SERVER); + if (tls_available) { + debug_printf (1, " https with proxy\n"); + do_one_connection_state_test (session, HTTPS_SERVER); + } else + debug_printf (1, " https with proxy -- SKIPPING\n"); } static void @@ -886,8 +892,11 @@ do_connection_event_test_for_session (SoupSession *session) debug_printf (1, " http\n"); do_one_connection_event_test (session, HTTP_SERVER, "rRcCx"); - debug_printf (1, " https\n"); - do_one_connection_event_test (session, HTTPS_SERVER, "rRcCtTx"); + if (tls_available) { + debug_printf (1, " https\n"); + do_one_connection_event_test (session, HTTPS_SERVER, "rRcCtTx"); + } else + debug_printf (1, " https -- SKIPPING\n"); proxy_uri = soup_uri_new (HTTP_PROXY); g_object_set (G_OBJECT (session), @@ -898,8 +907,11 @@ do_connection_event_test_for_session (SoupSession *session) debug_printf (1, " http with proxy\n"); do_one_connection_event_test (session, HTTP_SERVER, "rRcCx"); - debug_printf (1, " https with proxy\n"); - do_one_connection_event_test (session, HTTPS_SERVER, "rRcCpPtTx"); + if (tls_available) { + debug_printf (1, " https with proxy\n"); + do_one_connection_event_test (session, HTTPS_SERVER, "rRcCpPtTx"); + } else + debug_printf (1, " https with proxy -- SKIPPING\n"); } static void diff --git a/tests/misc-test.c b/tests/misc-test.c index c0701f3d..a9150a11 100644 --- a/tests/misc-test.c +++ b/tests/misc-test.c @@ -1021,12 +1021,15 @@ do_aliases_test (void) do_aliases_test_for_session (session, "http"); soup_test_session_abort_unref (session); - debug_printf (1, " foo-means-https\n"); - session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, - SOUP_SESSION_HTTPS_ALIASES, aliases, - NULL); - do_aliases_test_for_session (session, "https"); - soup_test_session_abort_unref (session); + if (tls_available) { + debug_printf (1, " foo-means-https\n"); + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, + SOUP_SESSION_HTTPS_ALIASES, aliases, + NULL); + do_aliases_test_for_session (session, "https"); + soup_test_session_abort_unref (session); + } else + debug_printf (1, " foo-means-https -- SKIPPING\n"); debug_printf (1, " foo-means-nothing\n"); session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, @@ -1217,10 +1220,12 @@ main (int argc, char **argv) soup_server_add_auth_domain (server, auth_domain); g_object_unref (auth_domain); - ssl_server = soup_test_server_new_ssl (TRUE); - soup_server_add_handler (ssl_server, NULL, server_callback, "https", NULL); - ssl_base_uri = soup_uri_new ("https://127.0.0.1/"); - soup_uri_set_port (ssl_base_uri, soup_server_get_port (ssl_server)); + if (tls_available) { + ssl_server = soup_test_server_new_ssl (TRUE); + soup_server_add_handler (ssl_server, NULL, server_callback, "https", NULL); + ssl_base_uri = soup_uri_new ("https://127.0.0.1/"); + soup_uri_set_port (ssl_base_uri, soup_server_get_port (ssl_server)); + } do_host_test (); do_callback_unref_test (); @@ -1239,9 +1244,12 @@ main (int argc, char **argv) do_pause_abort_test (); soup_uri_free (base_uri); - soup_uri_free (ssl_base_uri); soup_test_server_quit_unref (server); - soup_test_server_quit_unref (ssl_server); + + if (tls_available) { + soup_uri_free (ssl_base_uri); + soup_test_server_quit_unref (ssl_server); + } test_cleanup (); return errors != 0; diff --git a/tests/proxy-test.c b/tests/proxy-test.c index 075289dc..44d125d0 100644 --- a/tests/proxy-test.c +++ b/tests/proxy-test.c @@ -340,6 +340,9 @@ do_proxy_redirect_test (void) SoupURI *proxy_uri, *req_uri, *new_uri; SoupMessage *msg; + if (!tls_available) + return; + debug_printf (1, "\nTesting redirection through proxy\n"); proxy_uri = soup_uri_new (proxies[SIMPLE_PROXY]); |