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:
moz-wptsync-bot 2018-05-01 17:01:39 +00:00 коммит произвёл James Graham
Родитель 1c8dfd30bf
Коммит fd759c62fc
77 изменённых файлов: 1350 добавлений и 1310 удалений

Просмотреть файл

@ -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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close(1000, "Clean Close");
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close(1000);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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) {
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) });
assert_throws("SYNTAX_ERR", function() {
wsocket.close(1000, reason)
});
test.done();
}), true);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close(1000, reason);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', test.step_func(function(evt) {
wsocket.close(undefined);
test.done();
}), true);
}), 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) {
wsocket.addEventListener('open', testOpen.step_func(function(evt) {
assert_equals(wsocket.extensions, "", "extensions should be empty");
wsocket.close();
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), true);

Просмотреть файл

@ -1,7 +1,9 @@
// META: script=websocket.sub.js
test(function () {
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")
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) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), true);

Просмотреть файл

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
test(function () {
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")
}, "W3C WebSocket API - Create Secure WebSocket - wsocket.url should be set correctly")

Просмотреть файл

@ -1,7 +1,9 @@
// META: script=websocket.sub.js
test(function () {
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")
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,13 +1,13 @@
// META: script=websocket.sub.js
async_test(t => {
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
[
}, 'Basic check');
// list of bad ports according to
// https://fetch.spec.whatwg.org/#port-blocking
[
1, // tcpmux
7, // echo
9, // discard
@ -72,10 +72,10 @@
6667, // irc (default)
6668, // irc (alternate)
6669, // irc (alternate)
].forEach(blockedPort => {
].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 () {
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")
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 () {
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")
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")

Просмотреть файл

@ -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 () {
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")
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 () {
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")
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 () {
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")
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) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), true);

Просмотреть файл

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
test(function () {
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")
}, "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) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), true);

Просмотреть файл

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
test(function () {
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");
}, "W3C WebSocket API - Create WebSocket - wsocket.url should be set correctly");

Просмотреть файл

@ -1,6 +1,8 @@
// META: script=websocket.sub.js
test(function () {
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")
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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close(1000, "Clean Close");
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close(1000, "Clean Close");
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close(1000);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close();
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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") });
wsocket.addEventListener('open', test.step_func(function(evt) {
assert_throws("INVALID_ACCESS_ERR", function() {
wsocket.close(1005, "1005 - reserved code")
});
test.done();
}), true);
}), 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") });
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close(3000, "Clean Close with code - 3000");
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close(3000, "Clean Close");
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close(3000, "Clean Close with code - 4999");
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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) {
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) });
assert_throws("SYNTAX_ERR", function() {
wsocket.close(1000, reason)
});
test.done();
}), true);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close(1000, reason);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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") });
wsocket.addEventListener('open', test.step_func(function(evt) {
assert_throws("INVALID_ACCESS_ERR", function() {
wsocket.close("Close with only reason")
});
test.done();
}), true);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.close();
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', test.step_func(function(evt) {
wsocket.close();
assert_equals(wsocket.readyState, 2, "readyState should be 2(CLOSING)");
test.done();
}), true);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send("Goodbye");
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', test.step_func(function(evt) {
wsocket.close(undefined);
test.done();
}), true);
}), true);

Просмотреть файл

@ -1,14 +1,14 @@
// 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) {
wsocket.addEventListener('open', testOpen.step_func(function(evt) {
for (var i = 0; i < 65000; i++) {
data = data + "c";
}
@ -16,16 +16,16 @@
assert_equals(data.length, wsocket.bufferedAmount);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, data);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.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);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data.byteLength, datasize);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.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);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data.byteLength, datasize);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.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++) {
for (var i = 0; i < 2; i++) {
view[i] = i;
}
wsocket.send(view);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
var resultView = new Float32Array(evt.data);
for(var i = 0; i < resultView.length; i++) {
for (var i = 0; i < resultView.length; i++) {
assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same");
}
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), true);

Просмотреть файл

