Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255

This commit is contained in:
James Graham 2015-03-27 09:15:38 +00:00
parent b2a5225831
commit 1a81b18b9f
12321 changed files with 544385 additions and 6 deletions

View file

@ -0,0 +1,13 @@
<!doctype html>
<title>WebSockets: send() with no args</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
assert_throws(new TypeError(), function(){ws.send()});
});
</script>

View file

@ -0,0 +1,13 @@
<!doctype html>
<title>WebSockets: replacing send</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
test(function() {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
ws.send = 5;
assert_equals(ws.send, 5);
});
</script>

View file

@ -0,0 +1,13 @@
<!doctype html>
<title>WebSockets: send() when readyState is CONNECTING</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
assert_throws("INVALID_STATE_ERR", function(){ws.send('a')});
});
</script>

View file

@ -0,0 +1,23 @@
<!doctype html>
<title>WebSockets: send() with unpaired surrogate when readyState is CONNECTING</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
assert_throws("INVALID_STATE_ERR", function(){ws.send('a\uDC00x')});
}, "lone low surrogate");
test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
assert_throws("INVALID_STATE_ERR", function(){ws.send('a\uD800x')});
}, "lone high surrogate");
test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
assert_throws("INVALID_STATE_ERR", function(){ws.send('a\uDC00\uD800x')});
}, "surrogates in wrong order");
</script>

View file

@ -0,0 +1,16 @@
<!doctype html>
<title>WebSockets: send() return value</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
async_test(function(t){
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
ws.onopen = t.step_func(function(e) {
assert_equals(ws.send('test'), undefined);
t.done();
});
});
</script>

View file

@ -0,0 +1,23 @@
<!doctype html>
<title>WebSockets: send() with unpaired surrogate when readyState is OPEN</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id="log"></div>
<script>
async_test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
ws.onopen = t.step_func(function(e) {
// lone low surrogate, lone high surrogate + surrogates in wrong order.
ws.send('a\uDC00xb\uD800xc\uDC00\uD800x');
})
ws.onmessage = t.step_func(function(e) {
assert_equals(e.data, 'a\uFFFDxb\uFFFDxc\uFFFD\uFFFDx');
ws.onclose = t.step_func(function(e) {
ws.onclose = t.step_func(function() {assert_unreached()});
setTimeout(function() {t.done();}, 50);
});
ws.close();
})
});
</script>

View file

@ -0,0 +1,24 @@
<!doctype html>
<title>WebSockets: close() followed by send()</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
async_test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
ws.onopen = t.step_func(function(e) {
// test that nothing strange happens if we send something after close()
ws.close();
var sent = ws.send('test');
assert_equals(sent, undefined);
});
ws.onclose = t.step_func(function(e) {
ws.onclose = t.step_func(function() {assert_unreached()});
setTimeout(function() {t.done()}, 50);
});
ws.onerror = ws.onmessage = t.step_func(function() {assert_unreached()});
});
</script>

View file

@ -0,0 +1,23 @@
<!doctype html>
<title>WebSockets: send() in onclose</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
async_test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
ws.onopen = t.step_func(function(e) {
ws.send('Goodbye');
})
ws.onclose = t.step_func(function(e) {
// test that nothing strange happens when send()ing in closed state
var sent = ws.send('test');
assert_equals(sent, undefined);
ws.onclose = t.step_func(function() {assert_unreached()});
setTimeout(function() {t.done()}, 50);
})
ws.onerror = t.step_func(function() {assert_unreached()});
});
</script>

View file

@ -0,0 +1,24 @@
<!doctype html>
<title>WebSockets: send('')</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
async_test(function(t){
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/empty-message');
ws.onopen = t.step_func(function(e) {
ws.send('');
})
ws.onmessage = t.step_func(function(e) {
assert_equals(e.data, 'pass');
ws.close();
});
ws.onclose = t.step_func(function(e) {
ws.onclose = t.step_func(function() {assert_unreached()});
setTimeout(function() {t.done()}, 50);
});
ws.onerror = t.step_func(function() {assert_unreached()});
});
</script>

View file

@ -0,0 +1,39 @@
<!doctype html>
<title>WebSockets: sending non-strings</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
async_test(function(outer) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
var stuffToSend = [null, undefined, 1, window, document.body, {}, [], ws, function(){}, new Error()]
var tests = [];
for (var i=0; i<stuffToSend.length; i++) {
tests.push(async_test(document.title + " (" + stuffToSend[i] + ")"));
}
i = 0;
function sendNext() {
if (i === stuffToSend.length) {
outer.done()
ws.close();
} else {
var t = tests[i];
ws.onmessage = t.step_func(function(e) {
assert_equals(e.data, String(stuffToSend[i]));
i++;
sendNext();
t.done();
});
ws.onclose = ws.onerror = t.step_func(function() {assert_unreached()});
ws.send(stuffToSend[i]);
}
}
ws.onopen = function(e) {
sendNext();
}
}, "Constructor succeeds");
</script>

View file

@ -0,0 +1,25 @@
<!doctype html>
<title>WebSockets: sending non-ascii, combining chars and non-BMP</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
async_test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
ws.onopen = t.step_func(function(e) {
ws.send('\u00E5 a\u030A \uD801\uDC7E');
});
ws.onmessage = t.step_func(function(e) {
assert_equals(e.data, '\u00E5 a\u030A \uD801\uDC7E');
ws.onclose = t.step_func(function(e) {
ws.onclose = t.step_func(function() {assert_unreached()});
setTimeout(function() {t.done()}, 50);
})
ws.close();
})
ws.onclose = ws.onerror = t.step_func(function() {assert_unreached()});
});
</script>

View file

@ -0,0 +1,25 @@
<!doctype html>
<title>WebSockets: sending null</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
async_test(function(t){
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
ws.onopen = t.step_func(function(e) {
ws.send(null);
});
ws.onmessage = t.step_func(function(e) {
assert_equals(e.data, 'null');
ws.onclose = t.step_func(function(e) {
ws.onclose = t.step_func(function() {assert_unreached()});
setTimeout(function() {t.done()}, 50);
})
ws.close();
});
ws.onclose = ws.onerror = t.step_func(function() {assert_unreached()});
});
</script>