diff options
Diffstat (limited to 'testing/web-platform/tests/websockets')
20 files changed, 60 insertions, 20 deletions
diff --git a/testing/web-platform/tests/websockets/Send-binary-arraybufferview-float16.any.js b/testing/web-platform/tests/websockets/Send-binary-arraybufferview-float16.any.js new file mode 100644 index 0000000000..7251ebfed2 --- /dev/null +++ b/testing/web-platform/tests/websockets/Send-binary-arraybufferview-float16.any.js @@ -0,0 +1,40 @@ +// META: script=constants.sub.js +// META: variant=?default +// META: variant=?wpt_flags=h2 +// META: variant=?wss + +var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Float16Array - Connection should be closed"); + +var data = ""; +var datasize = 4; +var view; +var wsocket = CreateWebSocket(false, false); +var isOpenCalled = false; +var isMessageCalled = false; + +wsocket.addEventListener('open', test.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + view = new Float16Array(data); + for (var i = 0; i < 2; i++) { + view[i] = i; + } + wsocket.send(view); + isOpenCalled = true; +}), true); + +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; + var resultView = new Float16Array(evt.data); + for (var i = 0; i < resultView.length; i++) { + assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); + } + wsocket.close(); +}), true); + +wsocket.addEventListener('close', test.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") + assert_equals(evt.wasClean, true, "wasClean should be true"); + test.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/handlers/basic_auth_wsh.py b/testing/web-platform/tests/websockets/handlers/basic_auth_wsh.py index 72e920a1d8..84f42711b2 100755 --- a/testing/web-platform/tests/websockets/handlers/basic_auth_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/basic_auth_wsh.py @@ -4,7 +4,7 @@ 'foo' and password is 'bar'.""" -from mod_pywebsocket.handshake import AbortedByUserException +from pywebsocket3.handshake import AbortedByUserException def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/websockets/handlers/delayed-passive-close_wsh.py b/testing/web-platform/tests/websockets/handlers/delayed-passive-close_wsh.py index 7d55b88ecc..5da09fd059 100755 --- a/testing/web-platform/tests/websockets/handlers/delayed-passive-close_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/delayed-passive-close_wsh.py @@ -1,5 +1,5 @@ #!/usr/bin/python -from mod_pywebsocket import common +from pywebsocket3 import common import time def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/websockets/handlers/echo-cookie_wsh.py b/testing/web-platform/tests/websockets/handlers/echo-cookie_wsh.py index 98620b6552..746eafd2cd 100755 --- a/testing/web-platform/tests/websockets/handlers/echo-cookie_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/echo-cookie_wsh.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): request.ws_cookie = request.headers_in.get('cookie') diff --git a/testing/web-platform/tests/websockets/handlers/echo-query_v13_wsh.py b/testing/web-platform/tests/websockets/handlers/echo-query_v13_wsh.py index d670e6e660..7fb4cfe593 100755 --- a/testing/web-platform/tests/websockets/handlers/echo-query_v13_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/echo-query_v13_wsh.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): pass diff --git a/testing/web-platform/tests/websockets/handlers/echo-query_wsh.py b/testing/web-platform/tests/websockets/handlers/echo-query_wsh.py index 3921913495..88696175d2 100755 --- a/testing/web-platform/tests/websockets/handlers/echo-query_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/echo-query_wsh.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): pass # Always accept. diff --git a/testing/web-platform/tests/websockets/handlers/echo_raw_wsh.py b/testing/web-platform/tests/websockets/handlers/echo_raw_wsh.py index e1fc26608f..5b434cf266 100755 --- a/testing/web-platform/tests/websockets/handlers/echo_raw_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/echo_raw_wsh.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/websockets/handlers/echo_wsh.py b/testing/web-platform/tests/websockets/handlers/echo_wsh.py index 7367b70af1..35a0a6f6ea 100755 --- a/testing/web-platform/tests/websockets/handlers/echo_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/echo_wsh.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from mod_pywebsocket import common +from pywebsocket3 import common _GOODBYE_MESSAGE = u'Goodbye' diff --git a/testing/web-platform/tests/websockets/handlers/empty-message_wsh.py b/testing/web-platform/tests/websockets/handlers/empty-message_wsh.py index 0eb107f0b1..f791ee1842 100755 --- a/testing/web-platform/tests/websockets/handlers/empty-message_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/empty-message_wsh.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): pass # Always accept. diff --git a/testing/web-platform/tests/websockets/handlers/msg_channel_wsh.py b/testing/web-platform/tests/websockets/handlers/msg_channel_wsh.py index 7a66646f2b..a45dd99164 100644 --- a/testing/web-platform/tests/websockets/handlers/msg_channel_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/msg_channel_wsh.py @@ -6,7 +6,7 @@ import threading import traceback from queue import Empty -from mod_pywebsocket import stream, msgutil +from pywebsocket3 import stream, msgutil from wptserve import stash as stashmod logger = logging.getLogger() diff --git a/testing/web-platform/tests/websockets/handlers/origin_wsh.py b/testing/web-platform/tests/websockets/handlers/origin_wsh.py index ce5f3a7f6a..b833db6381 100755 --- a/testing/web-platform/tests/websockets/handlers/origin_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/origin_wsh.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/websockets/handlers/passive-close-abort_wsh.py b/testing/web-platform/tests/websockets/handlers/passive-close-abort_wsh.py index ac3f67c8db..6f8a3d1bf1 100644 --- a/testing/web-platform/tests/websockets/handlers/passive-close-abort_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/passive-close-abort_wsh.py @@ -7,7 +7,7 @@ Wait for a Close frame from the client and then close the connection without sending a Close frame in return. """ -from mod_pywebsocket.handshake import AbortedByUserException +from pywebsocket3.handshake import AbortedByUserException def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/websockets/handlers/protocol_array_wsh.py b/testing/web-platform/tests/websockets/handlers/protocol_array_wsh.py index be24ee01fd..d8e1229cdb 100755 --- a/testing/web-platform/tests/websockets/handlers/protocol_array_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/protocol_array_wsh.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): line = request.headers_in.get('sec-websocket-protocol') diff --git a/testing/web-platform/tests/websockets/handlers/protocol_wsh.py b/testing/web-platform/tests/websockets/handlers/protocol_wsh.py index 10bdf33205..3a6aeb400b 100755 --- a/testing/web-platform/tests/websockets/handlers/protocol_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/protocol_wsh.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): request.ws_protocol = request.headers_in.get('sec-websocket-protocol') diff --git a/testing/web-platform/tests/websockets/handlers/referrer_wsh.py b/testing/web-platform/tests/websockets/handlers/referrer_wsh.py index 9df652dc3c..2d183d5586 100755 --- a/testing/web-platform/tests/websockets/handlers/referrer_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/referrer_wsh.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): pass diff --git a/testing/web-platform/tests/websockets/handlers/remote-close_wsh.py b/testing/web-platform/tests/websockets/handlers/remote-close_wsh.py index aadd99ea95..c94870ad87 100644 --- a/testing/web-platform/tests/websockets/handlers/remote-close_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/remote-close_wsh.py @@ -20,7 +20,7 @@ Example: /remote-close?code=1000&reason=Done import urllib -from mod_pywebsocket.handshake import AbortedByUserException +from pywebsocket3.handshake import AbortedByUserException def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/websockets/handlers/simple_handshake_wsh.py b/testing/web-platform/tests/websockets/handlers/simple_handshake_wsh.py index ad466877fe..23893c95f1 100755 --- a/testing/web-platform/tests/websockets/handlers/simple_handshake_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/simple_handshake_wsh.py @@ -1,7 +1,7 @@ #!/usr/bin/python -from mod_pywebsocket import common, stream -from mod_pywebsocket.handshake import AbortedByUserException, hybi +from pywebsocket3 import common, stream +from pywebsocket3.handshake import AbortedByUserException, hybi def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/websockets/handlers/sleep_10_v13_wsh.py b/testing/web-platform/tests/websockets/handlers/sleep_10_v13_wsh.py index bdef2f2afd..4faa42aa45 100755 --- a/testing/web-platform/tests/websockets/handlers/sleep_10_v13_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/sleep_10_v13_wsh.py @@ -1,7 +1,7 @@ #!/usr/bin/python import sys, urllib, time -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): time.sleep(10) diff --git a/testing/web-platform/tests/websockets/handlers/stash_responder_blocking_wsh.py b/testing/web-platform/tests/websockets/handlers/stash_responder_blocking_wsh.py index 10ecdfe0da..968156868a 100755 --- a/testing/web-platform/tests/websockets/handlers/stash_responder_blocking_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/stash_responder_blocking_wsh.py @@ -2,7 +2,7 @@ import json import threading import wptserve.stash -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil address, authkey = wptserve.stash.load_env_config() path = "/stash_responder_blocking" diff --git a/testing/web-platform/tests/websockets/handlers/stash_responder_wsh.py b/testing/web-platform/tests/websockets/handlers/stash_responder_wsh.py index d18ad3bc96..b401997480 100755 --- a/testing/web-platform/tests/websockets/handlers/stash_responder_wsh.py +++ b/testing/web-platform/tests/websockets/handlers/stash_responder_wsh.py @@ -1,7 +1,7 @@ #!/usr/bin/python import json import urllib -from mod_pywebsocket import msgutil +from pywebsocket3 import msgutil from wptserve import stash address, authkey = stash.load_env_config() |