forked from mirrors/gecko-dev
Automatic update from web-platform-testsRemove the "W3C WebSocket API" prefix from websockets/ tests (#13478) This prefix doesn't add any useful information, and isn't used in all tests in this directory. Noticed because of the screen real estate it takes up in a view like this: https://wpt.fyi/results/websockets/Send-binary-65K-arraybuffer.any.html In the directory, this command was run, on macOS: git grep -lF 'W3C WebSocket API - ' | xargs sed -i '' 's/W3C WebSocket API - //g' -- wpt-commits: 1e747acc90ecdbd23ef3348a144b77696cced55b wpt-pr: 13478
20 lines
753 B
JavaScript
20 lines
753 B
JavaScript
// META: script=websocket.sub.js
|
|
|
|
var testOpen = async_test("Create WebSocket - Pass a valid URL - Connection should be opened");
|
|
var testClose = async_test("Create WebSocket - Pass a valid URL - Connection should be closed");
|
|
|
|
var wsocket = CreateWebSocket(false, false, false);
|
|
var isOpenCalled = false;
|
|
|
|
wsocket.addEventListener('open', testOpen.step_func(function(evt) {
|
|
assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)");
|
|
wsocket.close();
|
|
isOpenCalled = true;
|
|
testOpen.done();
|
|
}), true);
|
|
|
|
wsocket.addEventListener('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);
|