Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/aborting.js

Issue 2500833002: Import latest WritableStream tests from upstream (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 'use strict'; 1 'use strict';
2 2
3 if (self.importScripts) { 3 if (self.importScripts) {
4 self.importScripts('/resources/testharness.js'); 4 self.importScripts('/resources/testharness.js');
5 self.importScripts('../resources/test-utils.js'); 5 self.importScripts('../resources/test-utils.js');
6 self.importScripts('../resources/recording-streams.js'); 6 self.importScripts('../resources/recording-streams.js');
7 } 7 }
8 8
9 const error1 = new Error('error1'); 9 const error1 = new Error('error1');
10 error1.name = 'error1'; 10 error1.name = 'error1';
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 promise_test(t => { 171 promise_test(t => {
172 const ws = new WritableStream({ 172 const ws = new WritableStream({
173 close() { 173 close() {
174 return new Promise(() => { }); // forever-pending 174 return new Promise(() => { }); // forever-pending
175 } 175 }
176 }); 176 });
177 const writer = ws.getWriter(); 177 const writer = ws.getWriter();
178 178
179 writer.close(); 179 writer.close();
180 180
181 return delay(20).then(() => { 181 return delay(0).then(() => {
182 writer.abort(error1); 182 writer.abort(error1);
183 }) 183 })
184 .then(() => promise_rejects(t, new TypeError(), writer.closed, 'closed should reject with a TypeError')); 184 .then(() => promise_rejects(t, new TypeError(), writer.closed, 'closed should reject with a TypeError'));
185 }, 'Closing a WritableStream and aborting it while it closes causes the stream t o error'); 185 }, 'Closing a WritableStream and aborting it while it closes causes the stream t o error');
186 186
187 promise_test(() => { 187 promise_test(() => {
188 const ws = new WritableStream(); 188 const ws = new WritableStream();
189 const writer = ws.getWriter(); 189 const writer = ws.getWriter();
190 190
191 writer.close(); 191 writer.close();
(...skipping 22 matching lines...) Expand all
214 onFulfilled(); 214 onFulfilled();
215 } 215 }
216 }; 216 };
217 } 217 }
218 }); 218 });
219 const writer = ws.getWriter(); 219 const writer = ws.getWriter();
220 return writer.abort().then(() => assert_true(thenCalled, 'then() should be cal led')); 220 return writer.abort().then(() => assert_true(thenCalled, 'then() should be cal led'));
221 }, 'returning a thenable from abort() should work'); 221 }, 'returning a thenable from abort() should work');
222 222
223 done(); 223 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698