summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/websockets/binaryType-wrong-value.any.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/websockets/binaryType-wrong-value.any.js')
-rw-r--r--testing/web-platform/tests/websockets/binaryType-wrong-value.any.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/testing/web-platform/tests/websockets/binaryType-wrong-value.any.js b/testing/web-platform/tests/websockets/binaryType-wrong-value.any.js
new file mode 100644
index 0000000000..683fb47bed
--- /dev/null
+++ b/testing/web-platform/tests/websockets/binaryType-wrong-value.any.js
@@ -0,0 +1,23 @@
+// META: script=constants.sub.js
+// META: variant=?default
+// META: variant=?wss
+// META: variant=?wpt_flags=h2
+
+var test = async_test("Create WebSocket - set binaryType to something other than blob or arraybuffer - SYNTAX_ERR is returned - Connection should be closed");
+
+let wsocket = CreateWebSocket(false, false);
+let opened = false;
+
+wsocket.addEventListener('open', test.step_func(function(evt) {
+ opened = true;
+ assert_equals(wsocket.binaryType, "blob");
+ wsocket.binaryType = "notBlobOrArrayBuffer";
+ assert_equals(wsocket.binaryType, "blob");
+ wsocket.close();
+}), true);
+
+wsocket.addEventListener('close', test.step_func(function(evt) {
+ assert_true(opened, "connection should be opened");
+ assert_true(evt.wasClean, "wasClean should be true");
+ test.done();
+}), true);