Signed-off-by: Wolfgang Bumiller <w.bumiller@xxxxxxxxxxx> --- tests/session.c | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/tests/session.c b/tests/session.c index feee3db..c9f6bca 100644 --- a/tests/session.c +++ b/tests/session.c @@ -8,24 +8,28 @@ static void test_session_uri(void) gint i; struct { + gchar *host; gchar *port; gchar *tls_port; gchar *uri_input; gchar *uri_output; } tests[] = { /* Arguments with empty value */ - { "5900", NULL, + { "localhost", "5900", NULL, "spice://localhost?port=5900&tls-port=", "spice://localhost?port=5900&" }, - { "5910", NULL, + { "localhost", "5910", NULL, "spice://localhost?tls-port=&port=5910", "spice://localhost?port=5910&" }, - { NULL, "5920", + { "localhost", NULL, "5920", "spice://localhost?tls-port=5920&port=", "spice://localhost?tls-port=5920" }, - { NULL, "5930", - "spice://localhost?port=&tls-port=5930", - "spice://localhost?tls-port=5930" }, + { "127.0.0.1", NULL, "5930", + "spice://127.0.0.1?port=&tls-port=5930", + "spice://127.0.0.1?tls-port=5930" }, + { "::1", NULL, "5940", + "spice://[::1]?port=&tls-port=5940", + "spice://[::1]?tls-port=5940" }, }; /* Set URI and check URI, port and tls_port */ @@ -54,6 +58,7 @@ static void test_session_uri(void) s = spice_session_new(); g_object_set(s, + "host", tests[i].host, "port", tests[i].port, "tls-port", tests[i].tls_port, NULL); @@ -64,11 +69,39 @@ static void test_session_uri(void) } } +static void test_session_proxy(void) +{ + SpiceSession *s; + gint i; + + struct { + gchar *proxy; + } tests[] = { + { "http://localhost:3128" }, + { "http://127.0.0.1:3129" }, + { "http://[::1]:3130" }, + }; + + for (i = 0; i < G_N_ELEMENTS(tests); i++) { + gchar *uri; + + s = spice_session_new(); + g_object_set(s, "proxy", tests[i].proxy, NULL); + g_object_get(s, + "proxy", &uri, + NULL); + g_assert_cmpstr(tests[i].proxy, ==, uri); + g_clear_pointer(&uri, g_free); + g_object_unref(s); + } +} + int main(int argc, char* argv[]) { g_test_init(&argc, &argv, NULL); g_test_add_func("/session/uri", test_session_uri); + g_test_add_func("/session/proxy", test_session_proxy); return g_test_run(); } -- 2.1.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel