haikuwebkit/LayoutTests/streams/reference-implementation/bad-strategies.html

125 lines
3.9 KiB
HTML
Raw Permalink Normal View History

[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
<!DOCTYPE html>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<script>
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
// This is updated till https://github.com/whatwg/streams/commit/4ba861e6f60c248060811830e11271c84b439cc3
test(function() {
var theError = new Error('a unique string');
assert_throws(theError, function() {
new WritableStream({}, {
get size() {
throw theError;
},
highWaterMark: 5
});
}, 'construction should re-throw the error');
}, 'Writable stream: throwing strategy.size getter');
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
var test1 = async_test('Writable stream: throwing strategy.size method');
test1.step(function() {
var theError = new Error('a unique string');
var writeCalled = false;
var ws = new WritableStream({ },
{
size: function() {
throw theError;
},
highWaterMark: 5
}
); // Initial construction should not throw.
ws.write('a').then(
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
test1.step_func(function() { assert_unreached('write should not fulfill'); }),
test1.step_func(function(r) {
assert_equals(r, theError, 'write should reject with the thrown error');
writeCalled = true;
})
);
ws.closed.then(
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
test1.step_func(function() { assert_unreached('closed should not fulfill'); }),
test1.step_func(function(r) {
assert_equals(r, theError, 'closed should reject with the thrown error');
assert_true(writeCalled);
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
test1.done();
})
);
});
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
var test2 = async_test('Writable stream: invalid strategy.size return value');
test2.step(function() {
var numberOfCalls = 0;
var elements = [NaN, -Infinity, +Infinity, -1];
var theError = [];
var numberOfCalls = 0;
for (var i = 0; i < elements.length; i++) {
var ws = new WritableStream({},
{
size: function() {
return elements[i];
},
highWaterMark: 5
});
var writeFunction = function(i, r) {
assert_throws(new RangeError(), function() { throw r; }, 'write should reject with a RangeError for ' + elements[i]);
theError[i] = r;
};
ws.write('a').then(
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
test2.step_func(function() { assert_unreached('write should not fulfill'); }),
test2.step_func(writeFunction.bind(this, i))
);
var catchFunction = function(i, e) {
assert_equals(e, theError[i], 'closed should reject with the error for ' + elements[i]);
if (++numberOfCalls, elements.length) {
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
test2.done();
}
};
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
ws.closed.catch(test2.step_func(catchFunction.bind(this, i)));
}
});
test(function() {
var theError = new Error('a unique string');
assert_throws(theError, function() {
new WritableStream({}, {
size: function() {
return 1;
},
get highWaterMark() {
throw theError;
}
});
}, 'construction should re-throw the error');
}, 'Writable stream: throwing strategy.highWaterMark getter');
test(function() {
for (var highWaterMark of [-1, -Infinity]) {
assert_throws(new RangeError(), function() {
new WritableStream({}, {
size: function() {
return 1;
},
highWaterMark
});
}, 'construction should throw a RangeError for ' + highWaterMark);
}
for (var highWaterMark of [NaN, 'foo', {}]) {
assert_throws(new RangeError(), function() {
new WritableStream({}, {
size: function() {
return 1;
},
highWaterMark
});
}, 'construction should throw a TypeError for ' + highWaterMark);
}
}, 'Writable stream: invalid strategy.highWaterMark');
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
</script>