Update web-platform-tests to revision e8bfc205e36ad699601212cd50083870bad9a75d

This commit is contained in:
Ms2ger 2016-11-14 11:07:09 +01:00
parent 65dd6d4340
commit ccdb0a3458
1428 changed files with 118036 additions and 9786 deletions

View file

@ -93,6 +93,44 @@
});
}, 'Cancelling stream should not affect cloned one');
function testReadableStreamClone(initialBuffer, bufferType)
{
promise_test(function(test) {
var response = new Response(new ReadableStream({start : function(controller) {
controller.enqueue(initialBuffer);
controller.close();
}}));
var clone = response.clone();
var stream1 = response.body;
var stream2 = clone.body;
var buffer;
return stream1.getReader().read().then(function(data) {
assert_false(data.done);
assert_true(data.value === initialBuffer, "Buffer of being-cloned response stream is the same as the original buffer");
return stream2.getReader().read();
}).then(function(data) {
assert_false(data.done);
assert_array_equals(data.value, initialBuffer, "Cloned buffer chunks have the same content");
assert_equals(Object.getPrototypeOf(data.value), Object.getPrototypeOf(initialBuffer), "Cloned buffers have the same type");
assert_true(data.value !== initialBuffer, "Buffer of cloned response stream is a clone of the original buffer");
});
}, "Check response clone use structureClone for teed ReadableStreams (" + bufferType + "chunk)");
}
var arrayBuffer = new ArrayBuffer(16);
testReadableStreamClone(new Int8Array(arrayBuffer, 1), "Int8Array");
testReadableStreamClone(new Int16Array(arrayBuffer, 2, 2), "Int16Array");
testReadableStreamClone(new Int32Array(arrayBuffer), "Int32Array");
testReadableStreamClone(arrayBuffer, "ArrayBuffer");
testReadableStreamClone(new Uint8Array(arrayBuffer), "Uint8Array");
testReadableStreamClone(new Uint8ClampedArray(arrayBuffer), "Uint8ClampedArray");
testReadableStreamClone(new Uint16Array(arrayBuffer, 2), "Uint16Array");
testReadableStreamClone(new Uint32Array(arrayBuffer), "Uint32Array");
testReadableStreamClone(new Float32Array(arrayBuffer), "Float32Array");
testReadableStreamClone(new Float64Array(arrayBuffer), "Float64Array");
testReadableStreamClone(new DataView(arrayBuffer, 2, 8), "DataView");
</script>
</body>
</html>