Skip to content

Commit a9f3e1a

Browse files
committed
[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
1 parent 7ec439f commit a9f3e1a

33 files changed

Lines changed: 1712 additions & 1145 deletions

LayoutTests/ChangeLog

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,64 @@
1+
2015-06-16 Youenn Fablet <youenn.fablet@crf.canon.fr> and Xabier Rodriguez Calvar <calvaris@igalia.com>
2+
3+
[Streams API] Sync tests with spec
4+
https://bugs.webkit.org/show_bug.cgi?id=145839
5+
6+
Reviewed by Darin Adler.
7+
8+
Considered all changes in the spec tests and brought them to WebKit.
9+
10+
Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the
11+
tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around
12+
because they were just moved at the spec or integrated from the changes we submitted, which was substantially
13+
important as it allowed us to remove some of our custom tests that are now covered by the spec ones.
14+
15+
* resources/gc.js: Added warning about using gcRec, results might not be reliable.
16+
* streams/readable-stream-controller-error-expected.txt:
17+
* streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference
18+
implementation. Something we will address.
19+
* streams/readable-stream-expected.txt: Removed.
20+
* streams/readable-stream-gc.html: Renumbered.
21+
* streams/readable-stream-reader-expected.txt: Removed.
22+
* streams/readable-stream-reader-read.html: Renumbered.
23+
* streams/readable-stream-reader.html: Removed.
24+
* streams/readable-stream.html: Removed.
25+
* streams/reference-implementation/bad-strategies-expected.txt: Added.
26+
* streams/reference-implementation/bad-strategies.html: Added.
27+
* streams/reference-implementation/bad-underlying-sources-expected.txt:
28+
* streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations.
29+
* streams/reference-implementation/brand-checks-expected.txt:
30+
* streams/reference-implementation/brand-checks.html: Updated from spec and expectations.
31+
* streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added.
32+
* streams/reference-implementation/byte-length-queuing-strategy.html: Added.
33+
* streams/reference-implementation/count-queuing-strategy-expected.txt:
34+
* streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations.
35+
* streams/reference-implementation/readable-stream-cancel-expected.txt:
36+
* streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected
37+
timeouts to try to overcome problems in slower bots.
38+
* streams/reference-implementation/readable-stream-expected.txt:
39+
* streams/reference-implementation/readable-stream-reader-expected.txt:
40+
* streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations.
41+
* streams/reference-implementation/readable-stream-tee-expected.txt: Added.
42+
* streams/reference-implementation/readable-stream-tee.html: Added.
43+
* streams/reference-implementation/readable-stream-templated-expected.txt:
44+
* streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations.
45+
* streams/reference-implementation/readable-stream.html: Updated from spec and expectations.
46+
* streams/reference-implementation/resources/byte-length-queuing-strategy.js:
47+
(ByteLengthQueuingStrategy): Updated from spec.
48+
(typeIsObject): Deleted.
49+
(ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted.
50+
* streams/reference-implementation/resources/count-queuing-strategy.js:
51+
(CountQueuingStrategy): Updated from spec.
52+
(typeIsObject): Deleted.
53+
(CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted.
54+
* streams/reference-implementation/resources/streams-utils.js:
55+
(RandomPushSource.prototype.readStart.writeChunk):
56+
(RandomPushSource.prototype.readStart): Renamed stream as source
57+
(.stream.new.ReadableStream):
58+
(sequentialReadableStream): Updated from spec.
59+
(typeIsObject): Added.
60+
(createDataProperty): Added.
61+
162
2015-06-16 Alexey Proskuryakov <ap@apple.com>
263

364
Fix a lint error by removing an obsolete expectation - this test doesn't fail

LayoutTests/resources/gc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ if (!window.gc)
77
{
88
if (window.GCController)
99
return GCController.collect();
10+
11+
console.warn('Tests are running without the ability to do manual garbage collection. They will still work, but coverage will be suboptimal.');
1012
function gcRec(n) {
1113
if (n < 1)
1214
return {};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
PASS Erroring a ReadableStream should reject ReadableStreamReader close promise
33
PASS Erroring a ReadableStream should reject ReadableStreamReader close promise
4-
PASS Erroring a ReadableStream without any value
4+
FAIL Erroring a ReadableStream without any value assert_equals: expected (undefined) undefined but got (object) object "Error: Error function called."
55

LayoutTests/streams/readable-stream-controller-error.html

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,28 @@
22
<script src='../resources/testharness.js'></script>
33
<script src='../resources/testharnessreport.js'></script>
44
<script>
5-
6-
t2 = async_test('Erroring a ReadableStream should reject ReadableStreamReader close promise');
7-
t2.step(function() {
5+
var test1 = async_test('Erroring a ReadableStream should reject ReadableStreamReader close promise');
6+
test1.step(function() {
87
var controller;
98
var rs = new ReadableStream({
109
start: function(c) {
1110
controller = c;
1211
}
1312
});
1413

15-
rs.getReader().closed.then(t2.step_func(function() {
14+
rs.getReader().closed.then(test1.step_func(function() {
1615
assert_unreached("closed promise should not be resolved when stream is errored");
17-
}), t2.step_func(function(err) {
16+
}), test1.step_func(function(err) {
1817
assert_equals(rsError, err);
19-
t2.done();
18+
test1.done();
2019
}));
2120

2221
var rsError = "my error";
2322
controller.error(rsError);
2423
});
2524

26-
t3 = async_test('Erroring a ReadableStream should reject ReadableStreamReader close promise');
27-
t3.step(function() {
25+
var test2 = async_test('Erroring a ReadableStream should reject ReadableStreamReader close promise');
26+
test2.step(function() {
2827
var controller;
2928
var rs = new ReadableStream({
3029
start: function(c) {
@@ -37,33 +36,30 @@
3736

3837
// Let's call getReader twice to ensure that stream is not locked to a reader.
3938
rs.getReader();
40-
rs.getReader().closed.then(t3.step_func(function() {
39+
rs.getReader().closed.then(test2.step_func(function() {
4140
assert_unreached("closed promise should not be resolved when stream is errored");
42-
}), t3.step_func(function(err) {
41+
}), test2.step_func(function(err) {
4342
assert_equals(rsError, err);
44-
t3.done();
43+
test2.done();
4544
}));
4645
});
4746

48-
t4 = async_test('Erroring a ReadableStream without any value');
49-
t4.step(function() {
47+
var test3 = async_test('Erroring a ReadableStream without any value');
48+
test3.step(function() {
5049
var controller;
5150
var rs = new ReadableStream({
5251
start: function(c) {
5352
controller = c;
5453
}
5554
});
5655

57-
rs.getReader().closed.then(t3.step_func(function() {
56+
rs.getReader().closed.then(test3.step_func(function() {
5857
assert_unreached("closed promise should not be resolved when stream is errored");
59-
}), t4.step_func(function(err) {
60-
// Error generated by JS engine.
61-
assert_true(typeof err == 'object');
62-
t4.done();
58+
}), test3.step_func(function(err) {
59+
assert_equals(err, undefined);
60+
test3.done();
6361
}));
6462

6563
controller.error();
6664
});
67-
68-
6965
</script>

LayoutTests/streams/readable-stream-expected.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

LayoutTests/streams/readable-stream-gc.html

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<script src='../resources/testharnessreport.js'></script>
44
<script src='../resources/gc.js'></script>
55
<script>
6-
76
function garbageCollectAndDo(task)
87
{
98
var timeout = 50;
@@ -16,53 +15,52 @@
1615
setTimeout(task, timeout);
1716
}
1817

19-
t1 = async_test('Readable stream controller methods should continue working properly when scripts are loosing reference to the readable stream');
20-
t1.step(function() {
18+
var test1 = async_test('Readable stream controller methods should continue working properly when scripts are loosing reference to the readable stream');
19+
test1.step(function() {
2120
var controller;
2221
new ReadableStream({
2322
start: function(c) {
2423
controller = c;
2524
}
2625
});
2726

28-
garbageCollectAndDo(t1.step_func(function() {
27+
garbageCollectAndDo(test1.step_func(function() {
2928
controller.close();
3029
assert_throws(new TypeError(), function() { controller.close(); });
3130
assert_throws(new TypeError(), function() { controller.error(); });
32-
t1.done();
31+
test1.done();
3332
}));
3433
});
3534

36-
t2 = async_test('Readable stream closed promise should resolve even if stream and reader JS references are lost');
37-
t2.step(function() {
35+
var test2 = async_test('Readable stream closed promise should resolve even if stream and reader JS references are lost');
36+
test2.step(function() {
3837
var controller;
3938
new ReadableStream({
4039
start: function(c) {
4140
controller = c;
4241
}
43-
}).getReader().closed.then(t2.step_func(function() {
44-
t2.done();
42+
}).getReader().closed.then(test2.step_func(function() {
43+
test2.done();
4544
}));
4645

47-
garbageCollectAndDo(t2.step_func(function() {
46+
garbageCollectAndDo(test2.step_func(function() {
4847
controller.close();
4948
}));
5049
});
5150

52-
t3 = async_test('Readable stream closed promise should reject even if stream and reader JS references are lost');
53-
t3.step(function() {
51+
var test3 = async_test('Readable stream closed promise should reject even if stream and reader JS references are lost');
52+
test3.step(function() {
5453
var controller;
5554
new ReadableStream({
5655
start: function(c) {
5756
controller = c;
5857
}
59-
}).getReader().closed.catch(t3.step_func(function() {
60-
t3.done();
58+
}).getReader().closed.catch(test3.step_func(function() {
59+
test3.done();
6160
}));
6261

63-
garbageCollectAndDo(t3.step_func(function() {
62+
garbageCollectAndDo(test3.step_func(function() {
6463
controller.error();
6564
}));
6665
});
67-
6866
</script>

LayoutTests/streams/readable-stream-reader-expected.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)