зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
1c8dfd30bf
Коммит
fd759c62fc
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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.")
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче