summaryrefslogtreecommitdiff
path: root/tests/websocket-test.c
diff options
context:
space:
mode:
authorIgnacio Casal Quinteiro <icq@gnome.org>2016-08-17 09:17:49 +0200
committerIgnacio Casal Quinteiro <icq@gnome.org>2016-08-22 15:46:16 +0200
commit476e317219592ba15552097963d2042fd259f562 (patch)
tree949fc8b331323145ed75c9c0945ee86d05c21bdf /tests/websocket-test.c
parentcec6e7344c8eb407f8e75d4b39bddcc36457c5b8 (diff)
downloadlibsoup-wip/max-payload-size.tar.gz
Add max-payload-size property to the websocket connection.wip/max-payload-size
This allows to change the limit for the payload of websocket packets. Also add the corresponding unit test. https://bugzilla.gnome.org/show_bug.cgi?id=770022
Diffstat (limited to 'tests/websocket-test.c')
-rw-r--r--tests/websocket-test.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/websocket-test.c b/tests/websocket-test.c
index eb74ea12..56cd1e13 100644
--- a/tests/websocket-test.c
+++ b/tests/websocket-test.c
@@ -380,6 +380,19 @@ test_send_big_packets (Test *test,
g_assert (g_bytes_equal (sent, received));
g_bytes_unref (sent);
g_bytes_unref (received);
+ received = NULL;
+
+ soup_websocket_connection_set_max_payload_size (test->client, 1000 * 1000 + 1);
+ g_assert (soup_websocket_connection_get_max_payload_size (test->client) == (1000 * 1000 + 1));
+ soup_websocket_connection_set_max_payload_size (test->server, 1000 * 1000 + 1);
+ g_assert (soup_websocket_connection_get_max_payload_size (test->server) == (1000 * 1000 + 1));
+
+ sent = g_bytes_new_take (g_strnfill (1000 * 1000, '?'), 1000 * 1000);
+ soup_websocket_connection_send_text (test->server, g_bytes_get_data (sent, NULL));
+ WAIT_UNTIL (received != NULL);
+ g_assert (g_bytes_equal (sent, received));
+ g_bytes_unref (sent);
+ g_bytes_unref (received);
}
static void