Diff
Modified: trunk/LayoutTests/ChangeLog (187432 => 187433)
--- trunk/LayoutTests/ChangeLog 2015-07-27 08:07:28 UTC (rev 187432)
+++ trunk/LayoutTests/ChangeLog 2015-07-27 08:14:53 UTC (rev 187433)
@@ -1,3 +1,18 @@
+2015-07-27 Xabier Rodriguez Calvar <calva...@igalia.com>
+
+ [Streams API] Strategy tests need sync with the reference
+ https://bugs.webkit.org/show_bug.cgi?id=147267
+
+ Reviewed by Sam Weinig.
+
+ The reference accepted a two new tests for the constructor and another for the size method for both strategies
+ that we need to bring to WebKit to ensure compliance. Expectations updated accordingly.
+
+ * streams/reference-implementation/byte-length-queuing-strategy-expected.txt:
+ * streams/reference-implementation/byte-length-queuing-strategy.html:
+ * streams/reference-implementation/count-queuing-strategy-expected.txt:
+ * streams/reference-implementation/count-queuing-strategy.html:
+
2015-07-25 Alexey Proskuryakov <a...@apple.com>
REGRESSION (r186569): media/restore-from-page-cache.html is very flaky
Modified: trunk/LayoutTests/streams/reference-implementation/byte-length-queuing-strategy-expected.txt (187432 => 187433)
--- trunk/LayoutTests/streams/reference-implementation/byte-length-queuing-strategy-expected.txt 2015-07-27 08:07:28 UTC (rev 187432)
+++ trunk/LayoutTests/streams/reference-implementation/byte-length-queuing-strategy-expected.txt 2015-07-27 08:14:53 UTC (rev 187433)
@@ -1,5 +1,7 @@
PASS Can construct a ByteLengthQueuingStrategy with a valid high water mark
PASS Can construct a ByteLengthQueuingStrategy with any value as its high water mark
+PASS ByteLengthQueuingStrategy constructor behaves as expected with wrong arguments
+PASS ByteLengthQueuingStrategy size behaves as expected with wrong arguments
PASS ByteLengthQueuingStrategy instances have the correct properties
Modified: trunk/LayoutTests/streams/reference-implementation/byte-length-queuing-strategy.html (187432 => 187433)
--- trunk/LayoutTests/streams/reference-implementation/byte-length-queuing-strategy.html 2015-07-27 08:07:28 UTC (rev 187432)
+++ trunk/LayoutTests/streams/reference-implementation/byte-length-queuing-strategy.html 2015-07-27 08:14:53 UTC (rev 187433)
@@ -16,6 +16,48 @@
}, 'Can construct a ByteLengthQueuingStrategy with any value as its high water mark');
test(function() {
+ var highWaterMark = 1;
+ var highWaterMarkObjectGetter = {
+ get highWaterMark() { return highWaterMark; },
+ };
+ var error = new Error('wow!');
+ var highWaterMarkObjectGetterThrowing = {
+ get highWaterMark() { throw error; },
+ };
+ assert_throws(new TypeError(), function() { new ByteLengthQueuingStrategy(); }, 'construction fails with undefined');
+ assert_throws(new TypeError(), function() { new ByteLengthQueuingStrategy(null); }, 'construction fails with null');
+ new ByteLengthQueuingStrategy('potato'); // Construction succeeds with a random non-object type.
+ new ByteLengthQueuingStrategy({}); // Construction succeeds with an object without a highWaterMark property.
+ new ByteLengthQueuingStrategy(highWaterMarkObjectGetter); // Construction succeeds with an object with a highWaterMark getter.
+ assert_throws(error, function() { new ByteLengthQueuingStrategy(highWaterMarkObjectGetterThrowing); },
+ 'construction fails with an object with a throwing highWaterMark getter');
+}, 'ByteLengthQueuingStrategy constructor behaves as expected with wrong arguments');
+
+test(function() {
+ var size = 1024;
+ var chunk = { byteLength: size };
+ var chunkGetter = {
+ get byteLength() { return size; },
+ }
+ var error = new Error('wow!');
+ var chunkGetterThrowing = {
+ get byteLength() { throw error; },
+ }
+ assert_throws(new TypeError(), function() { ByteLengthQueuingStrategy.prototype.size(); }, 'size fails with undefined');
+ assert_throws(new TypeError(), function() { ByteLengthQueuingStrategy.prototype.size(null); }, 'size fails with null');
+ assert_equals(ByteLengthQueuingStrategy.prototype.size('potato'), undefined,
+ 'size succeeds with undefined with a random non-object type');
+ assert_equals(ByteLengthQueuingStrategy.prototype.size({}), undefined,
+ 'size succeeds with undefined with an object without hwm property');
+ assert_equals(ByteLengthQueuingStrategy.prototype.size(chunk), size,
+ 'size succeeds with the right amount with an object with a hwm');
+ assert_equals(ByteLengthQueuingStrategy.prototype.size(chunkGetter), size,
+ 'size succeeds with the right amount with an object with a hwm getter');
+ assert_throws(error, function() { ByteLengthQueuingStrategy.prototype.size(chunkGetterThrowing); },
+ 'size fails with the error thrown by the getter');
+}, 'ByteLengthQueuingStrategy size behaves as expected with wrong arguments');
+
+test(function() {
var strategy = new ByteLengthQueuingStrategy({ highWaterMark: 4 });
assert_object_equals(Object.getOwnPropertyDescriptor(strategy, 'highWaterMark'),
Modified: trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy-expected.txt (187432 => 187433)
--- trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy-expected.txt 2015-07-27 08:07:28 UTC (rev 187432)
+++ trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy-expected.txt 2015-07-27 08:14:53 UTC (rev 187433)
@@ -1,6 +1,8 @@
PASS Can construct a CountQueuingStrategy with a valid high water mark
PASS Can construct a CountQueuingStrategy with any value as its high water mark
+PASS CountQueuingStrategy constructor behaves as expected with wrong arguments
+PASS CountQueuingStrategy size behaves as expected with wrong arguments
PASS CountQueuingStrategy instances have the correct properties
PASS Can construct a readable stream with a valid CountQueuingStrategy
PASS Correctly governs the return value of a ReadableStream's enqueue function (HWM = 0)
Modified: trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy.html (187432 => 187433)
--- trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy.html 2015-07-27 08:07:28 UTC (rev 187432)
+++ trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy.html 2015-07-27 08:14:53 UTC (rev 187433)
@@ -16,6 +16,43 @@
}, 'Can construct a CountQueuingStrategy with any value as its high water mark');
test(function() {
+ var highWaterMark = 1;
+ var highWaterMarkObjectGetter = {
+ get highWaterMark() { return highWaterMark; },
+ };
+ var error = new Error('wow!');
+ var highWaterMarkObjectGetterThrowing = {
+ get highWaterMark() { throw error; },
+ };
+ assert_throws(new TypeError(), function() { new CountQueuingStrategy(); }, 'construction fails with undefined');
+ assert_throws(new TypeError(), function() { new CountQueuingStrategy(null); }, 'construction fails with null');
+ new CountQueuingStrategy('potato'); // Construction succeeds with a random non-object type.
+ new CountQueuingStrategy({}); // Construction succeeds with an object without a highWaterMark property.
+ new CountQueuingStrategy(highWaterMarkObjectGetter); // Construction succeeds with an object with a highWaterMark getter.
+ assert_throws(error, function() { new CountQueuingStrategy(highWaterMarkObjectGetterThrowing); },
+ 'construction fails with an object with a throwing highWaterMark getter');
+}, 'CountQueuingStrategy constructor behaves as expected with wrong arguments');
+
+test(function() {
+ var size = 1024;
+ var chunk = { byteLength: size };
+ var chunkGetter = {
+ get byteLength() { return size; },
+ }
+ var error = new Error('wow!');
+ var chunkGetterThrowing = {
+ get byteLength() { throw error; },
+ }
+ assert_equals(CountQueuingStrategy.prototype.size(), 1, 'size returns 1 with undefined');
+ assert_equals(CountQueuingStrategy.prototype.size(null), 1, 'size returns 1 with null');
+ assert_equals(CountQueuingStrategy.prototype.size('potato'), 1, 'size returns 1 with non-object type');
+ assert_equals(CountQueuingStrategy.prototype.size({}), 1, 'size returns 1 with empty object');
+ assert_equals(CountQueuingStrategy.prototype.size(chunk), 1, 'size returns 1 with a chunk');
+ assert_equals(CountQueuingStrategy.prototype.size(chunkGetter), 1, 'size returns 1 with chunk getter');
+ assert_equals(CountQueuingStrategy.prototype.size(chunkGetterThrowing), 1, 'size returns 1 with chunk getter that throws');
+}, 'CountQueuingStrategy size behaves as expected with wrong arguments');
+
+test(function() {
var strategy = new CountQueuingStrategy({ highWaterMark: 4 });
assert_object_equals(Object.getOwnPropertyDescriptor(strategy, 'highWaterMark'),