From fd759c62fc70638670da5311d3c7e3157402d125 Mon Sep 17 00:00:00 2001 From: moz-wptsync-bot Date: Tue, 1 May 2018 17:01:39 +0000 Subject: [PATCH] Bug 1456516 [wpt PR 10606] - Reindent websocket *.any.js files, a=testonly Automatic update from web-platform-testsEditorial: Reindent websocket *.any.js files Command used: find . -name "*.any.js" | xargs -I {} js-beautify -r -s 2 -n {} -- wpt-commits: 78d32dd2ed106a59a34664ade2274426601365de wpt-pr: 10606 --- .../tests/websockets/Close-1000-reason.any.js | 30 ++-- .../tests/websockets/Close-1000.any.js | 30 ++-- .../websockets/Close-Reason-124Bytes.any.js | 20 ++- .../Close-reason-unpaired-surrogates.any.js | 32 ++-- .../tests/websockets/Close-undefined.any.js | 14 +- .../Create-Secure-extensions-empty.any.js | 30 ++-- .../Create-Secure-url-with-space.any.js | 12 +- ...te-Secure-valid-url-array-protocols.any.js | 30 ++-- ...te-Secure-valid-url-binaryType-blob.any.js | 30 ++-- ...ure-valid-url-protocol-setCorrectly.any.js | 30 ++-- ...te-Secure-valid-url-protocol-string.any.js | 30 ++-- .../websockets/Create-Secure-valid-url.any.js | 30 ++-- ...ure-verify-url-set-non-default-port.any.js | 10 +- .../Create-asciiSep-protocol-string.any.js | 12 +- .../websockets/Create-blocked-port.any.js | 158 +++++++++--------- .../websockets/Create-invalid-urls.any.js | 42 +++-- .../websockets/Create-non-absolute-url.any.js | 10 +- .../Create-nonAscii-protocol-string.any.js | 12 +- .../Create-on-worker-shutdown.any.js | 6 +- .../Create-protocol-with-space.any.js | 10 +- ...protocols-repeated-case-insensitive.any.js | 10 +- .../Create-protocols-repeated.any.js | 10 +- .../Create-valid-url-array-protocols.any.js | 30 ++-- .../Create-valid-url-protocol-empty.any.js | 10 +- .../Create-valid-url-protocol.any.js | 30 ++-- .../tests/websockets/Create-valid-url.any.js | 30 ++-- ...ate-verify-url-set-non-default-port.any.js | 10 +- .../websockets/Create-wrong-scheme.any.js | 10 +- .../Secure-Close-1000-reason.any.js | 30 ++-- .../Secure-Close-1000-verify-code.any.js | 30 ++-- .../tests/websockets/Secure-Close-1000.any.js | 30 ++-- .../Secure-Close-1005-verify-code.any.js | 30 ++-- .../tests/websockets/Secure-Close-1005.any.js | 16 +- .../Secure-Close-2999-reason.any.js | 14 +- .../Secure-Close-3000-reason.any.js | 30 ++-- .../Secure-Close-3000-verify-code.any.js | 28 ++-- .../Secure-Close-4999-reason.any.js | 30 ++-- .../Secure-Close-Reason-124Bytes.any.js | 20 ++- ...re-Close-Reason-Unpaired-surrogates.any.js | 32 ++-- .../websockets/Secure-Close-onlyReason.any.js | 14 +- .../Secure-Close-readyState-Closed.any.js | 30 ++-- .../Secure-Close-readyState-Closing.any.js | 16 +- ...Secure-Close-server-initiated-close.any.js | 30 ++-- .../websockets/Secure-Close-undefined.any.js | 14 +- .../websockets/Secure-Send-65K-data.any.js | 50 +++--- .../Secure-Send-binary-65K-arraybuffer.any.js | 50 +++--- .../Secure-Send-binary-arraybuffer.any.js | 50 +++--- ...Send-binary-arraybufferview-float32.any.js | 64 +++---- ...Send-binary-arraybufferview-float64.any.js | 64 +++---- ...e-Send-binary-arraybufferview-int32.any.js | 64 +++---- ...rraybufferview-uint16-offset-length.any.js | 64 +++---- ...inary-arraybufferview-uint32-offset.any.js | 64 +++---- ...arraybufferview-uint8-offset-length.any.js | 64 +++---- ...binary-arraybufferview-uint8-offset.any.js | 64 +++---- .../websockets/Secure-Send-binary-blob.any.js | 54 +++--- .../tests/websockets/Secure-Send-data.any.js | 44 ++--- .../tests/websockets/Secure-Send-null.any.js | 48 +++--- .../Secure-Send-paired-surrogates.any.js | 44 ++--- .../Secure-Send-unicode-data.any.js | 44 ++--- .../Secure-Send-unpaired-surrogates.any.js | 44 ++--- .../tests/websockets/Send-0byte-data.any.js | 44 ++--- .../tests/websockets/Send-65K-data.any.js | 50 +++--- .../Send-Unpaired-Surrogates.any.js | 44 ++--- .../tests/websockets/Send-before-open.any.js | 10 +- .../Send-binary-65K-arraybuffer.any.js | 50 +++--- .../websockets/Send-binary-arraybuffer.any.js | 50 +++--- ...binary-arraybufferview-int16-offset.any.js | 64 +++---- .../Send-binary-arraybufferview-int8.any.js | 64 +++---- .../tests/websockets/Send-binary-blob.any.js | 54 +++--- .../tests/websockets/Send-data.any.js | 44 ++--- .../tests/websockets/Send-null.any.js | 48 +++--- .../websockets/Send-paired-surrogates.any.js | 44 ++--- .../tests/websockets/Send-unicode-data.any.js | 44 ++--- .../websockets/binaryType-wrong-value.any.js | 28 ++-- .../tests/websockets/close-invalid.any.js | 30 ++-- .../tests/websockets/constructor.any.js | 2 +- .../tests/websockets/eventhandlers.any.js | 2 +- 77 files changed, 1350 insertions(+), 1310 deletions(-) diff --git a/testing/web-platform/tests/websockets/Close-1000-reason.any.js b/testing/web-platform/tests/websockets/Close-1000-reason.any.js index 9c2f8e13d2da..1517db2e06c5 100644 --- a/testing/web-platform/tests/websockets/Close-1000-reason.any.js +++ b/testing/web-platform/tests/websockets/Close-1000-reason.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(1000, "Clean Close"); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(1000, "Clean Close"); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be opened"); - assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); - assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be opened"); + assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); + assert_equals(evt.wasClean, true, "wasClean should be TRUE"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Close-1000.any.js b/testing/web-platform/tests/websockets/Close-1000.any.js index 382ab9864b20..e052f2385073 100644 --- a/testing/web-platform/tests/websockets/Close-1000.any.js +++ b/testing/web-platform/tests/websockets/Close-1000.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create WebSocket - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create WebSocket - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(1000); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(1000); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be opened"); - assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); - assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be opened"); + assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); + assert_equals(evt.wasClean, true, "wasClean should be TRUE"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Close-Reason-124Bytes.any.js b/testing/web-platform/tests/websockets/Close-Reason-124Bytes.any.js index 412991694a9a..97bc1bb224b8 100644 --- a/testing/web-platform/tests/websockets/Close-Reason-124Bytes.any.js +++ b/testing/web-platform/tests/websockets/Close-Reason-124Bytes.any.js @@ -1,13 +1,15 @@ // META: script=websocket.sub.js - var test = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(code, 'reason more than 123 bytes') - SYNTAX_ERR is thrown"); +var test = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(code, 'reason more than 123 bytes') - SYNTAX_ERR is thrown"); - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', test.step_func(function (evt) { - var reason = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"; - assert_equals(reason.length, 124); - assert_throws("SYNTAX_ERR", function () { wsocket.close(1000, reason) }); - test.done(); - }), true); +wsocket.addEventListener('open', test.step_func(function(evt) { + var reason = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"; + assert_equals(reason.length, 124); + assert_throws("SYNTAX_ERR", function() { + wsocket.close(1000, reason) + }); + test.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Close-reason-unpaired-surrogates.any.js b/testing/web-platform/tests/websockets/Close-reason-unpaired-surrogates.any.js index 7d2a7a2d22a2..119a32d0c931 100644 --- a/testing/web-platform/tests/websockets/Close-reason-unpaired-surrogates.any.js +++ b/testing/web-platform/tests/websockets/Close-reason-unpaired-surrogates.any.js @@ -1,21 +1,21 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get opened"); - var testClose = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed"); +var testOpen = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get opened"); +var testClose = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed"); - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; - var replacementChar = "\uFFFD"; - var reason = "\uD807"; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; +var replacementChar = "\uFFFD"; +var reason = "\uD807"; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(1000, reason); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(1000, reason); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be opened"); - assert_equals(evt.reason, replacementChar, "reason replaced with replacement character"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be opened"); + assert_equals(evt.reason, replacementChar, "reason replaced with replacement character"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Close-undefined.any.js b/testing/web-platform/tests/websockets/Close-undefined.any.js index d6d2ba7da1bf..67bc9b219c13 100644 --- a/testing/web-platform/tests/websockets/Close-undefined.any.js +++ b/testing/web-platform/tests/websockets/Close-undefined.any.js @@ -1,11 +1,11 @@ // META: script=websocket.sub.js - var test = async_test(); +var test = async_test(); - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', test.step_func(function (evt) { - wsocket.close(undefined); - test.done(); - }), true); +wsocket.addEventListener('open', test.step_func(function(evt) { + wsocket.close(undefined); + test.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Create-Secure-extensions-empty.any.js b/testing/web-platform/tests/websockets/Create-Secure-extensions-empty.any.js index 705814e09935..82b000dde728 100644 --- a/testing/web-platform/tests/websockets/Create-Secure-extensions-empty.any.js +++ b/testing/web-platform/tests/websockets/Create-Secure-extensions-empty.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - assert_equals(wsocket.extensions, "", "extensions should be empty"); - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + assert_equals(wsocket.extensions, "", "extensions should be empty"); + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be closed"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be closed"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Create-Secure-url-with-space.any.js b/testing/web-platform/tests/websockets/Create-Secure-url-with-space.any.js index 9c979953fb4d..94265c6182c1 100644 --- a/testing/web-platform/tests/websockets/Create-Secure-url-with-space.any.js +++ b/testing/web-platform/tests/websockets/Create-Secure-url-with-space.any.js @@ -1,7 +1,9 @@ // META: script=websocket.sub.js - test(function () { - var wsocket; - var spaceUrl = "web platform.test"; - assert_throws("SYNTAX_ERR", function () { wsocket = CreateWebSocketWithSpaceInUrl(spaceUrl) }); - }, "W3C WebSocket API - Create Secure WebSocket - Pass a URL with a space - SYNTAX_ERR should be thrown") +test(function() { + var wsocket; + var spaceUrl = "web platform.test"; + assert_throws("SYNTAX_ERR", function() { + wsocket = CreateWebSocketWithSpaceInUrl(spaceUrl) + }); +}, "W3C WebSocket API - Create Secure WebSocket - Pass a URL with a space - SYNTAX_ERR should be thrown") diff --git a/testing/web-platform/tests/websockets/Create-Secure-valid-url-array-protocols.any.js b/testing/web-platform/tests/websockets/Create-Secure-valid-url-array-protocols.any.js index d2b10541c43d..fcaf8a36454d 100644 --- a/testing/web-platform/tests/websockets/Create-Secure-valid-url-array-protocols.any.js +++ b/testing/web-platform/tests/websockets/Create-Secure-valid-url-array-protocols.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, true); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, true); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Create-Secure-valid-url-binaryType-blob.any.js b/testing/web-platform/tests/websockets/Create-Secure-valid-url-binaryType-blob.any.js index 4de8c08d982d..fed88f5c2f2f 100644 --- a/testing/web-platform/tests/websockets/Create-Secure-valid-url-binaryType-blob.any.js +++ b/testing/web-platform/tests/websockets/Create-Secure-valid-url-binaryType-blob.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - assert_equals(wsocket.binaryType, "blob", "binaryType should be set to Blob"); - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + assert_equals(wsocket.binaryType, "blob", "binaryType should be set to Blob"); + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Create-Secure-valid-url-protocol-setCorrectly.any.js b/testing/web-platform/tests/websockets/Create-Secure-valid-url-protocol-setCorrectly.any.js index 54074cc52f7e..7ecd2959f76d 100644 --- a/testing/web-platform/tests/websockets/Create-Secure-valid-url-protocol-setCorrectly.any.js +++ b/testing/web-platform/tests/websockets/Create-Secure-valid-url-protocol-setCorrectly.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - protocol should be set correctly - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - protocol should be set correctly - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed"); - var wsocket = CreateWebSocket(true, true, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, true, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - assert_equals(wsocket.protocol, "echo", "protocol should be set to echo"); - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + assert_equals(wsocket.protocol, "echo", "protocol should be set to echo"); + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Create-Secure-valid-url-protocol-string.any.js b/testing/web-platform/tests/websockets/Create-Secure-valid-url-protocol-string.any.js index 5c2682dbf774..59c77c696acc 100644 --- a/testing/web-platform/tests/websockets/Create-Secure-valid-url-protocol-string.any.js +++ b/testing/web-platform/tests/websockets/Create-Secure-valid-url-protocol-string.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Check readyState is 1"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Check readyState is 1"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed"); - var wsocket = CreateWebSocket(true, true, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, true, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Create-Secure-valid-url.any.js b/testing/web-platform/tests/websockets/Create-Secure-valid-url.any.js index 5d9ca8769ab6..6f1229e76166 100644 --- a/testing/web-platform/tests/websockets/Create-Secure-valid-url.any.js +++ b/testing/web-platform/tests/websockets/Create-Secure-valid-url.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Create-Secure-verify-url-set-non-default-port.any.js b/testing/web-platform/tests/websockets/Create-Secure-verify-url-set-non-default-port.any.js index 0b4aa60fd28a..755dbe2f3ffd 100644 --- a/testing/web-platform/tests/websockets/Create-Secure-verify-url-set-non-default-port.any.js +++ b/testing/web-platform/tests/websockets/Create-Secure-verify-url-set-non-default-port.any.js @@ -1,7 +1,7 @@ // META: script=websocket.sub.js - test(function () { - var urlNonDefaultPort = "wss://" + __SERVER__NAME + ":" + __NEW__SECURE__PORT + "/" + __PATH; - var wsocket = new WebSocket(urlNonDefaultPort); - assert_equals(wsocket.url, urlNonDefaultPort, "wsocket.url is set correctly"); - }, "W3C WebSocket API - Create Secure WebSocket - wsocket.url should be set correctly") +test(function() { + var urlNonDefaultPort = "wss://" + __SERVER__NAME + ":" + __NEW__SECURE__PORT + "/" + __PATH; + var wsocket = new WebSocket(urlNonDefaultPort); + assert_equals(wsocket.url, urlNonDefaultPort, "wsocket.url is set correctly"); +}, "W3C WebSocket API - Create Secure WebSocket - wsocket.url should be set correctly") diff --git a/testing/web-platform/tests/websockets/Create-asciiSep-protocol-string.any.js b/testing/web-platform/tests/websockets/Create-asciiSep-protocol-string.any.js index b9e4c4466ef8..cb3c3e4c96f1 100644 --- a/testing/web-platform/tests/websockets/Create-asciiSep-protocol-string.any.js +++ b/testing/web-platform/tests/websockets/Create-asciiSep-protocol-string.any.js @@ -1,7 +1,9 @@ // META: script=websocket.sub.js - test(function () { - var asciiWithSep = "/echo"; - var wsocket; - assert_throws("SYNTAX_ERR", function () { wsocket = CreateWebSocketWithAsciiSep(asciiWithSep) }); - }, "W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string with an ascii separator character - SYNTAX_ERR is thrown") +test(function() { + var asciiWithSep = "/echo"; + var wsocket; + assert_throws("SYNTAX_ERR", function() { + wsocket = CreateWebSocketWithAsciiSep(asciiWithSep) + }); +}, "W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string with an ascii separator character - SYNTAX_ERR is thrown") diff --git a/testing/web-platform/tests/websockets/Create-blocked-port.any.js b/testing/web-platform/tests/websockets/Create-blocked-port.any.js index 77f205e173d2..f0dbc3f52298 100644 --- a/testing/web-platform/tests/websockets/Create-blocked-port.any.js +++ b/testing/web-platform/tests/websockets/Create-blocked-port.any.js @@ -1,81 +1,81 @@ // META: script=websocket.sub.js - async_test(t => { - const ws = CreateWebSocketWithBlockedPort(__PORT) - ws.onerror = t.unreached_func() - ws.onopen = t.step_func_done() - }, 'Basic check'); - // list of bad ports according to - // https://fetch.spec.whatwg.org/#port-blocking - [ - 1, // tcpmux - 7, // echo - 9, // discard - 11, // systat - 13, // daytime - 15, // netstat - 17, // qotd - 19, // chargen - 20, // ftp-data - 21, // ftp - 22, // ssh - 23, // telnet - 25, // smtp - 37, // time - 42, // name - 43, // nicname - 53, // domain - 77, // priv-rjs - 79, // finger - 87, // ttylink - 95, // supdup - 101, // hostriame - 102, // iso-tsap - 103, // gppitnp - 104, // acr-nema - 109, // pop2 - 110, // pop3 - 111, // sunrpc - 113, // auth - 115, // sftp - 117, // uucp-path - 119, // nntp - 123, // ntp - 135, // loc-srv / epmap - 139, // netbios - 143, // imap2 - 179, // bgp - 389, // ldap - 465, // smtp+ssl - 512, // print / exec - 513, // login - 514, // shell - 515, // printer - 526, // tempo - 530, // courier - 531, // chat - 532, // netnews - 540, // uucp - 556, // remotefs - 563, // nntp+ssl - 587, // smtp - 601, // syslog-conn - 636, // ldap+ssl - 993, // imap+ssl - 995, // pop3+ssl - 2049, // nfs - 3659, // apple-sasl - 4045, // lockd - 6000, // x11 - 6665, // irc (alternate) - 6666, // irc (alternate) - 6667, // irc (default) - 6668, // irc (alternate) - 6669, // irc (alternate) - ].forEach(blockedPort => { - async_test(t => { - const ws = CreateWebSocketWithBlockedPort(blockedPort) - ws.onerror = t.step_func_done() - ws.onopen = t.unreached_func() - }, "WebSocket blocked port test " + blockedPort) - }) +async_test(t => { + const ws = CreateWebSocketWithBlockedPort(__PORT) + ws.onerror = t.unreached_func() + ws.onopen = t.step_func_done() +}, 'Basic check'); +// list of bad ports according to +// https://fetch.spec.whatwg.org/#port-blocking +[ + 1, // tcpmux + 7, // echo + 9, // discard + 11, // systat + 13, // daytime + 15, // netstat + 17, // qotd + 19, // chargen + 20, // ftp-data + 21, // ftp + 22, // ssh + 23, // telnet + 25, // smtp + 37, // time + 42, // name + 43, // nicname + 53, // domain + 77, // priv-rjs + 79, // finger + 87, // ttylink + 95, // supdup + 101, // hostriame + 102, // iso-tsap + 103, // gppitnp + 104, // acr-nema + 109, // pop2 + 110, // pop3 + 111, // sunrpc + 113, // auth + 115, // sftp + 117, // uucp-path + 119, // nntp + 123, // ntp + 135, // loc-srv / epmap + 139, // netbios + 143, // imap2 + 179, // bgp + 389, // ldap + 465, // smtp+ssl + 512, // print / exec + 513, // login + 514, // shell + 515, // printer + 526, // tempo + 530, // courier + 531, // chat + 532, // netnews + 540, // uucp + 556, // remotefs + 563, // nntp+ssl + 587, // smtp + 601, // syslog-conn + 636, // ldap+ssl + 993, // imap+ssl + 995, // pop3+ssl + 2049, // nfs + 3659, // apple-sasl + 4045, // lockd + 6000, // x11 + 6665, // irc (alternate) + 6666, // irc (alternate) + 6667, // irc (default) + 6668, // irc (alternate) + 6669, // irc (alternate) +].forEach(blockedPort => { + async_test(t => { + const ws = CreateWebSocketWithBlockedPort(blockedPort) + ws.onerror = t.step_func_done() + ws.onopen = t.unreached_func() + }, "WebSocket blocked port test " + blockedPort) +}) diff --git a/testing/web-platform/tests/websockets/Create-invalid-urls.any.js b/testing/web-platform/tests/websockets/Create-invalid-urls.any.js index 029e45c3117d..5ae25a2cdc00 100644 --- a/testing/web-platform/tests/websockets/Create-invalid-urls.any.js +++ b/testing/web-platform/tests/websockets/Create-invalid-urls.any.js @@ -1,22 +1,32 @@ // META: script=websocket.sub.js - var wsocket; - test(function() { - assert_throws("SYNTAX_ERR", function () { wsocket = new WebSocket("/echo") }); - }, "Url is /echo - should throw SYNTAX_ERR"); +var wsocket; +test(function() { + assert_throws("SYNTAX_ERR", function() { + wsocket = new WebSocket("/echo") + }); +}, "Url is /echo - should throw SYNTAX_ERR"); - test(function () { - assert_throws("SYNTAX_ERR", function () { wsocket = new WebSocket("mailto:microsoft@microsoft.com") }); - }, "Url is a mail address - should throw SYNTAX_ERR"); +test(function() { + assert_throws("SYNTAX_ERR", function() { + wsocket = new WebSocket("mailto:microsoft@microsoft.com") + }); +}, "Url is a mail address - should throw SYNTAX_ERR"); - test(function () { - assert_throws("SYNTAX_ERR", function () { wsocket = new WebSocket("about:blank") }); - }, "Url is about:blank - should throw SYNTAX_ERR"); +test(function() { + assert_throws("SYNTAX_ERR", function() { + wsocket = new WebSocket("about:blank") + }); +}, "Url is about:blank - should throw SYNTAX_ERR"); - test(function () { - assert_throws("SYNTAX_ERR", function () { wsocket = new WebSocket("?test") }); - }, "Url is ?test - should throw SYNTAX_ERR"); +test(function() { + assert_throws("SYNTAX_ERR", function() { + wsocket = new WebSocket("?test") + }); +}, "Url is ?test - should throw SYNTAX_ERR"); - test(function () { - assert_throws("SYNTAX_ERR", function () { wsocket = new WebSocket("#test") }); - }, "Url is #test - should throw SYNTAX_ERR"); +test(function() { + assert_throws("SYNTAX_ERR", function() { + wsocket = new WebSocket("#test") + }); +}, "Url is #test - should throw SYNTAX_ERR"); diff --git a/testing/web-platform/tests/websockets/Create-non-absolute-url.any.js b/testing/web-platform/tests/websockets/Create-non-absolute-url.any.js index 3f7894770cc3..369557ec3f52 100644 --- a/testing/web-platform/tests/websockets/Create-non-absolute-url.any.js +++ b/testing/web-platform/tests/websockets/Create-non-absolute-url.any.js @@ -1,6 +1,8 @@ // META: script=websocket.sub.js - test(function () { - var wsocket; - assert_throws("SYNTAX_ERR", function () { wsocket = CreateWebSocketNonAbsolute() }); - }, "W3C WebSocket API - Create WebSocket - Pass a non absolute URL - SYNTAX_ERR is thrown") +test(function() { + var wsocket; + assert_throws("SYNTAX_ERR", function() { + wsocket = CreateWebSocketNonAbsolute() + }); +}, "W3C WebSocket API - Create WebSocket - Pass a non absolute URL - SYNTAX_ERR is thrown") diff --git a/testing/web-platform/tests/websockets/Create-nonAscii-protocol-string.any.js b/testing/web-platform/tests/websockets/Create-nonAscii-protocol-string.any.js index a4f8bb68b03f..39be9f458051 100644 --- a/testing/web-platform/tests/websockets/Create-nonAscii-protocol-string.any.js +++ b/testing/web-platform/tests/websockets/Create-nonAscii-protocol-string.any.js @@ -1,7 +1,9 @@ // META: script=websocket.sub.js - test(function () { - var nonAsciiProtocol = "\u0080echo"; - var wsocket; - assert_throws("SYNTAX_ERR", function () { wsocket = CreateWebSocketNonAsciiProtocol(nonAsciiProtocol) }); - }, "W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string with non-ascii values - SYNTAX_ERR is thrown") +test(function() { + var nonAsciiProtocol = "\u0080echo"; + var wsocket; + assert_throws("SYNTAX_ERR", function() { + wsocket = CreateWebSocketNonAsciiProtocol(nonAsciiProtocol) + }); +}, "W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string with non-ascii values - SYNTAX_ERR is thrown") diff --git a/testing/web-platform/tests/websockets/Create-on-worker-shutdown.any.js b/testing/web-platform/tests/websockets/Create-on-worker-shutdown.any.js index eb15f72ff343..76a60ec7066b 100644 --- a/testing/web-platform/tests/websockets/Create-on-worker-shutdown.any.js +++ b/testing/web-platform/tests/websockets/Create-on-worker-shutdown.any.js @@ -8,7 +8,7 @@ async_test(t => { var data = { originalState: ws.readyState, afterCloseState: null - }; + }; ws.close(); @@ -16,7 +16,9 @@ async_test(t => { postMessage(data); } - var workerBlob = new Blob([workerCode.toString() + ";workerCode();"], {type:"application/javascript"}); + var workerBlob = new Blob([workerCode.toString() + ";workerCode();"], { + type: "application/javascript" + }); var w = new Worker(URL.createObjectURL(workerBlob)); w.onmessage = function(e) { diff --git a/testing/web-platform/tests/websockets/Create-protocol-with-space.any.js b/testing/web-platform/tests/websockets/Create-protocol-with-space.any.js index 0f8c82e0ea45..b3c14d8e1717 100644 --- a/testing/web-platform/tests/websockets/Create-protocol-with-space.any.js +++ b/testing/web-platform/tests/websockets/Create-protocol-with-space.any.js @@ -1,6 +1,8 @@ // META: script=websocket.sub.js - test(function () { - var wsocket; - assert_throws("SYNTAX_ERR", function () { wsocket = CreateWebSocketWithSpaceInProtocol("ec ho") }); - }, "W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string with a space in it - SYNTAX_ERR is thrown") +test(function() { + var wsocket; + assert_throws("SYNTAX_ERR", function() { + wsocket = CreateWebSocketWithSpaceInProtocol("ec ho") + }); +}, "W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string with a space in it - SYNTAX_ERR is thrown") diff --git a/testing/web-platform/tests/websockets/Create-protocols-repeated-case-insensitive.any.js b/testing/web-platform/tests/websockets/Create-protocols-repeated-case-insensitive.any.js index 855e4f804ae4..16f99759d18a 100644 --- a/testing/web-platform/tests/websockets/Create-protocols-repeated-case-insensitive.any.js +++ b/testing/web-platform/tests/websockets/Create-protocols-repeated-case-insensitive.any.js @@ -1,6 +1,8 @@ // META: script=websocket.sub.js - test(function () { - var wsocket; - assert_throws("SYNTAX_ERR", function () { wsocket = CreateWebSocketWithRepeatedProtocolsCaseInsensitive() }); - }, "W3C WebSocket API - Create WebSocket - Pass a valid URL and an array of protocol strings with repeated values but different case - SYNTAX_ERR is thrown") +test(function() { + var wsocket; + assert_throws("SYNTAX_ERR", function() { + wsocket = CreateWebSocketWithRepeatedProtocolsCaseInsensitive() + }); +}, "W3C WebSocket API - Create WebSocket - Pass a valid URL and an array of protocol strings with repeated values but different case - SYNTAX_ERR is thrown") diff --git a/testing/web-platform/tests/websockets/Create-protocols-repeated.any.js b/testing/web-platform/tests/websockets/Create-protocols-repeated.any.js index ff30a9029a2f..624d45306a77 100644 --- a/testing/web-platform/tests/websockets/Create-protocols-repeated.any.js +++ b/testing/web-platform/tests/websockets/Create-protocols-repeated.any.js @@ -1,6 +1,8 @@ // META: script=websocket.sub.js - test(function () { - var wsocket; - assert_throws("SYNTAX_ERR", function () { wsocket = CreateWebSocketWithRepeatedProtocols() }); - }, "W3C WebSocket API - Create WebSocket - Pass a valid URL and an array of protocol strings with repeated values - SYNTAX_ERR is thrown") +test(function() { + var wsocket; + assert_throws("SYNTAX_ERR", function() { + wsocket = CreateWebSocketWithRepeatedProtocols() + }); +}, "W3C WebSocket API - Create WebSocket - Pass a valid URL and an array of protocol strings with repeated values - SYNTAX_ERR is thrown") diff --git a/testing/web-platform/tests/websockets/Create-valid-url-array-protocols.any.js b/testing/web-platform/tests/websockets/Create-valid-url-array-protocols.any.js index 28c6b4621ac3..dde0303aa0fe 100644 --- a/testing/web-platform/tests/websockets/Create-valid-url-array-protocols.any.js +++ b/testing/web-platform/tests/websockets/Create-valid-url-array-protocols.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL and array of protocol strings - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL and array of protocol strings - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed"); - var wsocket = CreateWebSocket(false, false, true); - var isOpenCalled = false; +var wsocket = CreateWebSocket(false, false, true); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Create-valid-url-protocol-empty.any.js b/testing/web-platform/tests/websockets/Create-valid-url-protocol-empty.any.js index 261ce8f75f6c..8682e4a40181 100644 --- a/testing/web-platform/tests/websockets/Create-valid-url-protocol-empty.any.js +++ b/testing/web-platform/tests/websockets/Create-valid-url-protocol-empty.any.js @@ -1,7 +1,7 @@ // META: script=websocket.sub.js - test(function () { - var wsocket = CreateWebSocket(false, true, false); - assert_equals(wsocket.protocol, "", "protocol should be empty"); - wsocket.close(); - }, "W3C WebSocket API - Create WebSocket - wsocket.protocol should be empty before connection is established") +test(function() { + var wsocket = CreateWebSocket(false, true, false); + assert_equals(wsocket.protocol, "", "protocol should be empty"); + wsocket.close(); +}, "W3C WebSocket API - Create WebSocket - wsocket.protocol should be empty before connection is established") diff --git a/testing/web-platform/tests/websockets/Create-valid-url-protocol.any.js b/testing/web-platform/tests/websockets/Create-valid-url-protocol.any.js index f7bb429e7409..85e870fda2fc 100644 --- a/testing/web-platform/tests/websockets/Create-valid-url-protocol.any.js +++ b/testing/web-platform/tests/websockets/Create-valid-url-protocol.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string - Connection should be closed"); - var wsocket = CreateWebSocket(false, true, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(false, true, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Create-valid-url.any.js b/testing/web-platform/tests/websockets/Create-valid-url.any.js index 0dfa148d241e..9a43dcc5fdd1 100644 --- a/testing/web-platform/tests/websockets/Create-valid-url.any.js +++ b/testing/web-platform/tests/websockets/Create-valid-url.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create WebSocket - Pass a valid URL - Connection should be closed"); - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Create-verify-url-set-non-default-port.any.js b/testing/web-platform/tests/websockets/Create-verify-url-set-non-default-port.any.js index f4000e5de7fa..5548fd134ca1 100644 --- a/testing/web-platform/tests/websockets/Create-verify-url-set-non-default-port.any.js +++ b/testing/web-platform/tests/websockets/Create-verify-url-set-non-default-port.any.js @@ -1,7 +1,7 @@ // META: script=websocket.sub.js - test(function () { - var urlNonDefaultPort = "ws://" + __SERVER__NAME + ":" + __NEW__PORT + "/" + __PATH; - var wsocket = new WebSocket(urlNonDefaultPort); - assert_equals(wsocket.url, urlNonDefaultPort, "wsocket.url is set correctly"); - }, "W3C WebSocket API - Create WebSocket - wsocket.url should be set correctly"); +test(function() { + var urlNonDefaultPort = "ws://" + __SERVER__NAME + ":" + __NEW__PORT + "/" + __PATH; + var wsocket = new WebSocket(urlNonDefaultPort); + assert_equals(wsocket.url, urlNonDefaultPort, "wsocket.url is set correctly"); +}, "W3C WebSocket API - Create WebSocket - wsocket.url should be set correctly"); diff --git a/testing/web-platform/tests/websockets/Create-wrong-scheme.any.js b/testing/web-platform/tests/websockets/Create-wrong-scheme.any.js index e8adba0b4055..506f81c17035 100644 --- a/testing/web-platform/tests/websockets/Create-wrong-scheme.any.js +++ b/testing/web-platform/tests/websockets/Create-wrong-scheme.any.js @@ -1,6 +1,8 @@ // META: script=websocket.sub.js - test(function () { - var wsocket; - assert_throws("SYNTAX_ERR", function () { wsocket = CreateWebSocketNonWsScheme() }); - }, "W3C WebSocket API - Create WebSocket - Pass a URL with a non ws/wss scheme - SYNTAX_ERR is thrown") +test(function() { + var wsocket; + assert_throws("SYNTAX_ERR", function() { + wsocket = CreateWebSocketNonWsScheme() + }); +}, "W3C WebSocket API - Create WebSocket - Pass a URL with a non ws/wss scheme - SYNTAX_ERR is thrown") diff --git a/testing/web-platform/tests/websockets/Secure-Close-1000-reason.any.js b/testing/web-platform/tests/websockets/Secure-Close-1000-reason.any.js index 9ec34bbe02a2..4d3f67cf45a8 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-1000-reason.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-1000-reason.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(1000, "Clean Close"); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(1000, "Clean Close"); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); - assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); + assert_equals(evt.wasClean, true, "wasClean should be TRUE"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-1000-verify-code.any.js b/testing/web-platform/tests/websockets/Secure-Close-1000-verify-code.any.js index e95e3c59b56a..87ba4079ccfe 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-1000-verify-code.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-1000-verify-code.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - event.code == 1000 and event.reason = 'Clean Close'"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - event.code == 1000 and event.reason = 'Clean Close'"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(1000, "Clean Close"); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(1000, "Clean Close"); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.code, 1000, "CloseEvent.code should be 1000"); - assert_equals(evt.reason, "Clean Close", "CloseEvent.reason should be the same as the reason sent in close"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.code, 1000, "CloseEvent.code should be 1000"); + assert_equals(evt.reason, "Clean Close", "CloseEvent.reason should be the same as the reason sent in close"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-1000.any.js b/testing/web-platform/tests/websockets/Secure-Close-1000.any.js index 6b13bd381b50..67f4e054a3de 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-1000.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-1000.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000) - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000) - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(1000); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(1000); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); - assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); + assert_equals(evt.wasClean, true, "wasClean should be TRUE"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-1005-verify-code.any.js b/testing/web-platform/tests/websockets/Secure-Close-1005-verify-code.any.js index c6712a16b4bb..a7c72eaf5157 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-1005-verify-code.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-1005-verify-code.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close() - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close() - return close code is 1005 - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close() - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close() - return close code is 1005 - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.code, 1005, "CloseEvent.code should be 1005"); - assert_equals(evt.reason, "", "CloseEvent.reason should be empty"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.code, 1005, "CloseEvent.code should be 1005"); + assert_equals(evt.reason, "", "CloseEvent.reason should be empty"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-1005.any.js b/testing/web-platform/tests/websockets/Secure-Close-1005.any.js index c01b16ed292b..ddb2c185854f 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-1005.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-1005.any.js @@ -1,11 +1,13 @@ // META: script=websocket.sub.js - var test = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1005) - see '7.1.5. The WebSocket Connection Close Code' in http://www.ietf.org/rfc/rfc6455.txt"); +var test = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1005) - see '7.1.5. The WebSocket Connection Close Code' in http://www.ietf.org/rfc/rfc6455.txt"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', test.step_func(function (evt) { - assert_throws("INVALID_ACCESS_ERR", function () { wsocket.close(1005, "1005 - reserved code") }); - test.done(); - }), true); +wsocket.addEventListener('open', test.step_func(function(evt) { + assert_throws("INVALID_ACCESS_ERR", function() { + wsocket.close(1005, "1005 - reserved code") + }); + test.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-2999-reason.any.js b/testing/web-platform/tests/websockets/Secure-Close-2999-reason.any.js index 61ba4138390f..0fa198eb39e0 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-2999-reason.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-2999-reason.any.js @@ -1,10 +1,12 @@ // META: script=websocket.sub.js - var test = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(2999, reason) - INVALID_ACCESS_ERR is thrown"); +var test = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(2999, reason) - INVALID_ACCESS_ERR is thrown"); - var wsocket = CreateWebSocket(true, false, false); +var wsocket = CreateWebSocket(true, false, false); - wsocket.addEventListener('open', test.step_func(function (evt) { - assert_throws("INVALID_ACCESS_ERR", function () { wsocket.close(2999, "Close not in range 3000-4999") }); - test.done(); - }), true); +wsocket.addEventListener('open', test.step_func(function(evt) { + assert_throws("INVALID_ACCESS_ERR", function() { + wsocket.close(2999, "Close not in range 3000-4999") + }); + test.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-3000-reason.any.js b/testing/web-platform/tests/websockets/Secure-Close-3000-reason.any.js index fe25d5997f1c..6640ddc17d47 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-3000-reason.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-3000-reason.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(3000, "Clean Close with code - 3000"); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(3000, "Clean Close with code - 3000"); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); - assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); + assert_equals(evt.wasClean, true, "wasClean should be TRUE"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-3000-verify-code.any.js b/testing/web-platform/tests/websockets/Secure-Close-3000-verify-code.any.js index 92d14132c588..5b122d4c33f4 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-3000-verify-code.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-3000-verify-code.any.js @@ -1,19 +1,19 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - verify return code is 3000 - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - verify return code is 3000 - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(3000, "Clean Close"); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(3000, "Clean Close"); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.code, 3000, "CloseEvent.code should be 3000"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.code, 3000, "CloseEvent.code should be 3000"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-4999-reason.any.js b/testing/web-platform/tests/websockets/Secure-Close-4999-reason.any.js index cba254c06ba7..d57899eb3eed 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-4999-reason.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-4999-reason.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(4999, reason) - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(4999, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(4999, reason) - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(4999, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(3000, "Clean Close with code - 4999"); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(3000, "Clean Close with code - 4999"); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); - assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); + assert_equals(evt.wasClean, true, "wasClean should be TRUE"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-Reason-124Bytes.any.js b/testing/web-platform/tests/websockets/Secure-Close-Reason-124Bytes.any.js index ecb8c5b82c18..826cb6eccf76 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-Reason-124Bytes.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-Reason-124Bytes.any.js @@ -1,13 +1,15 @@ // META: script=websocket.sub.js - var test = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(code, 'reason more than 123 bytes') - SYNTAX_ERR is thrown"); +var test = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(code, 'reason more than 123 bytes') - SYNTAX_ERR is thrown"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', test.step_func(function (evt) { - var reason = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"; - assert_equals(reason.length, 124); - assert_throws("SYNTAX_ERR", function () { wsocket.close(1000, reason) }); - test.done(); - }), true); +wsocket.addEventListener('open', test.step_func(function(evt) { + var reason = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"; + assert_equals(reason.length, 124); + assert_throws("SYNTAX_ERR", function() { + wsocket.close(1000, reason) + }); + test.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-Reason-Unpaired-surrogates.any.js b/testing/web-platform/tests/websockets/Secure-Close-Reason-Unpaired-surrogates.any.js index f7fc8b441a55..fdc62c465d34 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-Reason-Unpaired-surrogates.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-Reason-Unpaired-surrogates.any.js @@ -1,21 +1,21 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; - var replacementChar = "\uFFFD"; - var reason = "\uD807"; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; +var replacementChar = "\uFFFD"; +var reason = "\uD807"; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(1000, reason); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(1000, reason); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be opened"); - assert_equals(evt.reason, replacementChar, "reason replaced with replacement character"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be opened"); + assert_equals(evt.reason, replacementChar, "reason replaced with replacement character"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-onlyReason.any.js b/testing/web-platform/tests/websockets/Secure-Close-onlyReason.any.js index 77604ed9f9e2..79f79b5d8339 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-onlyReason.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-onlyReason.any.js @@ -1,10 +1,12 @@ // META: script=websocket.sub.js - var test = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(only reason) - INVALID_ACCESS_ERR is thrown"); +var test = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(only reason) - INVALID_ACCESS_ERR is thrown"); - var wsocket = CreateWebSocket(true, false, false); +var wsocket = CreateWebSocket(true, false, false); - wsocket.addEventListener('open', test.step_func(function (evt) { - assert_throws("INVALID_ACCESS_ERR", function () { wsocket.close("Close with only reason") }); - test.done(); - }), true); +wsocket.addEventListener('open', test.step_func(function(evt) { + assert_throws("INVALID_ACCESS_ERR", function() { + wsocket.close("Close with only reason") + }); + test.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-readyState-Closed.any.js b/testing/web-platform/tests/websockets/Secure-Close-readyState-Closed.any.js index 98018e6f434a..3279744848c0 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-readyState-Closed.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-readyState-Closed.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.close(); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.close(); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); - assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); + assert_equals(evt.wasClean, true, "wasClean should be TRUE"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-readyState-Closing.any.js b/testing/web-platform/tests/websockets/Secure-Close-readyState-Closing.any.js index f43adfc5dc1d..b18347447a56 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-readyState-Closing.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-readyState-Closing.any.js @@ -1,12 +1,12 @@ // META: script=websocket.sub.js - var test = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - readyState should be in CLOSING state just before onclose is called"); +var test = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - readyState should be in CLOSING state just before onclose is called"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', test.step_func(function (evt) { - wsocket.close(); - assert_equals(wsocket.readyState, 2, "readyState should be 2(CLOSING)"); - test.done(); - }), true); +wsocket.addEventListener('open', test.step_func(function(evt) { + wsocket.close(); + assert_equals(wsocket.readyState, 2, "readyState should be 2(CLOSING)"); + test.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-server-initiated-close.any.js b/testing/web-platform/tests/websockets/Secure-Close-server-initiated-close.any.js index 240b2b65b908..8531b3140b1d 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-server-initiated-close.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-server-initiated-close.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Server initiated Close - Client sends back a CLOSE - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Server initiated Close - Client sends back a CLOSE - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Server initiated Close - Client sends back a CLOSE - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Server initiated Close - Client sends back a CLOSE - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send("Goodbye"); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send("Goodbye"); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); - assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); + assert_equals(evt.wasClean, true, "wasClean should be TRUE"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Close-undefined.any.js b/testing/web-platform/tests/websockets/Secure-Close-undefined.any.js index dc356aba7446..31b36e4d955d 100644 --- a/testing/web-platform/tests/websockets/Secure-Close-undefined.any.js +++ b/testing/web-platform/tests/websockets/Secure-Close-undefined.any.js @@ -1,11 +1,11 @@ // META: script=websocket.sub.js - var test = async_test(); +var test = async_test(); - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', test.step_func(function (evt) { - wsocket.close(undefined); - test.done(); - }), true); +wsocket.addEventListener('open', test.step_func(function(evt) { + wsocket.close(undefined); + test.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-65K-data.any.js b/testing/web-platform/tests/websockets/Secure-Send-65K-data.any.js index b2cdd33877f9..daa937af579a 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-65K-data.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-65K-data.any.js @@ -1,31 +1,31 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send 65K data on a Secure WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send 65K data on a Secure WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send 65K data on a Secure WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send 65K data on a Secure WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send 65K data on a Secure WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send 65K data on a Secure WebSocket - Connection should be closed"); - var data = ""; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = ""; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - for (var i = 0; i < 65000; i++) { - data = data + "c"; - } - wsocket.send(data); - assert_equals(data.length, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + for (var i = 0; i < 65000; i++) { + data = data + "c"; + } + wsocket.send(data); + assert_equals(data.length, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, data); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, data); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-binary-65K-arraybuffer.any.js b/testing/web-platform/tests/websockets/Secure-Send-binary-65K-arraybuffer.any.js index 92bc2cdbf66a..17859e5630d8 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-binary-65K-arraybuffer.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-binary-65K-arraybuffer.any.js @@ -1,31 +1,31 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Connection should be closed"); - var data = ""; - var datasize = 65000; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 65000; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - wsocket.send(data); - assert_equals(datasize, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + wsocket.send(data); + assert_equals(datasize, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data.byteLength, datasize); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data.byteLength, datasize); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybuffer.any.js b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybuffer.any.js index b1a5ca80106e..6e4c08d69010 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybuffer.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybuffer.any.js @@ -1,31 +1,31 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Connection should be closed"); - var data = ""; - var datasize = 15; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 15; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - wsocket.send(data); - assert_equals(datasize, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + wsocket.send(data); + assert_equals(datasize, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data.byteLength, datasize); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data.byteLength, datasize); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-float32.any.js b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-float32.any.js index c744e56214ed..9825d34d5c05 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-float32.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-float32.any.js @@ -1,38 +1,38 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float32Array - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float32Array - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float32Array - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float32Array - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float32Array - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float32Array - Connection should be closed"); - var data = ""; - var datasize = 8; - var view; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 8; +var view; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - view = new Float32Array(data); - for(var i = 0; i < 2; i++) { - view[i] = i; - } - wsocket.send(view); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + view = new Float32Array(data); + for (var i = 0; i < 2; i++) { + view[i] = i; + } + wsocket.send(view); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - var resultView = new Float32Array(evt.data); - for(var i = 0; i < resultView.length; i++) { - assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); - } - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + var resultView = new Float32Array(evt.data); + for (var i = 0; i < resultView.length; i++) { + assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); + } + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-float64.any.js b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-float64.any.js index 9d9037335b22..4dcac40e37e2 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-float64.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-float64.any.js @@ -1,38 +1,38 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be closed"); - var data = ""; - var datasize = 8; - var view; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 8; +var view; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - view = new Float64Array(data); - for (var i = 0; i < 1; i++) { - view[i] = i; - } - wsocket.send(view); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + view = new Float64Array(data); + for (var i = 0; i < 1; i++) { + view[i] = i; + } + wsocket.send(view); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - var resultView = new Float64Array(evt.data); - for(var i = 0; i < resultView.length; i++) { - assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); - } - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + var resultView = new Float64Array(evt.data); + for (var i = 0; i < resultView.length; i++) { + assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); + } + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-int32.any.js b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-int32.any.js index 116209cc1fb6..655af21575bf 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-int32.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-int32.any.js @@ -1,38 +1,38 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be closed"); - var data = ""; - var datasize = 8; - var view; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 8; +var view; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - view = new Int32Array(data); - for(var i = 0; i < 2; i++) { - view[i] = i; - } - wsocket.send(view); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + view = new Int32Array(data); + for (var i = 0; i < 2; i++) { + view[i] = i; + } + wsocket.send(view); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - var resultView = new Int32Array(evt.data); - for(var i = 0; i < resultView.length; i++) { - assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); - } - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + var resultView = new Int32Array(evt.data); + for (var i = 0; i < resultView.length; i++) { + assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); + } + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint16-offset-length.any.js b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint16-offset-length.any.js index 64297301c885..16f050f3a649 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint16-offset-length.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint16-offset-length.any.js @@ -1,38 +1,38 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be closed"); - var data = ""; - var datasize = 8; - var view; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 8; +var view; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - view = new Uint16Array(data, 2, 2); - for(var i = 0; i < 4; i++) { - view[i] = i; - } - wsocket.send(view); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + view = new Uint16Array(data, 2, 2); + for (var i = 0; i < 4; i++) { + view[i] = i; + } + wsocket.send(view); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - var resultView = new Uint16Array(evt.data); - for(var i = 0; i < resultView.length; i++) { - assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); - } - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + var resultView = new Uint16Array(evt.data); + for (var i = 0; i < resultView.length; i++) { + assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); + } + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint32-offset.any.js b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint32-offset.any.js index 5f988c03a1cf..8976b3dc6141 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint32-offset.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint32-offset.any.js @@ -1,38 +1,38 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be closed"); - var data = ""; - var datasize = 8; - var view; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 8; +var view; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - view = new Uint32Array(data, 0); - for(var i = 0; i < 2; i++) { - view[i] = i; - } - wsocket.send(view); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + view = new Uint32Array(data, 0); + for (var i = 0; i < 2; i++) { + view[i] = i; + } + wsocket.send(view); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - var resultView = new Uint32Array(evt.data); - for(var i = 0; i < resultView.length; i++) { - assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); - } - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + var resultView = new Uint32Array(evt.data); + for (var i = 0; i < resultView.length; i++) { + assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); + } + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint8-offset-length.any.js b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint8-offset-length.any.js index 59d292b38b6a..9e9d1b5a825e 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint8-offset-length.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint8-offset-length.any.js @@ -1,38 +1,38 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Connection should be closed"); - var data = ""; - var datasize = 8; - var view; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 8; +var view; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - view = new Uint8Array(data, 2, 4); - for(var i = 0; i < 8; i++) { - view[i] = i; - } - wsocket.send(view); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + view = new Uint8Array(data, 2, 4); + for (var i = 0; i < 8; i++) { + view[i] = i; + } + wsocket.send(view); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - var resultView = new Uint8Array(evt.data); - for(var i = 0; i < resultView.length; i++) { - assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); - } - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + var resultView = new Uint8Array(evt.data); + for (var i = 0; i < resultView.length; i++) { + assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); + } + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint8-offset.any.js b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint8-offset.any.js index 65e6d3ca7674..f563cec9184a 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint8-offset.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-binary-arraybufferview-uint8-offset.any.js @@ -1,38 +1,38 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Connection should be closed"); - var data = ""; - var datasize = 8; - var view; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 8; +var view; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - view = new Uint8Array(data, 2); - for(var i = 0; i < 8; i++) { - view[i] = i; - } - wsocket.send(view); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + view = new Uint8Array(data, 2); + for (var i = 0; i < 8; i++) { + view[i] = i; + } + wsocket.send(view); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - var resultView = new Uint8Array(evt.data); - for(var i = 0; i < resultView.length; i++) { - assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); - } - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + var resultView = new Uint8Array(evt.data); + for (var i = 0; i < resultView.length; i++) { + assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); + } + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-binary-blob.any.js b/testing/web-platform/tests/websockets/Secure-Send-binary-blob.any.js index f32294ff7cd7..8bf0f12ed826 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-binary-blob.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-binary-blob.any.js @@ -1,34 +1,34 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Connection should be closed"); - var data = ""; - var datasize = 65000; - var isOpenCalled = false; +var data = ""; +var datasize = 65000; +var isOpenCalled = false; - var wsocket = CreateWebSocket(true, false, false); +var wsocket = CreateWebSocket(true, false, false); - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "blob"; - for (var i = 0; i < datasize; i++) - data += String.fromCharCode(0); - data = new Blob([data]); - isOpenCalled = true; - wsocket.send(data); - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "blob"; + for (var i = 0; i < datasize; i++) + data += String.fromCharCode(0); + data = new Blob([data]); + isOpenCalled = true; + wsocket.send(data); + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_true(evt.data instanceof Blob); - assert_equals(evt.data.size, datasize); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_true(evt.data instanceof Blob); + assert_equals(evt.data.size, datasize); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_true(evt.wasClean, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(evt.wasClean, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-data.any.js b/testing/web-platform/tests/websockets/Secure-Send-data.any.js index afd4f198494a..04c720de792d 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-data.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-data.any.js @@ -1,28 +1,28 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send data on a Secure WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send data on a Secure WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send data on a Secure WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send data on a Secure WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send data on a Secure WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send data on a Secure WebSocket - Connection should be closed"); - var data = "Message to send"; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = "Message to send"; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - assert_equals(data.length, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + assert_equals(data.length, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, data); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, data); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-null.any.js b/testing/web-platform/tests/websockets/Secure-Send-null.any.js index b10b3d95ef8b..7c374c25c24e 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-null.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-null.any.js @@ -1,30 +1,30 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send null data on a Secure WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send null data on a Secure WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send null data on a Secure WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send null data on a Secure WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send null data on a Secure WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send null data on a Secure WebSocket - Connection should be closed"); - var data = null; - var nullReturned = false; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = null; +var nullReturned = false; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - if ("null" == evt.data || "" == evt.data) - nullReturned = true; - assert_true(nullReturned); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + if ("null" == evt.data || "" == evt.data) + nullReturned = true; + assert_true(nullReturned); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-paired-surrogates.any.js b/testing/web-platform/tests/websockets/Secure-Send-paired-surrogates.any.js index 473685a3627e..073f06472982 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-paired-surrogates.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-paired-surrogates.any.js @@ -1,28 +1,28 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Connection should be closed"); - var data = "\uD801\uDC07"; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = "\uD801\uDC07"; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - assert_equals(data.length * 2, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + assert_equals(data.length * 2, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, data); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, data); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-unicode-data.any.js b/testing/web-platform/tests/websockets/Secure-Send-unicode-data.any.js index da28ebb66e53..a3518c12f7aa 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-unicode-data.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-unicode-data.any.js @@ -1,28 +1,28 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send unicode data on a Secure WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send unicode data on a Secure WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send unicode data on a Secure WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send unicode data on a Secure WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send unicode data on a Secure WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send unicode data on a Secure WebSocket - Connection should be closed"); - var data = "¥¥¥¥¥¥"; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = "¥¥¥¥¥¥"; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - assert_equals(data.length * 2, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + assert_equals(data.length * 2, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, data); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, data); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Secure-Send-unpaired-surrogates.any.js b/testing/web-platform/tests/websockets/Secure-Send-unpaired-surrogates.any.js index 618fb98e514c..83f3e7bebc20 100644 --- a/testing/web-platform/tests/websockets/Secure-Send-unpaired-surrogates.any.js +++ b/testing/web-platform/tests/websockets/Secure-Send-unpaired-surrogates.any.js @@ -1,28 +1,28 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Connection should be closed"); - var data = "\uD807"; - var replacementChar = "\uFFFD"; - var wsocket = CreateWebSocket(true, false, false); - var isOpenCalled = false; +var data = "\uD807"; +var replacementChar = "\uFFFD"; +var wsocket = CreateWebSocket(true, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, replacementChar); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, replacementChar); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-0byte-data.any.js b/testing/web-platform/tests/websockets/Send-0byte-data.any.js index 929490217635..131a19d77dd0 100644 --- a/testing/web-platform/tests/websockets/Send-0byte-data.any.js +++ b/testing/web-platform/tests/websockets/Send-0byte-data.any.js @@ -1,28 +1,28 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send 0 byte data on a WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send 0 byte data on a WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send 0 byte data on a WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send 0 byte data on a WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send 0 byte data on a WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send 0 byte data on a WebSocket - Connection should be closed"); - var data = ""; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = ""; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - assert_equals(data.length, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + assert_equals(data.length, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, data); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, data); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-65K-data.any.js b/testing/web-platform/tests/websockets/Send-65K-data.any.js index e042e969814f..172e6eed5ac7 100644 --- a/testing/web-platform/tests/websockets/Send-65K-data.any.js +++ b/testing/web-platform/tests/websockets/Send-65K-data.any.js @@ -1,31 +1,31 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send 65K data on a WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send 65K data on a WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send 65K data on a WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send 65K data on a WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send 65K data on a WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send 65K data on a WebSocket - Connection should be closed"); - var data = ""; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = ""; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - for (var i = 0; i < 65000; i++) { - data = data + "c"; - } - wsocket.send(data); - assert_equals(data.length, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + for (var i = 0; i < 65000; i++) { + data = data + "c"; + } + wsocket.send(data); + assert_equals(data.length, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, data); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, data); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-Unpaired-Surrogates.any.js b/testing/web-platform/tests/websockets/Send-Unpaired-Surrogates.any.js index fc23693ae781..65bb2b16ce84 100644 --- a/testing/web-platform/tests/websockets/Send-Unpaired-Surrogates.any.js +++ b/testing/web-platform/tests/websockets/Send-Unpaired-Surrogates.any.js @@ -1,28 +1,28 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send unpaired surrogates on a WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send unpaired surrogates on a WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send unpaired surrogates on a WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send unpaired surrogates on a WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send unpaired surrogates on a WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send unpaired surrogates on a WebSocket - Connection should be closed"); - var data = "\uD807"; - var replacementChar = "\uFFFD"; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = "\uD807"; +var replacementChar = "\uFFFD"; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, replacementChar); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, replacementChar); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-before-open.any.js b/testing/web-platform/tests/websockets/Send-before-open.any.js index 14c03e942c81..101a1a2ff601 100644 --- a/testing/web-platform/tests/websockets/Send-before-open.any.js +++ b/testing/web-platform/tests/websockets/Send-before-open.any.js @@ -1,6 +1,8 @@ // META: script=websocket.sub.js - test(function () { - var wsocket = CreateWebSocket(false, false, false); - assert_throws("INVALID_STATE_ERR", function () { wsocket.send("Message to send") }); - }, "W3C WebSocket API - Send data on a WebSocket before connection is opened - INVALID_STATE_ERR is returned") +test(function() { + var wsocket = CreateWebSocket(false, false, false); + assert_throws("INVALID_STATE_ERR", function() { + wsocket.send("Message to send") + }); +}, "W3C WebSocket API - Send data on a WebSocket before connection is opened - INVALID_STATE_ERR is returned") diff --git a/testing/web-platform/tests/websockets/Send-binary-65K-arraybuffer.any.js b/testing/web-platform/tests/websockets/Send-binary-65K-arraybuffer.any.js index fcea1851ef40..f446a2579b82 100644 --- a/testing/web-platform/tests/websockets/Send-binary-65K-arraybuffer.any.js +++ b/testing/web-platform/tests/websockets/Send-binary-65K-arraybuffer.any.js @@ -1,31 +1,31 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send 65K binary data on a WebSocket - ArrayBuffer - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send 65K binary data on a WebSocket - ArrayBuffer - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send 65K binary data on a WebSocket - ArrayBuffer - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send 65K binary data on a WebSocket - ArrayBuffer - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send 65K binary data on a WebSocket - ArrayBuffer - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send 65K binary data on a WebSocket - ArrayBuffer - Connection should be closed"); - var data = ""; - var datasize = 65000; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 65000; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - wsocket.send(data); - assert_equals(datasize, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + wsocket.send(data); + assert_equals(datasize, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data.byteLength, datasize); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data.byteLength, datasize); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-binary-arraybuffer.any.js b/testing/web-platform/tests/websockets/Send-binary-arraybuffer.any.js index 543bc090184d..620514351f3c 100644 --- a/testing/web-platform/tests/websockets/Send-binary-arraybuffer.any.js +++ b/testing/web-platform/tests/websockets/Send-binary-arraybuffer.any.js @@ -1,31 +1,31 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBuffer - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBuffer - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBuffer - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBuffer - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBuffer - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBuffer - Connection should be closed"); - var data = ""; - var datasize = 15; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 15; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - wsocket.send(data); - assert_equals(datasize, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + wsocket.send(data); + assert_equals(datasize, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data.byteLength, datasize); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data.byteLength, datasize); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-binary-arraybufferview-int16-offset.any.js b/testing/web-platform/tests/websockets/Send-binary-arraybufferview-int16-offset.any.js index 07c0ff2bf09d..7022668e637b 100644 --- a/testing/web-platform/tests/websockets/Send-binary-arraybufferview-int16-offset.any.js +++ b/testing/web-platform/tests/websockets/Send-binary-arraybufferview-int16-offset.any.js @@ -1,38 +1,38 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Connection should be closed"); - var data = ""; - var datasize = 8; - var view; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 8; +var view; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - view = new Int16Array(data, 2); - for(var i = 0; i < 4; i++) { - view[i] = i; - } - wsocket.send(view); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + view = new Int16Array(data, 2); + for (var i = 0; i < 4; i++) { + view[i] = i; + } + wsocket.send(view); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - var resultView = new Int16Array(evt.data); - for(var i = 0; i < resultView.length; i++) { - assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); - } - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + var resultView = new Int16Array(evt.data); + for (var i = 0; i < resultView.length; i++) { + assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); + } + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-binary-arraybufferview-int8.any.js b/testing/web-platform/tests/websockets/Send-binary-arraybufferview-int8.any.js index 1bad2c6e4eea..242c8c6ece8f 100644 --- a/testing/web-platform/tests/websockets/Send-binary-arraybufferview-int8.any.js +++ b/testing/web-platform/tests/websockets/Send-binary-arraybufferview-int8.any.js @@ -1,38 +1,38 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int8Array - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int8Array - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int8Array - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int8Array - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int8Array - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int8Array - Connection should be closed"); - var data = ""; - var datasize = 8; - var int8View; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = ""; +var datasize = 8; +var int8View; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "arraybuffer"; - data = new ArrayBuffer(datasize); - int8View = new Int8Array(data); - for (var i = 0; i < 8; i++) { - int8View[i] = i; - } - wsocket.send(int8View); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "arraybuffer"; + data = new ArrayBuffer(datasize); + int8View = new Int8Array(data); + for (var i = 0; i < 8; i++) { + int8View[i] = i; + } + wsocket.send(int8View); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - var resultView = new Int8Array(evt.data); - for (var i = 0; i < resultView.length; i++) { - assert_equals(resultView[i], int8View[i], "ArrayBufferView returned is the same"); - } - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + var resultView = new Int8Array(evt.data); + for (var i = 0; i < resultView.length; i++) { + assert_equals(resultView[i], int8View[i], "ArrayBufferView returned is the same"); + } + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-binary-blob.any.js b/testing/web-platform/tests/websockets/Send-binary-blob.any.js index a5f39ee2e4f7..ee6486ea129e 100644 --- a/testing/web-platform/tests/websockets/Send-binary-blob.any.js +++ b/testing/web-platform/tests/websockets/Send-binary-blob.any.js @@ -1,34 +1,34 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - Blob - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - Blob - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - Blob - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send binary data on a WebSocket - Blob - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send binary data on a WebSocket - Blob - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send binary data on a WebSocket - Blob - Connection should be closed"); - var data = ""; - var datasize = 65000; - var isOpenCalled = false; +var data = ""; +var datasize = 65000; +var isOpenCalled = false; - var wsocket = CreateWebSocket(false, false, false); +var wsocket = CreateWebSocket(false, false, false); - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.binaryType = "blob"; - for (var i = 0; i < datasize; i++) - data += String.fromCharCode(0); - data = new Blob([data]); - isOpenCalled = true; - wsocket.send(data); - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.binaryType = "blob"; + for (var i = 0; i < datasize; i++) + data += String.fromCharCode(0); + data = new Blob([data]); + isOpenCalled = true; + wsocket.send(data); + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_true(evt.data instanceof Blob); - assert_equals(evt.data.size, datasize); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_true(evt.data instanceof Blob); + assert_equals(evt.data.size, datasize); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_true(evt.wasClean, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(evt.wasClean, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-data.any.js b/testing/web-platform/tests/websockets/Send-data.any.js index 53f4bd856af4..487393b582ed 100644 --- a/testing/web-platform/tests/websockets/Send-data.any.js +++ b/testing/web-platform/tests/websockets/Send-data.any.js @@ -1,28 +1,28 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send data on a WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send data on a WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send data on a WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send data on a WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send data on a WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send data on a WebSocket - Connection should be closed"); - var data = "Message to send"; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = "Message to send"; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - assert_equals(data.length, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + assert_equals(data.length, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, data); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, data); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-null.any.js b/testing/web-platform/tests/websockets/Send-null.any.js index 25b5307c4aca..8d8d6b76133e 100644 --- a/testing/web-platform/tests/websockets/Send-null.any.js +++ b/testing/web-platform/tests/websockets/Send-null.any.js @@ -1,30 +1,30 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send null data on a WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send null data on a WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send null data on a WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send null data on a WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send null data on a WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send null data on a WebSocket - Connection should be closed"); - var data = null; - var nullReturned = false; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = null; +var nullReturned = false; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - if ("null" == evt.data || "" == evt.data) - nullReturned = true; - assert_true(nullReturned); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + if ("null" == evt.data || "" == evt.data) + nullReturned = true; + assert_true(nullReturned); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-paired-surrogates.any.js b/testing/web-platform/tests/websockets/Send-paired-surrogates.any.js index 94889ce30e84..f12b0016eb0a 100644 --- a/testing/web-platform/tests/websockets/Send-paired-surrogates.any.js +++ b/testing/web-platform/tests/websockets/Send-paired-surrogates.any.js @@ -1,28 +1,28 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send (paired surrogates) data on a WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send (paired surrogates) data on a WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send (paired surrogates) data on a WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send (paired surrogates) data on a WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send (paired surrogates) data on a WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send (paired surrogates) data on a WebSocket - Connection should be closed"); - var data = "\uD801\uDC07"; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = "\uD801\uDC07"; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - assert_equals(data.length * 2, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + assert_equals(data.length * 2, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, data); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, data); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/Send-unicode-data.any.js b/testing/web-platform/tests/websockets/Send-unicode-data.any.js index 9265ac889191..ce2b9a0e2405 100644 --- a/testing/web-platform/tests/websockets/Send-unicode-data.any.js +++ b/testing/web-platform/tests/websockets/Send-unicode-data.any.js @@ -1,28 +1,28 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Send unicode data on a WebSocket - Connection should be opened"); - var testMessage = async_test("W3C WebSocket API - Send unicode data on a WebSocket - Message should be received"); - var testClose = async_test("W3C WebSocket API - Send unicode data on a WebSocket - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Send unicode data on a WebSocket - Connection should be opened"); +var testMessage = async_test("W3C WebSocket API - Send unicode data on a WebSocket - Message should be received"); +var testClose = async_test("W3C WebSocket API - Send unicode data on a WebSocket - Connection should be closed"); - var data = "¥¥¥¥¥¥"; - var wsocket = CreateWebSocket(false, false, false); - var isOpenCalled = false; +var data = "¥¥¥¥¥¥"; +var wsocket = CreateWebSocket(false, false, false); +var isOpenCalled = false; - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - wsocket.send(data); - assert_equals(data.length * 2, wsocket.bufferedAmount); - isOpenCalled = true; - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + wsocket.send(data); + assert_equals(data.length * 2, wsocket.bufferedAmount); + isOpenCalled = true; + testOpen.done(); +}), true); - wsocket.addEventListener('message', testMessage.step_func(function (evt) { - assert_equals(evt.data, data); - wsocket.close(); - testMessage.done(); - }), true); +wsocket.addEventListener('message', testMessage.step_func(function(evt) { + assert_equals(evt.data, data); + wsocket.close(); + testMessage.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(isOpenCalled, "WebSocket connection should be open"); - assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_equals(evt.wasClean, true, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/binaryType-wrong-value.any.js b/testing/web-platform/tests/websockets/binaryType-wrong-value.any.js index 22e6d0449869..6030608c2017 100644 --- a/testing/web-platform/tests/websockets/binaryType-wrong-value.any.js +++ b/testing/web-platform/tests/websockets/binaryType-wrong-value.any.js @@ -1,19 +1,19 @@ // META: script=websocket.sub.js - var testOpen = async_test("W3C WebSocket API - Create WebSocket - set binaryType to something other than blob or arraybuffer - SYNTAX_ERR is returned - Connection should be opened"); - var testClose = async_test("W3C WebSocket API - Create WebSocket - set binaryType to something other than blob or arraybuffer - SYNTAX_ERR is returned - Connection should be closed"); +var testOpen = async_test("W3C WebSocket API - Create WebSocket - set binaryType to something other than blob or arraybuffer - SYNTAX_ERR is returned - Connection should be opened"); +var testClose = async_test("W3C WebSocket API - Create WebSocket - set binaryType to something other than blob or arraybuffer - SYNTAX_ERR is returned - Connection should be closed"); - var wsocket = CreateWebSocket(true, false, false); +var wsocket = CreateWebSocket(true, false, false); - wsocket.addEventListener('open', testOpen.step_func(function (evt) { - assert_equals(wsocket.binaryType, "blob"); - wsocket.binaryType = "notBlobOrArrayBuffer"; - assert_equals(wsocket.binaryType, "blob"); - wsocket.close(); - testOpen.done(); - }), true); +wsocket.addEventListener('open', testOpen.step_func(function(evt) { + assert_equals(wsocket.binaryType, "blob"); + wsocket.binaryType = "notBlobOrArrayBuffer"; + assert_equals(wsocket.binaryType, "blob"); + wsocket.close(); + testOpen.done(); +}), true); - wsocket.addEventListener('close', testClose.step_func(function (evt) { - assert_true(evt.wasClean, "wasClean should be true"); - testClose.done(); - }), true); +wsocket.addEventListener('close', testClose.step_func(function(evt) { + assert_true(evt.wasClean, "wasClean should be true"); + testClose.done(); +}), true); diff --git a/testing/web-platform/tests/websockets/close-invalid.any.js b/testing/web-platform/tests/websockets/close-invalid.any.js index a930495ab2c0..8ac1da3f5de5 100644 --- a/testing/web-platform/tests/websockets/close-invalid.any.js +++ b/testing/web-platform/tests/websockets/close-invalid.any.js @@ -1,20 +1,20 @@ // META: script=websocket.sub.js [ - [0, "0"], - [500, "500"], - [NaN, "NaN"], - ["string", "String"], - [null, "null"], - [0x10000 + 1000, "2**16+1000"], + [0, "0"], + [500, "500"], + [NaN, "NaN"], + ["string", "String"], + [null, "null"], + [0x10000 + 1000, "2**16+1000"], ].forEach(function(t) { - [true, false].forEach(function(secure) { - test(function() { - var ws = CreateWebSocket(secure, false, false); - assert_throws("InvalidAccessError", function () { - ws.close(t[0]); - }); - wsocket.onerror = this.unreached_func(); - }, t[1] + " on a " + (secure ? "secure" : "insecure") + " websocket"); - }); + [true, false].forEach(function(secure) { + test(function() { + var ws = CreateWebSocket(secure, false, false); + assert_throws("InvalidAccessError", function() { + ws.close(t[0]); + }); + wsocket.onerror = this.unreached_func(); + }, t[1] + " on a " + (secure ? "secure" : "insecure") + " websocket"); + }); }); diff --git a/testing/web-platform/tests/websockets/constructor.any.js b/testing/web-platform/tests/websockets/constructor.any.js index 60f5335fac5c..0605d5e5efc2 100644 --- a/testing/web-platform/tests/websockets/constructor.any.js +++ b/testing/web-platform/tests/websockets/constructor.any.js @@ -2,6 +2,6 @@ test(function() { var ws = new WebSocket("ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH, - "echo", "Stray argument") + "echo", "Stray argument") assert_true(ws instanceof WebSocket, "Expected a WebSocket instance.") }, "Calling the WebSocket constructor with too many arguments should not throw.") diff --git a/testing/web-platform/tests/websockets/eventhandlers.any.js b/testing/web-platform/tests/websockets/eventhandlers.any.js index f97c668a4a1f..b30b0b693f49 100644 --- a/testing/web-platform/tests/websockets/eventhandlers.any.js +++ b/testing/web-platform/tests/websockets/eventhandlers.any.js @@ -3,7 +3,7 @@ function testEventHandler(name) { test(function() { var ws = new WebSocket("ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH, - "echo") + "echo") assert_equals(ws["on" + name], null); ws["on" + name] = function() {}; ws["on" + name] = 2;