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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/streams/readable-streams/garbage-collection.js

Issue 2808853003: Remove Blink copies of readable-streams layout tests (Closed)
Patch Set: Restore rs-utils.js as it is used by fetch tests Created 3 years, 8 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
OLDNEW
(Empty)
1 'use strict';
2
3 if (self.importScripts) {
4 self.importScripts('../resources/test-utils.js');
5 self.importScripts('/resources/testharness.js');
6 }
7
8 promise_test(() => {
9
10 let controller;
11 new ReadableStream({
12 start(c) {
13 controller = c;
14 }
15 });
16
17 garbageCollect();
18
19 return delay(50).then(() => {
20 controller.close();
21 assert_throws(new TypeError(), () => controller.close(), 'close should throw a TypeError the second time');
22 assert_throws(new TypeError(), () => controller.error(), 'error should throw a TypeError on a closed stream');
23 });
24
25 }, 'ReadableStreamController methods should continue working properly when scrip ts lose their reference to the ' +
26 'readable stream');
27
28 promise_test(() => {
29
30 let controller;
31
32 const closedPromise = new ReadableStream({
33 start(c) {
34 controller = c;
35 }
36 }).getReader().closed;
37
38 garbageCollect();
39
40 return delay(50).then(() => controller.close()).then(() => closedPromise);
41
42 }, 'ReadableStream closed promise should fulfill even if the stream and reader J S references are lost');
43
44 promise_test(t => {
45
46 const theError = new Error('boo');
47 let controller;
48
49 const closedPromise = new ReadableStream({
50 start(c) {
51 controller = c;
52 }
53 }).getReader().closed;
54
55 garbageCollect();
56
57 return delay(50).then(() => controller.error(theError))
58 .then(() => promise_rejects(t, theError, closedPromise));
59
60 }, 'ReadableStream closed promise should reject even if stream and reader JS ref erences are lost');
61
62 promise_test(() => {
63
64 const rs = new ReadableStream({});
65
66 rs.getReader();
67
68 garbageCollect();
69
70 return delay(50).then(() => assert_throws(new TypeError(), () => rs.getReader( ),
71 'old reader should still be locking the stream even after garbage collection '));
72
73 }, 'Garbage-collecting a ReadableStreamReader should not unlock its stream');
74
75 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698