LayoutTests/ChangeLog

 12015-09-22 Xabier Rodriguez Calvar <calvaris@igalia.com>
 2
 3 [Streams API] bad underlying sinks tests about writable streams
 4 https://bugs.webkit.org/show_bug.cgi?id=148295
 5
 6 Reviewed by Darin Adler.
 7
 8 * streams/reference-implementation/bad-underlying-sinks-expected.txt: Added.
 9 * streams/reference-implementation/bad-underlying-sinks.html: Added.
 10
1112015-09-23 ChangSeok Oh <changseok.oh@collabora.com>
212
313 [GTK] media/media-controls-timeline-updates.html timeouts

LayoutTests/streams/reference-implementation/bad-underlying-sinks-expected.txt

 1
 2FAIL Underlying sink: throwing start getter assert_throws: function "function () {
 3 new WritableStream({
 4 ge..." threw object "ReferenceError: Can't find variable: WritableStream" ("ReferenceError") expected object "Error: a unique string" ("Error")
 5FAIL Underlying sink: throwing start method assert_throws: function "function () {
 6 new WritableStream({
 7 st..." threw object "ReferenceError: Can't find variable: WritableStream" ("ReferenceError") expected object "Error: a unique string" ("Error")
 8FAIL Underlying sink: throwing write getter Can't find variable: WritableStream
 9FAIL Underlying sink: throwing write method Can't find variable: WritableStream
 10FAIL Underlying sink: throwing abort getter Can't find variable: WritableStream
 11FAIL Underlying sink: throwing abort method Can't find variable: WritableStream
 12FAIL Underlying sink: throwing close getter Can't find variable: WritableStream
 13FAIL Underlying sink: throwing close method Can't find variable: WritableStream
 14

LayoutTests/streams/reference-implementation/bad-underlying-sinks.html

 1<!DOCTYPE html>
 2<script src='../../resources/testharness.js'></script>
 3<script src='../../resources/testharnessreport.js'></script>
 4<script src='resources/streams-utils.js'></script>
 5<script>
 6// This is updated till https://github.com/whatwg/streams/commit/ec5ffa036308d9f6350d2946560d48cdbf090939
 7
 8test(function() {
 9 var theError = new Error('a unique string');
 10
 11 assert_throws(theError, function() {
 12 new WritableStream({
 13 get start() {
 14 throw theError;
 15 }
 16 });
 17 });
 18}, 'Underlying sink: throwing start getter');
 19
 20test(function() {
 21 var theError = new Error('a unique string');
 22
 23 assert_throws(theError, function() {
 24 new WritableStream({
 25 start: function() {
 26 throw theError;
 27 }
 28 });
 29 });
 30}, 'Underlying sink: throwing start method');
 31
 32var test1 = async_test('Underlying sink: throwing write getter');
 33test1.step(function() {
 34 var writeRejected = false;
 35
 36 var theError = new Error('a unique string');
 37 var ws = new WritableStream({
 38 get write() {
 39 throw theError;
 40 }
 41 });
 42
 43 ws.write('a').then(
 44 test1.step_func(function() { assert_unreached('write should not fulfill'); }),
 45 test1.step_func(function(r) {
 46 assert_equals(r, theError, 'write should reject with the thrown error');
 47 writeRejected = true;
 48 })
 49 );
 50
 51 ws.closed.then(
 52 test1.step_func(function() { assert_unreached('closed should not fulfill'); }),
 53 test1.step_func(function(r) {
 54 assert_equals(r, theError, 'closed should reject with the thrown error');
 55 assert_true(writeRejected);
 56 test1.done();
 57 })
 58 );
 59});
 60
 61var test2 = async_test('Underlying sink: throwing write method');
 62test2.step(function() {
 63 var writeRejected = false;
 64
 65 var theError = new Error('a unique string');
 66 var ws = new WritableStream({
 67 write: function() {
 68 throw theError;
 69 }
 70 });
 71
 72 ws.write('a').then(
 73 test2.step_func(function() { assert_unreached('write should not fulfill'); }),
 74 test2.step_func(function(r) {
 75 assert_equals(r, theError, 'write should reject with the thrown error');
 76 writeRejected = true;
 77 })
 78 );
 79
 80 ws.closed.then(
 81 test2.step_func(function() { assert_unreached('closed should not fulfill'); }),
 82 test2.step_func(function(r) {
 83 assert_equals(r, theError, 'closed should reject with the thrown error');
 84 assert_true(writeRejected);
 85 test2.done();
 86 })
 87 );
 88});
 89
 90var test3 = async_test('Underlying sink: throwing abort getter');
 91test3.step(function() {
 92 var closedRejected = false;
 93 var theError = new Error('a unique string');
 94 var abortReason = new Error('different string');
 95 var ws = new WritableStream({
 96 get abort() {
 97 throw theError;
 98 }
 99 });
 100
 101 ws.abort(abortReason).then(
 102 test3.step_func(function() { assert_unreached('abort should not fulfill'); }),
 103 test3.step_func(function(r) {
 104 assert_equals(r, theError, 'abort should reject with the abort reason');
 105 assert_true(closedRejected);
 106 test3.done();
 107 })
 108 );
 109
 110 ws.closed.then(
 111 test3.step_func(function() { assert_unreached('closed should not fulfill'); }),
 112 test3.step_func(function(r) {
 113 assert_equals(r, abortReason, 'closed should reject with the thrown error');
 114 closedRejected = true;
 115 })
 116 );
 117});
 118
 119var test4 = async_test('Underlying sink: throwing abort method');
 120test4.step(function() {
 121 var closedRejected = false;
 122 var theError = new Error('a unique string');
 123 var abortReason = new Error('different string');
 124 var ws = new WritableStream({
 125 abort: function() {
 126 throw theError;
 127 }
 128 });
 129
 130 ws.abort(abortReason).then(
 131 test4.step_func(function() { assert_unreached('abort should not fulfill'); }),
 132 test4.step_func(function(r) {
 133 assert_equals(r, theError, 'abort should reject with the abort reason');
 134 assert_true(closedRejected);
 135 test4.done();
 136 })
 137 );
 138
 139 ws.closed.then(
 140 test4.step_func(function() { assert_unreached('closed should not fulfill'); }),
 141 test4.step_func(function(r) {
 142 assert_equals(r, abortReason, 'closed should reject with the thrown error');
 143 closedRejected = true;
 144 })
 145 );
 146});
 147
 148var test5 = async_test('Underlying sink: throwing close getter');
 149test5.step(function() {
 150 var theError = new Error('a unique string');
 151 var ws = new WritableStream({
 152 get close() {
 153 throw theError;
 154 }
 155 });
 156
 157 ws.close().then(
 158 test5.step_func(function() { assert_unreached('close should not fulfill'); }),
 159 test5.step_func(function(r) {
 160 assert_equals(r, theError, 'close should reject with the thrown error');
 161 test5.done();
 162 })
 163 );
 164});
 165
 166var test6 = async_test('Underlying sink: throwing close method');
 167test6.step(function() {
 168 var theError = new Error('a unique string');
 169 var ws = new WritableStream({
 170 close: function() {
 171 throw theError;
 172 }
 173 });
 174
 175 ws.close().then(
 176 test6.step_func(function() { assert_unreached('close should not fulfill'); }),
 177 test6.step_func(function(r) {
 178 assert_equals(r, theError, 'close should reject with the thrown error');
 179 test6.done();
 180 })
 181 );
 182});
 183</script>