diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/websockets/interfaces/WebSocket/close | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/websockets/interfaces/WebSocket/close')
6 files changed, 137 insertions, 0 deletions
diff --git a/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-basic.html b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-basic.html new file mode 100644 index 000000000..ab6c93b61 --- /dev/null +++ b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-basic.html @@ -0,0 +1,26 @@ +<!doctype html> +<title>WebSockets: close()</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../../../constants.js?pipe=sub></script> +<meta name="variant" content=""> +<meta name="variant" content="?wss"> +<div id=log></div> +<script> +async_test(function(t) { + var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/'); + ws.onclose = t.step_func(function(e) { + assert_equals(e instanceof CloseEvent, true, 'e instanceof CloseEvent'); + assert_equals(e.wasClean, false, 'e.wasClean'); + e.wasClean = true; + assert_equals(e.wasClean, false, 'e.wasClean = true'); + delete e.wasClean; + assert_equals(e.wasClean, false, 'delete e.wasClean'); + delete CloseEvent.prototype.wasClean; + assert_equals(e.wasClean, undefined, 'delete CloseEvent.prototype.wasClean'); + t.done(); + }); + ws.close(); + assert_equals(ws.readyState, ws.CLOSING); +}, undefined, {timeout:9900}); +</script> diff --git a/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-connecting.html b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-connecting.html new file mode 100644 index 000000000..2a1104439 --- /dev/null +++ b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-connecting.html @@ -0,0 +1,25 @@ +<!doctype html> +<title>WebSockets: close() when connecting</title> +<meta name=timeout content=long> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../../../constants.js?pipe=sub></script> +<meta name="variant" content=""> +<meta name="variant" content="?wss"> +<div id=log></div> +<script> +async_test(function(t) { + var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/sleep_10_v13'); + setTimeout(t.step_func(function() { + assert_equals(ws.readyState, ws.CONNECTING); + ws.close(); + assert_equals(ws.readyState, ws.CLOSING); + ws.onclose = t.step_func(function(e) { + assert_equals(ws.readyState, ws.CLOSED); + assert_equals(e.wasClean, false); + t.done(); + }); + }), 1000); + ws.onopen = ws.onclose = t.step_func(assert_unreached); +}, undefined, {timeout:12000}); +</script> diff --git a/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-multiple.html b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-multiple.html new file mode 100644 index 000000000..d64ac694f --- /dev/null +++ b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-multiple.html @@ -0,0 +1,29 @@ +<!doctype html> +<title>WebSockets: close() several times</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../../../constants.js?pipe=sub></script> +<meta name="variant" content=""> +<meta name="variant" content="?wss"> +<div id=log></div> +<script> +var i = 0; +async_test(function(t) { + var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/'); + ws.onclose = t.step_func(function(e) { + i++; + }); + ws.close(); + ws.close(); + ws.close(); + var f = t.step_func(function() { + if (i < 1) { + setTimeout(f, 500); + return; + } + assert_equals(i, 1); + t.done() + }); + setTimeout(f, 500); +}); +</script> diff --git a/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-nested.html b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-nested.html new file mode 100644 index 000000000..d66495a69 --- /dev/null +++ b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-nested.html @@ -0,0 +1,28 @@ +<!doctype html> +<title>WebSockets: close() in close event handler</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../../../constants.js?pipe=sub></script> +<meta name="variant" content=""> +<meta name="variant" content="?wss"> +<div id=log></div> +<script> +async_test(function(t) { + var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/'); + var i = 0; + ws.onclose = t.step_func(function(e) { + i++; + if (i == 1) { + assert_equals(ws.readyState, ws.CLOSED); + ws.close(); + assert_equals(ws.readyState, ws.CLOSED); + } + setTimeout(t.step_func(function() { + assert_equals(i, 1); + t.done(); + }), 50); + }); + ws.close(); + assert_equals(ws.readyState, ws.CLOSING); +}, undefined, {timeout:9900}); +</script> diff --git a/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-replace.html b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-replace.html new file mode 100644 index 000000000..a3d29d0c9 --- /dev/null +++ b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-replace.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>WebSockets: replacing close</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../../../constants.js?pipe=sub></script> +<meta name="variant" content=""> +<meta name="variant" content="?wss"> +<div id=log></div> +<script> +test(function() { + var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/'); + ws.close = 5; + assert_equals(ws.close, 5); +}); +</script> diff --git a/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-return.html b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-return.html new file mode 100644 index 000000000..c752c4224 --- /dev/null +++ b/testing/web-platform/tests/websockets/interfaces/WebSocket/close/close-return.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>WebSockets: close() return value</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../../../constants.js?pipe=sub></script> +<meta name="variant" content=""> +<meta name="variant" content="?wss"> +<div id=log></div> +<script> +test(function() { + var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/'); + assert_equals(ws.close(), undefined); +}); +</script> |