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

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

Issue 2644473002: Reduce the number of iterations in write.js (Closed)
Patch Set: Rebase Created 3 years, 11 months 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
« no previous file with comments | « third_party/WebKit/LayoutTests/SlowTests ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 function writeArrayToStream(array, writableStreamWriter) { 9 function writeArrayToStream(array, writableStreamWriter) {
10 array.forEach(chunk => writableStreamWriter.write(chunk)); 10 array.forEach(chunk => writableStreamWriter.write(chunk));
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 }); 159 });
160 160
161 const writer = ws.getWriter(); 161 const writer = ws.getWriter();
162 162
163 return promise_rejects(t, thrownError, writer.write('a'), 'write() should reje ct with thrownError') 163 return promise_rejects(t, thrownError, writer.write('a'), 'write() should reje ct with thrownError')
164 .then(() => promise_rejects(t, new TypeError(), writer.close(), 'close() s hould be rejected')); 164 .then(() => promise_rejects(t, new TypeError(), writer.close(), 'close() s hould be rejected'));
165 }, 'when sink\'s write throws an error, the stream should become errored and the promise should reject'); 165 }, 'when sink\'s write throws an error, the stream should become errored and the promise should reject');
166 166
167 promise_test(() => { 167 promise_test(() => {
168 const numberOfWrites = 10000; 168 const numberOfWrites = 1000;
169 169
170 let resolveFirstWritePromise; 170 let resolveFirstWritePromise;
171 let writeCount = 0; 171 let writeCount = 0;
172 const ws = new WritableStream({ 172 const ws = new WritableStream({
173 write() { 173 write() {
174 ++writeCount; 174 ++writeCount;
175 if (!resolveFirstWritePromise) { 175 if (!resolveFirstWritePromise) {
176 return new Promise(resolve => { 176 return new Promise(resolve => {
177 resolveFirstWritePromise = resolve; 177 resolveFirstWritePromise = resolve;
178 }); 178 });
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 thenCalled = true; 219 thenCalled = true;
220 onFulfilled(); 220 onFulfilled();
221 } 221 }
222 }; 222 };
223 } 223 }
224 }); 224 });
225 return ws.getWriter().write('a').then(() => assert_true(thenCalled, 'thenCalle d should be true')); 225 return ws.getWriter().write('a').then(() => assert_true(thenCalled, 'thenCalle d should be true'));
226 }, 'returning a thenable from write() should work'); 226 }, 'returning a thenable from write() should work');
227 227
228 done(); 228 done();
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/SlowTests ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698