diff options
Diffstat (limited to 'testing/web-platform/tests/websockets/constructor')
20 files changed, 0 insertions, 442 deletions
diff --git a/testing/web-platform/tests/websockets/constructor/001.html b/testing/web-platform/tests/websockets/constructor/001.html deleted file mode 100644 index 2a868bfa0..000000000 --- a/testing/web-platform/tests/websockets/constructor/001.html +++ /dev/null @@ -1,13 +0,0 @@ -<!doctype html> -<title>WebSockets: new WebSocket() with no args</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() { - assert_throws(new TypeError(), function(){new WebSocket()}); -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/002.html b/testing/web-platform/tests/websockets/constructor/002.html deleted file mode 100644 index 94015979b..000000000 --- a/testing/web-platform/tests/websockets/constructor/002.html +++ /dev/null @@ -1,20 +0,0 @@ -<!doctype html> -<title>WebSockets: new WebSocket(invalid url)</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() {assert_throws("SyntaxError", function(){new WebSocket("/test")})}); -test(function() {assert_throws("SyntaxError", function(){new WebSocket("ws://foo bar.com/")})}); -test(function() {assert_throws("SyntaxError", function(){new WebSocket("wss://foo bar.com/")})}); -test(function() {assert_throws("SyntaxError", function(){new WebSocket("http://"+location.host+"/")})}); -test(function() {assert_throws("SyntaxError", function(){new WebSocket("mailto:example@example.org")})}); -test(function() {assert_throws("SyntaxError", function(){new WebSocket("about:blank")})}); -test(function() {assert_throws("SyntaxError", function(){new WebSocket(SCHEME_DOMAIN_PORT+"/#")})}); -test(function() {assert_throws("SyntaxError", function(){new WebSocket(SCHEME_DOMAIN_PORT+"/#test")})}); -test(function() {assert_throws("SyntaxError", function(){new WebSocket("?test")})}); -test(function() {assert_throws("SyntaxError", function(){new WebSocket("#test")})}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/004.html b/testing/web-platform/tests/websockets/constructor/004.html deleted file mode 100644 index f35802154..000000000 --- a/testing/web-platform/tests/websockets/constructor/004.html +++ /dev/null @@ -1,35 +0,0 @@ -<!doctype html> -<title>WebSockets: new WebSocket(url, invalid protocol)</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> -// empty string -test(function() { - assert_throws("SyntaxError", function() { - new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message', "") - }) -}); - -// chars below U+0020 except U+0000; U+0000 is tested in a separate test -for (var i = 1; i < 0x20; ++i) { - test(function() { - assert_throws("SyntaxError", function() { - new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message', - "a"+String.fromCharCode(i)+"b") - }, 'char code '+i); - }) -} -// some chars above U+007E -for (var i = 0x7F; i < 0x100; ++i) { - test(function() { - assert_throws("SyntaxError", function() { - new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message', - "a"+String.fromCharCode(i)+"b") - }, 'char code '+i); - }) -} -</script> diff --git a/testing/web-platform/tests/websockets/constructor/005.html b/testing/web-platform/tests/websockets/constructor/005.html deleted file mode 100644 index 63e61ddb0..000000000 --- a/testing/web-platform/tests/websockets/constructor/005.html +++ /dev/null @@ -1,13 +0,0 @@ -<!doctype html> -<title>WebSockets: 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() { - assert_true(new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message') instanceof WebSocket); -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/006.html b/testing/web-platform/tests/websockets/constructor/006.html deleted file mode 100644 index a9d01bbf3..000000000 --- a/testing/web-platform/tests/websockets/constructor/006.html +++ /dev/null @@ -1,28 +0,0 @@ -<!doctype html> -<title>WebSockets: converting first arguments</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 a = document.createElement('a'); - a.href = SCHEME_DOMAIN_PORT+'/echo'; - var ws = new WebSocket(a); // should stringify arguments; <a> stringifies to its .href - assert_equals(ws.url, a.href); - ws.onopen = t.step_func(function(e) { - ws.send('test'); - }); - ws.onmessage = t.step_func(function(e) { - assert_equals(e.data, 'test'); - ws.onclose = t.step_func(function(e) { - ws.onclose = t.step_func(function() {assert_unreached()}); - setTimeout(t.step_func(function() {t.done()}), 50); - }); - ws.close(); - }); - ws.onerror = ws.onclose = t.step_func(function() {assert_unreached()}); -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/007.html b/testing/web-platform/tests/websockets/constructor/007.html deleted file mode 100644 index 6f141a541..000000000 --- a/testing/web-platform/tests/websockets/constructor/007.html +++ /dev/null @@ -1,16 +0,0 @@ -<!doctype html> -<title>WebSockets: new WebSocket(url, null char)</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() { - assert_throws("SyntaxError", function() { - new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message', - 'a' + String.fromCharCode(0) + 'b') - }) -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/008.html b/testing/web-platform/tests/websockets/constructor/008.html deleted file mode 100644 index f425ff058..000000000 --- a/testing/web-platform/tests/websockets/constructor/008.html +++ /dev/null @@ -1,15 +0,0 @@ -<!doctype html> -<title>WebSockets: new WebSocket(url with not blocked port)</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> -//Pass condition is to not throw -test(function(){new WebSocket('ws://example.invalid:80/')}); -test(function(){new WebSocket('ws://example.invalid:443/')}); -test(function(){new WebSocket('wss://example.invalid:80/')}); -test(function(){new WebSocket('wss://example.invalid:443/')}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/009.html b/testing/web-platform/tests/websockets/constructor/009.html deleted file mode 100644 index 56eb912c8..000000000 --- a/testing/web-platform/tests/websockets/constructor/009.html +++ /dev/null @@ -1,23 +0,0 @@ -<!doctype html> -<title>WebSockets: protocol</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+'/protocol', 'foobar'); - - ws.onmessage = t.step_func(function(e) { - assert_equals(ws.protocol, 'foobar'); - ws.onclose = t.step_func(function(e) { - ws.onclose = t.step_func(function() {assert_unreached()}); - setTimeout(t.step_func(function() {t.done()}), 50); - }) - ws.close(); - }) - ws.onerror = t.step_func(function() {assert_unreached()}); -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/010.html b/testing/web-platform/tests/websockets/constructor/010.html deleted file mode 100644 index da2a9bf59..000000000 --- a/testing/web-platform/tests/websockets/constructor/010.html +++ /dev/null @@ -1,22 +0,0 @@ -<!doctype html> -<title>WebSockets: protocol in response but no requested protocol</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+'/handshake_protocol'); - ws.onerror = ws.onmessage = ws.onclose = t.step_func(function(e) {assert_unreached(e.type)}); - ws.onopen = t.step_func(function(e) { - ws.onclose = t.step_func(function(e) { - ws.onclose = t.step_func(function(e) {assert_unreached(e.type)}); - setTimeout(t.step_func(function() {t.done();}), 50); - }) - ws.close(); - }) -}); -</script> - diff --git a/testing/web-platform/tests/websockets/constructor/011.html b/testing/web-platform/tests/websockets/constructor/011.html deleted file mode 100644 index e8d0b3aaf..000000000 --- a/testing/web-platform/tests/websockets/constructor/011.html +++ /dev/null @@ -1,27 +0,0 @@ -<!doctype html> -<title>WebSockets: protocol mismatch</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+'/handshake_protocol', 'FOOBAR'); - var gotOpen = false; - var gotError = false; - ws.onopen = t.step_func(function(e) { - gotOpen = true; - }) - ws.onerror = t.step_func(function(e) { - gotError = true; - }) - ws.onclose = t.step_func(function(e) { - assert_true(gotOpen, 'got open'); - assert_true(gotError, 'got error'); - ws.onclose = t.step_func(function() {assert_unreached()}); - setTimeout(t.step_func(function() {t.done();}), 50); - }) -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/012.html b/testing/web-platform/tests/websockets/constructor/012.html deleted file mode 100644 index 29ac6d53f..000000000 --- a/testing/web-platform/tests/websockets/constructor/012.html +++ /dev/null @@ -1,19 +0,0 @@ -<!doctype html> -<title>WebSockets: no protocol in response</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+'/handshake_no_protocol', 'foobar'); - ws.onclose = t.step_func(function(e) { - ws.onclose = t.step_func(function() {assert_unreached()}); - setTimeout(t.step_func(function() {t.done();}), 50) - }) - ws.onmessage = t.step_func(function() {assert_unreached()}); -}); -</script> - diff --git a/testing/web-platform/tests/websockets/constructor/013.html b/testing/web-platform/tests/websockets/constructor/013.html deleted file mode 100644 index fe777af19..000000000 --- a/testing/web-platform/tests/websockets/constructor/013.html +++ /dev/null @@ -1,41 +0,0 @@ -<!doctype html> -<title>WebSockets: multiple WebSocket objects</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) { - // test that the events are fired as they should when opening 25 websockets and - // sending a message on each and then closing when getting the message back - var ws = []; - var events = 0; - for (var i = 0; i < 25; ++i) { - ws[i] = new WebSocket(SCHEME_DOMAIN_PORT+'/echo'); - ws[i].id = i; - ws[i].onopen = t.step_func(function(e) { - events++; - this.send(this.id); - this.onopen = t.step_func(function() {assert_unreached()}); - }, ws[i]); - ws[i].onmessage = t.step_func(function(e) { - events++; - assert_equals(e.data, ''+this.id); - this.close(); - this.onmessage = t.step_func(function() {assert_unreached()}); - }, ws[i]); - ws[i].onclose = t.step_func(function(e) { - events++; - if (events == 75) { - t.done(); - } - this.onclose = t.step_func(function() {assert_unreached()}); - }, ws[i]); - ws[i].onerror = t.step_func(function() {assert_unreached()}); - } -}, null, {timeout:25000}); -</script> - diff --git a/testing/web-platform/tests/websockets/constructor/014.html b/testing/web-platform/tests/websockets/constructor/014.html deleted file mode 100644 index 579a5d3ed..000000000 --- a/testing/web-platform/tests/websockets/constructor/014.html +++ /dev/null @@ -1,39 +0,0 @@ -<!doctype html> -<title>WebSockets: serialize establish a connection</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 = []; - var events = 0; - var prevDate; - var date; - for (var i = 0; i < 4; ++i) { - ws[i] = new WebSocket(SCHEME_DOMAIN_PORT+'/handshake_sleep_2'); - ws[i].id = i; - ws[i].onopen = t.step_func(function(e) { - events++; - date = new Date(); - if (prevDate) { - assert_greater_than(date - prevDate, 1000); - } - prevDate = date; - this.onopen = t.step_func(function() {assert_unreached()}); - }.bind(ws[i])) - ws[i].onclose = t.step_func(function() { - events++; - if (events == 8) { - t.done(); - } - this.onclose = t.step_func(function() {assert_unreached()}); - }.bind(ws[i])); - ws[i].onerror = ws[i].onmessage = t.step_func(function() {assert_unreached()}); - } -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/016.html b/testing/web-platform/tests/websockets/constructor/016.html deleted file mode 100644 index a1bf28167..000000000 --- a/testing/web-platform/tests/websockets/constructor/016.html +++ /dev/null @@ -1,19 +0,0 @@ -<!doctype html> -<meta charset=windows-1252> -<title>WebSockets: non-ascii URL in query, document encoding windows-1252</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+'/echo-query_v13?едц'); - ws.onclose = t.step_func(function() {assert_unreached()}); - ws.onmessage = t.step_func(function(e) { - assert_equals(e.data, '%C3%A5%C3%A4%C3%B6'); - t.done(); - }); -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/017.html b/testing/web-platform/tests/websockets/constructor/017.html deleted file mode 100644 index 8a7960d88..000000000 --- a/testing/web-platform/tests/websockets/constructor/017.html +++ /dev/null @@ -1,20 +0,0 @@ -<!doctype html> -<title>WebSockets: too few slashes after ws: and wss:</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 tests = [ - ['ws:', PORT], - ['ws:/', PORT], - ['wss:', PORT_SSL], - ['wss:/', PORT_SSL] -]; -//Pass condition is to not throw -for (var i = 0; i < tests.length; ++i) { - test(function(){new WebSocket(tests[i][0] + location.hostname + ':' + tests[i][1] + '/echo')}, tests[i][0]); -} -</script> diff --git a/testing/web-platform/tests/websockets/constructor/018.html b/testing/web-platform/tests/websockets/constructor/018.html deleted file mode 100644 index d96d4be6b..000000000 --- a/testing/web-platform/tests/websockets/constructor/018.html +++ /dev/null @@ -1,19 +0,0 @@ -<!doctype html> -<title>WebSockets: NULL char in url</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+'/echo-query?x\u0000y\u0000'); - ws.onmessage = t.step_func(function(e) { - assert_equals(e.data, 'x%00y'); - ws.close(); - t.done(); - }) - ws.onclose = ws.onerror = t.step_func(function(e) {assert_unreached(e.type)}); -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/019.html b/testing/web-platform/tests/websockets/constructor/019.html deleted file mode 100644 index b56745aa2..000000000 --- a/testing/web-platform/tests/websockets/constructor/019.html +++ /dev/null @@ -1,20 +0,0 @@ -<!doctype html> -<title>WebSockets: uppercase 'WS:'</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 scheme = SCHEME_DOMAIN_PORT.split('://')[0]; - var domain = SCHEME_DOMAIN_PORT.split('://')[1]; - var ws = new WebSocket(scheme.toUpperCase()+'://'+domain+'/echo'); - ws.onopen = t.step_func(function(e) { - ws.close(); - t.done(); - }) - ws.onclose = ws.onerror = ws.onmessage = t.step_func(function() {assert_unreached()}); -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/020.html b/testing/web-platform/tests/websockets/constructor/020.html deleted file mode 100644 index 55ca9934b..000000000 --- a/testing/web-platform/tests/websockets/constructor/020.html +++ /dev/null @@ -1,20 +0,0 @@ -<!doctype html> -<title>WebSockets: uppercase host</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 scheme = SCHEME_DOMAIN_PORT.split('://')[0]; - var domain = SCHEME_DOMAIN_PORT.split('://')[1]; - var ws = new WebSocket(scheme+'://'+domain.toUpperCase()+'/echo'); - ws.onopen = t.step_func(function(e) { - ws.close(); - t.done(); - }); - ws.onclose = ws.onerror = ws.onmessage = t.step_func(function() {assert_unreached()}); -}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/021.html b/testing/web-platform/tests/websockets/constructor/021.html deleted file mode 100644 index 80156540f..000000000 --- a/testing/web-platform/tests/websockets/constructor/021.html +++ /dev/null @@ -1,11 +0,0 @@ -<!doctype html> -<title>WebSockets: Same sub protocol twice</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() {assert_throws("SyntaxError", function(){new WebSocket("ws://certo2.oslo.osa/protocol_array",["foobar, foobar"])})}); -</script> diff --git a/testing/web-platform/tests/websockets/constructor/022.html b/testing/web-platform/tests/websockets/constructor/022.html deleted file mode 100644 index 136a40d10..000000000 --- a/testing/web-platform/tests/websockets/constructor/022.html +++ /dev/null @@ -1,22 +0,0 @@ -<!doctype html> -<title>WebSockets: protocol array</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+'/protocol_array',['foobar','foobar2']); - ws.onmessage = t.step_func(function(e) { - assert_equals(ws.protocol, 'foobar'); - ws.onclose = t.step_func(function(e) { - ws.onclose = t.step_func(function() {assert_unreached()}); - setTimeout(t.step_func(function() {t.done();}), 50) - }); - ws.close(); - }); - ws.onerror = t.step_func(function() {assert_unreached()}); -}); -</script> |