aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/wpt/metadata/MANIFEST.json4
-rw-r--r--tests/wpt/web-platform-tests/websockets/opening-handshake/003-sets-origin.worker.js19
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json
index 8721140f72a..1c1e6a7bd36 100644
--- a/tests/wpt/metadata/MANIFEST.json
+++ b/tests/wpt/metadata/MANIFEST.json
@@ -32070,6 +32070,10 @@
"url": "/websockets/opening-handshake/001.html"
},
{
+ "path": "websockets/opening-handshake/003-sets-origin.worker.js",
+ "url": "/websockets/opening-handshake/003-sets-origin.worker"
+ },
+ {
"path": "websockets/opening-handshake/003.html",
"url": "/websockets/opening-handshake/003.html"
},
diff --git a/tests/wpt/web-platform-tests/websockets/opening-handshake/003-sets-origin.worker.js b/tests/wpt/web-platform-tests/websockets/opening-handshake/003-sets-origin.worker.js
new file mode 100644
index 00000000000..1a10e1e7e6c
--- /dev/null
+++ b/tests/wpt/web-platform-tests/websockets/opening-handshake/003-sets-origin.worker.js
@@ -0,0 +1,19 @@
+importScripts("/resources/testharness.js");
+importScripts('../constants.js?pipe=sub');
+importScripts('../websocket.js?pipe=sub');
+
+async_test(function(t) {
+ var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/origin');
+ ws.onmessage = t.step_func(function(e) {
+ assert_equals(e.data, location.protocol+'//'+location.host);
+ ws.onclose = t.step_func(function(e) {
+ assert_equals(e.wasClean, true);
+ ws.onclose = t.step_func(function() {assert_unreached()});
+ setTimeout(t.step_func_done(), 50)
+ })
+ ws.close();
+ })
+ ws.onerror = ws.onclose = t.step_func(function() {assert_unreached()});
+}, "W3C WebSocket API - origin set in a Worker");
+
+done();