@ -1,16 +1,16 @@
// 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.binaryType = "arraybuffer";
data = new ArrayBuffer(datasize);
view = new Float64Array(data);
@ -20,19 +20,19 @@
wsocket.send(view);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
var resultView = new Float64Array(evt.data);
for(var i = 0; i < resultView.length; i++) {
for (var i = 0; i < resultView.length; i++) {
assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same");
}
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.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++) {
for (var i = 0; i < 2; i++) {
view[i] = i;
}
wsocket.send(view);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
var resultView = new Int32Array(evt.data);
for(var i = 0; i < resultView.length; i++) {
for (var i = 0; i < resultView.length; i++) {
assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same");
}
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.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++) {
for (var i = 0; i < 4; i++) {
view[i] = i;
}
wsocket.send(view);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
var resultView = new Uint16Array(evt.data);
for(var i = 0; i < resultView.length; i++) {
for (var i = 0; i < resultView.length; i++) {
assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same");
}
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.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++) {
for (var i = 0; i < 2; i++) {
view[i] = i;
}
wsocket.send(view);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
var resultView = new Uint32Array(evt.data);
for(var i = 0; i < resultView.length; i++) {
for (var i = 0; i < resultView.length; i++) {
assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same");
}
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.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++) {
for (var i = 0; i < 8; i++) {
view[i] = i;
}
wsocket.send(view);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
var resultView = new Uint8Array(evt.data);
for(var i = 0; i < resultView.length; i++) {
for (var i = 0; i < resultView.length; i++) {
assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same");
}
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.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++) {
for (var i = 0; i < 8; i++) {
view[i] = i;
}
wsocket.send(view);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
var resultView = new Uint8Array(evt.data);
for(var i = 0; i < resultView.length; i++) {
for (var i = 0; i < resultView.length; i++) {
assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same");
}
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), true);

Просмотреть файл

@ -1,16 +1,16 @@
// 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.binaryType = "blob";
for (var i = 0; i < datasize; i++)
data += String.fromCharCode(0);
@ -18,17 +18,17 @@
isOpenCalled = true;
wsocket.send(data);
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
assert_equals(data.length, wsocket.bufferedAmount);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, data);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
if ("null" == evt.data || "" == evt.data)
nullReturned = true;
assert_true(nullReturned);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
assert_equals(data.length * 2, wsocket.bufferedAmount);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, data);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
assert_equals(data.length * 2, wsocket.bufferedAmount);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, data);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, replacementChar);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
assert_equals(data.length, wsocket.bufferedAmount);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, data);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), true);

Просмотреть файл

@ -1,14 +1,14 @@
// 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) {
wsocket.addEventListener('open', testOpen.step_func(function(evt) {
for (var i = 0; i < 65000; i++) {
data = data + "c";
}
@ -16,16 +16,16 @@
assert_equals(data.length, wsocket.bufferedAmount);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, data);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, replacementChar);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), true);

Просмотреть файл

@ -1,6 +1,8 @@
// META: script=websocket.sub.js
test(function () {
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")
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.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);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data.byteLength, datasize);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.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);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data.byteLength, datasize);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.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++) {
for (var i = 0; i < 4; i++) {
view[i] = i;
}
wsocket.send(view);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
var resultView = new Int16Array(evt.data);
for(var i = 0; i < resultView.length; i++) {
for (var i = 0; i < resultView.length; i++) {
assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same");
}
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), true);

Просмотреть файл

@ -1,16 +1,16 @@
// 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.binaryType = "arraybuffer";
data = new ArrayBuffer(datasize);
int8View = new Int8Array(data);
@ -20,19 +20,19 @@
wsocket.send(int8View);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), true);

Просмотреть файл

@ -1,16 +1,16 @@
// 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.binaryType = "blob";
for (var i = 0; i < datasize; i++)
data += String.fromCharCode(0);
@ -18,17 +18,17 @@
isOpenCalled = true;
wsocket.send(data);
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
assert_equals(data.length, wsocket.bufferedAmount);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, data);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
if ("null" == evt.data || "" == evt.data)
nullReturned = true;
assert_true(nullReturned);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
assert_equals(data.length * 2, wsocket.bufferedAmount);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, data);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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.addEventListener('open', testOpen.step_func(function(evt) {
wsocket.send(data);
assert_equals(data.length * 2, wsocket.bufferedAmount);
isOpenCalled = true;
testOpen.done();
}), true);
}), true);
wsocket.addEventListener('message', testMessage.step_func(function (evt) {
wsocket.addEventListener('message', testMessage.step_func(function(evt) {
assert_equals(evt.data, data);
wsocket.close();
testMessage.done();
}), true);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
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);
}), 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) {
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);
}), true);
wsocket.addEventListener('close', testClose.step_func(function (evt) {
wsocket.addEventListener('close', testClose.step_func(function(evt) {
assert_true(evt.wasClean, "wasClean should be true");
testClose.done();
}), true);
}), true);

Просмотреть файл

@ -11,7 +11,7 @@
[true, false].forEach(function(secure) {
test(function() {
var ws = CreateWebSocket(secure, false, false);
assert_throws("InvalidAccessError", function () {
assert_throws("InvalidAccessError", function() {
ws.close(t[0]);
});
wsocket.onerror = this.unreached_func();