fune/testing/web-platform/tests/websockets/basic-auth.any.js
Anne van Kesteren ac18f8d13d Bug 1631482 [wpt PR 23117] - *.any.js: explicitly list defaults, part 1, a=testonly
Automatic update from web-platform-tests
*.any.js: explicitly list defaults, part 1 (#23117)

* *.any.js: explicitly list defaults, part 1

Helps with #23111.

* add a couple more
--

wpt-commits: e1e713c842e54ea0a9410ddc988b63d0e1d31973
wpt-pr: 23117
2020-04-28 11:46:33 +00:00

18 lines
591 B
JavaScript

// META: global=window,worker
// META: script=websocket.sub.js
async_test(t => {
const isSecure = new URL(location.href).scheme === 'https';
const scheme = isSecure ? 'wss' : 'ws';
const port = isSecure ? __SECURE__PORT : __PORT;
const url = scheme + '://' + 'foo:bar@' + __SERVER__NAME + ':' + port + '/basic_auth';
const ws = new WebSocket(url);
ws.onopen = () => {
ws.onclose = ws.onerror = null;
ws.close();
t.done();
};
ws.onerror = ws.onclose = t.unreached_func('open should succeed');
}, 'HTTP basic authentication should work with WebSockets');
done();