<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[182783] trunk/LayoutTests</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/182783">182783</a></dd>
<dt>Author</dt> <dd>calvaris@igalia.com</dd>
<dt>Date</dt> <dd>2015-04-14 01:20:40 -0700 (Tue, 14 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Sync Streams API tests with spec
https://bugs.webkit.org/show_bug.cgi?id=143669

Reviewed by Darin Adler.

Some tests were moved from the spec tests to our custom ones
because they were not approved (yet, or they won't be).

Some nuances from the spec tests were also fixed.

* streams/readable-stream-expected.txt: Added.
* streams/readable-stream-reader-expected.txt: Added.
* streams/readable-stream-reader.html: Added.
* streams/readable-stream.html: Added.
* streams/reference-implementation/readable-stream-expected.txt:
* streams/reference-implementation/readable-stream-reader-expected.txt:
* streams/reference-implementation/readable-stream-reader.html:
* streams/reference-implementation/readable-stream.html: Nuances
fixed and tests moved to custom.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsstreamsreferenceimplementationreadablestreamexpectedtxt">trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstreamsreferenceimplementationreadablestreamreaderexpectedtxt">trunk/LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstreamsreferenceimplementationreadablestreamreaderhtml">trunk/LayoutTests/streams/reference-implementation/readable-stream-reader.html</a></li>
<li><a href="#trunkLayoutTestsstreamsreferenceimplementationreadablestreamhtml">trunk/LayoutTests/streams/reference-implementation/readable-stream.html</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsstreamsreadablestreamexpectedtxt">trunk/LayoutTests/streams/readable-stream-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstreamsreadablestreamreaderexpectedtxt">trunk/LayoutTests/streams/readable-stream-reader-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstreamsreadablestreamreaderhtml">trunk/LayoutTests/streams/readable-stream-reader.html</a></li>
<li><a href="#trunkLayoutTestsstreamsreadablestreamhtml">trunk/LayoutTests/streams/readable-stream.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (182782 => 182783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-04-14 05:48:23 UTC (rev 182782)
+++ trunk/LayoutTests/ChangeLog        2015-04-14 08:20:40 UTC (rev 182783)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-04-14  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt; and Xabier Rodriguez Calvar &lt;calvaris@igalia.com&gt;
+
+        Sync Streams API tests with spec
+        https://bugs.webkit.org/show_bug.cgi?id=143669
+
+        Reviewed by Darin Adler.
+
+        Some tests were moved from the spec tests to our custom ones
+        because they were not approved (yet, or they won't be).
+
+        Some nuances from the spec tests were also fixed.
+
+        * streams/readable-stream-expected.txt: Added.
+        * streams/readable-stream-reader-expected.txt: Added.
+        * streams/readable-stream-reader.html: Added.
+        * streams/readable-stream.html: Added.
+        * streams/reference-implementation/readable-stream-expected.txt:
+        * streams/reference-implementation/readable-stream-reader-expected.txt:
+        * streams/reference-implementation/readable-stream-reader.html:
+        * streams/reference-implementation/readable-stream.html: Nuances
+        fixed and tests moved to custom.
+
</ins><span class="cx"> 2015-04-13  Manuel Rego Casasnovas  &lt;rego@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Grid Layout] Columns set in percentages collapse to auto width
</span></span></pre></div>
<a id="trunkLayoutTestsstreamsreadablestreamexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/streams/readable-stream-expected.txt (0 => 182783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/streams/readable-stream-expected.txt                                (rev 0)
+++ trunk/LayoutTests/streams/readable-stream-expected.txt        2015-04-14 08:20:40 UTC (rev 182783)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS ReadableStream can't be constructed with garbage 
+FAIL ReadableStream start should be called with the proper parameters null is not an object (evaluating 'Object.getOwnPropertyNames(Object.getPrototypeOf(controller))')
+FAIL ReadableStream start controller parameter should be updatable null is not an object (evaluating 'Object.getOwnPropertyNames(Object.getPrototypeOf(controller))')
+PASS ReadableStream should be able to call start method within prototype chain of its source 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstreamsreadablestreamreaderexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/streams/readable-stream-reader-expected.txt (0 => 182783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/streams/readable-stream-reader-expected.txt                                (rev 0)
+++ trunk/LayoutTests/streams/readable-stream-reader-expected.txt        2015-04-14 08:20:40 UTC (rev 182783)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Collecting a ReadableStreamReader should not unlock its stream 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstreamsreadablestreamreaderhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/streams/readable-stream-reader.html (0 => 182783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/streams/readable-stream-reader.html                                (rev 0)
+++ trunk/LayoutTests/streams/readable-stream-reader.html        2015-04-14 08:20:40 UTC (rev 182783)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script src='../resources/testharness.js'&gt;&lt;/script&gt;
+&lt;script src='../resources/testharnessreport.js'&gt;&lt;/script&gt;
+&lt;script src='../resources/gc.js'&gt;&lt;/script&gt;
+&lt;script&gt;
+test(function() {
+    var rs = new ReadableStream({});
+    rs.getReader();
+    window.gc();
+    assert_throws(new TypeError(), function() { rs.getReader(); }, 'old reader should still be locking a new one even after garbage collection');
+}, 'Collecting a ReadableStreamReader should not unlock its stream');
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsstreamsreadablestreamhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/streams/readable-stream.html (0 => 182783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/streams/readable-stream.html                                (rev 0)
+++ trunk/LayoutTests/streams/readable-stream.html        2015-04-14 08:20:40 UTC (rev 182783)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script src='../resources/testharness.js'&gt;&lt;/script&gt;
+&lt;script src='../resources/testharnessreport.js'&gt;&lt;/script&gt;
+&lt;script&gt;
+test(function() {
+    assert_throws(new TypeError(), function() {
+        new ReadableStream(null);
+    }, 'constructor should throw when the source is null');
+}, 'ReadableStream can\'t be constructed with garbage');
+
+test(function()
+{
+    var isStartCalled = false;
+    var source = {
+        start: function(controller) {
+            assert_equals(this, source, 'source is this during start');
+
+            var unnamedMethods = [ 'close', 'enqueue', 'error' ];
+            var methods = unnamedMethods.concat(['constructor']).sort();
+            var proto = Object.getPrototypeOf(controller);
+
+            assert_array_equals(Object.getOwnPropertyNames(Object.getPrototypeOf(controller)).sort(), methods,
+                        'the controller should have the right methods');
+
+            for (var m of unnamedMethods) {
+                assert_equals(controller[m].name, '', 'method should have no name');
+            }
+
+            for (var m of methods) {
+                var methodProperties = [ 'arguments', 'caller', 'length', 'name', 'prototype' ];
+                var propDesc = Object.getOwnPropertyDescriptor(proto, m);
+                assert_equals(propDesc.enumerable, false, 'method should be non-enumerable');
+                assert_equals(propDesc.configurable, true, 'method should be configurable');
+                assert_equals(propDesc.writable, true, 'method should be writable');
+                assert_equals(typeof controller[m], 'function', 'should have be a method');
+                assert_array_equals(Object.getOwnPropertyNames(controller[m]).sort(), methodProperties, 'method should have the right properties');
+            }
+
+            assert_equals(controller.close.length, 0, 'close should have no parameters');
+            assert_equals(controller.constructor.length, 1, 'constructor should have 1 parameters');
+            assert_equals(controller.enqueue.length, 1, 'enqueue should have 1 parameter');
+            assert_equals(controller.error.length, 1, 'error should have 1 parameter');
+
+            isStartCalled = true;
+        }
+    };
+
+    var rs = new ReadableStream(source);
+    assert_true(isStartCalled);
+}, 'ReadableStream start should be called with the proper parameters');
+
+test(function()
+{
+    var isStartCalled = false;
+    var source = {
+        start: function(controller) {
+      const methods = [ 'close', 'constructor', 'enqueue', 'error' ];
+            assert_array_equals(Object.getOwnPropertyNames(Object.getPrototypeOf(controller)).sort(), methods, 'prototype should have the right methods');
+            controller.test = &quot;&quot;;
+            assert_array_equals(Object.getOwnPropertyNames(Object.getPrototypeOf(controller)).sort(), methods, 'prototype should still have the right methods');
+            assert_not_equals(Object.getOwnPropertyNames(controller).indexOf('test'), '\'test\' is a property of the controller');
+
+            isStartCalled = true;
+        }
+    };
+
+    var rs = new ReadableStream(source);
+    assert_true(isStartCalled);
+}, 'ReadableStream start controller parameter should be updatable');
+
+test(function()
+{
+    var isStartCalled = false;
+
+    var SimpleStreamSource = function() { };
+    SimpleStreamSource.prototype.start = function() { isStartCalled = true; };
+    SimpleStreamSource.prototype.constructor = SimpleStreamSource;
+
+    var rs = new ReadableStream(new SimpleStreamSource());
+    assert_true(isStartCalled);
+}, 'ReadableStream should be able to call start method within prototype chain of its source');
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsstreamsreferenceimplementationreadablestreamexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt (182782 => 182783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt        2015-04-14 05:48:23 UTC (rev 182782)
+++ trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt        2015-04-14 08:20:40 UTC (rev 182783)
</span><span class="lines">@@ -1,17 +1,13 @@
</span><span class="cx"> 
</span><span class="cx"> FAIL ReadableStream can be constructed with no errors ReadableStream constructor should get an object as argument.
</span><del>-PASS ReadableStream can't be constructed with garbage 
-FAIL ReadableStream instances should have the correct list of properties assert_array_equals: lengths differ, expected 6 got 5
-PASS ReadableStream constructor should get a function as start argument 
-FAIL ReadableStream start should be called with the proper parameters null is not an object (evaluating 'Object.getOwnPropertyNames(Object.getPrototypeOf(controller))')
-FAIL ReadableStream start controller parameter should be updatable null is not an object (evaluating 'Object.getOwnPropertyNames(Object.getPrototypeOf(controller))')
-PASS ReadableStream should be able to call start method within prototype chain of its source 
</del><ins>+FAIL ReadableStream instances should have the correct list of properties assert_array_equals: should have all the correct methods lengths differ, expected 6 got 5
+PASS ReadableStream constructor should throw for non-function start arguments 
</ins><span class="cx"> PASS ReadableStream constructor can get initial garbage as cancel argument 
</span><span class="cx"> PASS ReadableStream constructor can get initial garbage as pull argument 
</span><span class="cx"> PASS ReadableStream constructor can get initial garbage as strategy argument 
</span><span class="cx"> FAIL ReadableStream start should be able to return a promise read is not implemented
</span><span class="cx"> TIMEOUT ReadableStream start should be able to return a promise and reject it Test timed out
</span><del>-FAIL ReadableStream should be able to queue different objects. read is not implemented
</del><ins>+FAIL ReadableStream should be able to enqueue different objects. read is not implemented
</ins><span class="cx"> PASS ReadableStream: if start throws an error, it should be re-thrown 
</span><span class="cx"> FAIL ReadableStream: if pull rejects, it should error the stream read is not implemented
</span><span class="cx"> FAIL ReadableStream: should only call pull once upon starting the stream assert_equals: pull should be called once start finishes expected 1 but got 0
</span></span></pre></div>
<a id="trunkLayoutTestsstreamsreferenceimplementationreadablestreamreaderexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt (182782 => 182783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt        2015-04-14 05:48:23 UTC (rev 182782)
+++ trunk/LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt        2015-04-14 08:20:40 UTC (rev 182783)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> 
</span><span class="cx"> PASS Can get the ReadableStreamReader constructor indirectly 
</span><span class="cx"> PASS ReadableStreamReader constructor should get a ReadableStream object as argument 
</span><del>-FAIL ReadableStream instances should have the correct list of properties assert_array_equals: lengths differ, expected 5 got 4
</del><ins>+FAIL ReadableStreamReader instances should have the correct list of properties assert_array_equals: lengths differ, expected 5 got 4
</ins><span class="cx"> PASS ReadableStreamReader closed should always return the same promise object 
</span><span class="cx"> PASS Constructing a ReadableStreamReader directly should fail if the stream is already locked (via direct construction) 
</span><span class="cx"> PASS Getting a ReadableStreamReader via getReader should fail if the stream is already locked (via direct construction) 
</span><span class="lines">@@ -17,5 +17,4 @@
</span><span class="cx"> FAIL Cannot use an already-released reader to unlock a stream again releaseLock is not implemented
</span><span class="cx"> FAIL cancel() on a released reader is a no-op and does not pass through releaseLock is not implemented
</span><span class="cx"> FAIL Getting a second reader after erroring the stream should succeed read is not implemented
</span><del>-PASS Collecting a ReadableStreamReader should not unlock its stream 
</del><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstreamsreferenceimplementationreadablestreamreaderhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/streams/reference-implementation/readable-stream-reader.html (182782 => 182783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/streams/reference-implementation/readable-stream-reader.html        2015-04-14 05:48:23 UTC (rev 182782)
+++ trunk/LayoutTests/streams/reference-implementation/readable-stream-reader.html        2015-04-14 08:20:40 UTC (rev 182783)
</span><span class="lines">@@ -1,7 +1,6 @@
</span><span class="cx"> &lt;!DOCTYPE html&gt;
</span><span class="cx"> &lt;script src='../../resources/testharness.js'&gt;&lt;/script&gt;
</span><span class="cx"> &lt;script src='../../resources/testharnessreport.js'&gt;&lt;/script&gt;
</span><del>-&lt;script src='../../resources/gc.js'&gt;&lt;/script&gt;
</del><span class="cx"> &lt;script src='resources/streams-utils.js'&gt;&lt;/script&gt;
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> var ReadableStreamReader;
</span><span class="lines">@@ -24,46 +23,43 @@
</span><span class="cx"> }, 'ReadableStreamReader constructor should get a ReadableStream object as argument');
</span><span class="cx"> 
</span><span class="cx"> test(function() {
</span><ins>+    var methods = ['cancel', 'constructor', 'read', 'releaseLock'];
+    var properties = methods.concat(['closed']).sort();
+
</ins><span class="cx">     var rsReader = new ReadableStreamReader(new ReadableStream());
</span><ins>+    var proto = Object.getPrototypeOf(rsReader);
</ins><span class="cx"> 
</span><del>-    // assert_array_equals(Object.getOwnPropertyNames(rsReader), []);
-    assert_array_equals(Object.getOwnPropertyNames(Object.getPrototypeOf(rsReader)).sort(), [ 'cancel', 'closed', 'constructor', 'read', 'releaseLock' ]);
</del><ins>+    assert_array_equals(Object.getOwnPropertyNames(proto).sort(), properties);
</ins><span class="cx"> 
</span><del>-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'cancel').enumerable);
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'cancel').configurable);
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'cancel').writable);
</del><ins>+    for (var m of methods) {
+        var propDesc = Object.getOwnPropertyDescriptor(proto, m);
+        assert_equals(propDesc.enumerable, false, 'method should be non-enumerable');
+        assert_equals(propDesc.configurable, true, 'method should be configurable');
+        assert_equals(propDesc.writable, true, 'method should be writable');
+        assert_equals(typeof rsReader[m], 'function', 'should have be a method');
+    }
</ins><span class="cx"> 
</span><del>-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'closed').enumerable);
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'closed').configurable);
</del><ins>+    var closedPropDesc = Object.getOwnPropertyDescriptor(proto, 'closed');
+    assert_equals(closedPropDesc.enumerable, false, 'closed should be non-enumerable');
+    assert_equals(closedPropDesc.configurable, true, 'closed should be configurable');
+    assert_not_equals(closedPropDesc.get, undefined, 'closed should have a getter');
+    assert_equals(closedPropDesc.set, undefined, 'closed should not have a setter');
</ins><span class="cx"> 
</span><del>-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'constructor').configurable);
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'constructor').writable);
-
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'read').enumerable);
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'read').configurable);
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'read').writable);
-
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'releaseLock').enumerable);
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'releaseLock').configurable);
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rsReader), 'releaseLock').writable);
-
-    assert_equals(typeof rsReader.cancel, 'function', 'has a cancel method');
-    assert_equals(rsReader.cancel.length, 1);
-    assert_exists(Object.getPrototypeOf(rsReader), 'closed', 'has a closed property');
</del><ins>+    assert_equals(rsReader.cancel.length, 1, 'cancel has 1 parameter');
+    assert_not_equals(rsReader.closed, undefined, 'has a non-undefined closed property');
</ins><span class="cx">     assert_equals(typeof rsReader.closed.then, 'function', 'closed property is thenable');
</span><span class="cx">     assert_equals(typeof rsReader.constructor, 'function', 'has a constructor method');
</span><span class="cx">     assert_equals(rsReader.constructor.length, 1, 'constructor has 1 parameter');
</span><span class="cx">     assert_equals(typeof rsReader.read, 'function', 'has a getReader method');
</span><del>-    assert_equals(rsReader.read.length, 0);
</del><ins>+    assert_equals(rsReader.read.length, 0, 'read has no parameters');
</ins><span class="cx">     assert_equals(typeof rsReader.releaseLock, 'function', 'has a releaseLock method');
</span><del>-    assert_equals(rsReader.releaseLock.length, 0);
</del><ins>+    assert_equals(rsReader.releaseLock.length, 0, 'releaseLock has no parameters');
+}, 'ReadableStreamReader instances should have the correct list of properties');
</ins><span class="cx"> 
</span><del>-}, 'ReadableStream instances should have the correct list of properties');
-
</del><span class="cx"> test(function() {
</span><span class="cx">     var rsReader = new ReadableStreamReader(new ReadableStream());
</span><span class="cx"> 
</span><del>-    assert_equals(rsReader.closed, rsReader.closed);
</del><ins>+    assert_equals(rsReader.closed, rsReader.closed, 'closed should return the same promise');
</ins><span class="cx"> }, 'ReadableStreamReader closed should always return the same promise object');
</span><span class="cx"> 
</span><span class="cx"> test(function() {
</span><span class="lines">@@ -316,11 +312,4 @@
</span><span class="cx">         test8.done();
</span><span class="cx">     }));
</span><span class="cx"> });
</span><del>-
-test(function() {
-    var rs = new ReadableStream({});
-    rs.getReader();
-    window.gc();
-    assert_throws(new TypeError(), function() { rs.getReader(); });
-}, 'Collecting a ReadableStreamReader should not unlock its stream');
</del><span class="cx"> &lt;/script&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsstreamsreferenceimplementationreadablestreamhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/streams/reference-implementation/readable-stream.html (182782 => 182783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/streams/reference-implementation/readable-stream.html        2015-04-14 05:48:23 UTC (rev 182782)
+++ trunk/LayoutTests/streams/reference-implementation/readable-stream.html        2015-04-14 08:20:40 UTC (rev 182783)
</span><span class="lines">@@ -12,129 +12,35 @@
</span><span class="cx"> }, 'ReadableStream can be constructed with no errors');
</span><span class="cx"> 
</span><span class="cx"> test(function() {
</span><del>-    assert_throws(new TypeError(), function() {
-        new ReadableStream(null);
-    }, 'constructor can\'t receive null');
-}, 'ReadableStream can\'t be constructed with garbage');
</del><ins>+    var methods = ['cancel', 'constructor', 'getReader', 'pipeThrough', 'pipeTo', 'tee'];
</ins><span class="cx"> 
</span><del>-test(function() {
</del><span class="cx">     var rs = new ReadableStream();
</span><ins>+    var proto = Object.getPrototypeOf(rs);
</ins><span class="cx"> 
</span><del>-    assert_array_equals(Object.getOwnPropertyNames(rs), []);
-    assert_array_equals(Object.getOwnPropertyNames(Object.getPrototypeOf(rs)).sort(), ['cancel', 'constructor', 'getReader', 'pipeThrough', 'pipeTo', 'tee']);
</del><ins>+    assert_array_equals(Object.getOwnPropertyNames(proto).sort(), methods, 'should have all the correct methods');
</ins><span class="cx"> 
</span><del>-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'cancel').enumerable, 'cancel method is enumerable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'cancel').configurable, 'cancel method is configurable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'cancel').writable, 'cancel method is writable');
</del><ins>+    for (var m of methods) {
+        var propDesc = Object.getOwnPropertyDescriptor(proto, m);
+        assert_equals(propDesc.enumerable, false, 'method should be non-enumerable');
+        assert_equals(propDesc.configurable, true, 'method should be configurable');
+        assert_equals(propDesc.writable, true, 'method should be writable');
+        assert_equals(typeof rs[m], 'function', 'should have be a method');
+    }
</ins><span class="cx"> 
</span><del>-    assert_false(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'constructor').enumerable, 'constructor method is not enumerable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'constructor').configurable, 'constructor method is configurable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'constructor').writable, 'constructor method is writable');
-
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'getReader').enumerable, 'getReader method is enumerable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'getReader').configurable, 'getReader method is configurable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'getReader').writable, 'getReader method is writable');
-
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'pipeThrough').enumerable, 'pipeThrough method is enumerable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'pipeThrough').configurable, 'pipeThrough method is configurable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'pipeThrough').writable, 'pipeThrough method is writable');
-
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'pipeTo').enumerable, 'pipeTo method is enumerable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'pipeTo').configurable, 'pipeTo method is configurable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'pipeTo').writable, 'pipeTo method is writable');
-
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'tee').enumerable, 'tee method is enumerable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'tee').configurable, 'tee method is configurable');
-    assert_true(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rs), 'tee').writable, 'tee method is writable');
-
-    assert_equals(typeof rs.cancel, 'function', 'has a cancel method');
-    assert_equals(rs.cancel.length, 1, 'cancel has 1 parameter');
-    assert_equals(typeof rs.constructor, 'function', 'has a constructor method');
-    assert_equals(rs.constructor.length, 0), 'constructor has no parameters';
-    assert_equals(typeof rs.getReader, 'function', 'has a getReader method');
-    assert_equals(rs.getReader.length, 0, 'getReader has no parameters');
-    assert_equals(typeof rs.pipeThrough, 'function', 'has a pipeThrough method');
-    assert_equals(rs.pipeThrough.length, 2, 'pipeThrough has 2 parameters');
-    assert_equals(typeof rs.pipeTo, 'function', 'has a pipeTo method');
-    assert_equals(rs.pipeTo.length, 1, 'pipeTo has 1 parameter');
-    assert_equals(typeof rs.tee, 'function', 'has a tee method');
-    assert_equals(rs.tee.length, 0, 'tee has no parameters');
-
</del><ins>+    assert_equals(rs.cancel.length, 1, 'cancel should have 1 parameter');
+    assert_equals(rs.constructor.length, 0, 'constructor should have no parameters');
+    assert_equals(rs.getReader.length, 0, 'getReader should have no parameters');
+    assert_equals(rs.pipeThrough.length, 2, 'pipeThrough should have 2 parameters');
+    assert_equals(rs.pipeTo.length, 1, 'pipeTo should have 1 parameter');
+    assert_equals(rs.tee.length, 0, 'tee should have no parameters');
</ins><span class="cx"> }, 'ReadableStream instances should have the correct list of properties');
</span><span class="cx"> 
</span><span class="cx"> test(function() {
</span><span class="cx">     assert_throws(new TypeError(), function() {
</span><span class="cx">         new ReadableStream({ start: 'potato'});
</span><del>-    }, 'constructor should throw when start is a string');
-}, 'ReadableStream constructor should get a function as start argument');
</del><ins>+    }, 'constructor should throw when start is not a function');
+}, 'ReadableStream constructor should throw for non-function start arguments');
</ins><span class="cx"> 
</span><del>-test(function()
-{
-    var isStartCalled = false;
-    var source = {
-        start: function(controller) {
-            assert_equals(this, source);
-
-            assert_array_equals(Object.getOwnPropertyNames(Object.getPrototypeOf(controller)).sort(), [ 'close', 'constructor', 'enqueue', 'error' ]);
-
-            var enqueue = controller.enqueue;
-            var close = controller.close;
-            var error = controller.error;
-
-            assert_equals(typeof enqueue, 'function');
-            assert_equals(typeof close, 'function');
-            assert_equals(typeof error, 'function');
-
-            assert_array_equals(Object.getOwnPropertyNames(enqueue).sort(), [ 'arguments', 'caller', 'length', 'name', 'prototype' ]);
-            assert_array_equals(Object.getOwnPropertyNames(close).sort(), [ 'arguments', 'caller', 'length', 'name', 'prototype' ]);
-            assert_array_equals(Object.getOwnPropertyNames(error).sort(), [ 'arguments', 'caller', 'length', 'name', 'prototype' ]);
-
-            assert_equals(enqueue.name, '');
-            assert_equals(close.name, '');
-            assert_equals(error.name, '');
-
-            assert_equals(enqueue.length, 1);
-            assert_equals(close.length, 0);
-            assert_equals(error.length, 1);
-
-            isStartCalled = true;
-        }
-    };
-
-    var rs = new ReadableStream(source);
-    assert_true(isStartCalled);
-}, 'ReadableStream start should be called with the proper parameters');
-
-test(function()
-{
-    var isStartCalled = false;
-    var source = {
-        start: function(controller) {
-            assert_array_equals(Object.getOwnPropertyNames(Object.getPrototypeOf(controller)).sort(), [ 'close', 'constructor', 'enqueue', 'error' ]);
-            controller.test = &quot;&quot;;
-            assert_array_equals(Object.getOwnPropertyNames(Object.getPrototypeOf(controller)).sort(), [ 'close', 'constructor', 'enqueue', 'error' ]);
-            assert_not_equals(Object.getOwnPropertyNames(controller).indexOf('test'));
-
-            isStartCalled = true;
-        }
-    };
-
-    var rs = new ReadableStream(source);
-    assert_true(isStartCalled);
-}, 'ReadableStream start controller parameter should be updatable');
-
-test(function()
-{
-    var isStartCalled = false;
-
-    var SimpleStreamSource = function() { };
-    SimpleStreamSource.prototype.start = function() { isStartCalled = true; };
-    SimpleStreamSource.prototype.constructor = SimpleStreamSource;
-
-    var rs = new ReadableStream(new SimpleStreamSource());
-    assert_true(isStartCalled);
-}, 'ReadableStream should be able to call start method within prototype chain of its source');
-
</del><span class="cx"> test(function() {
</span><span class="cx">     new ReadableStream({ cancel: '2'}); // Constructor should not throw when cancel is not a function.
</span><span class="cx"> }, 'ReadableStream constructor can get initial garbage as cancel argument');
</span><span class="lines">@@ -167,19 +73,19 @@
</span><span class="cx"> 
</span><span class="cx">     reader.read().then(test1.step_func(function(r) {
</span><span class="cx">         readCalled = true;
</span><del>-        assert_object_equals(r, { value: 'a', done: false }, 'read value correctly');
</del><ins>+        assert_object_equals(r, { value: 'a', done: false }, 'value read should be the one enqueued');
</ins><span class="cx">     }));
</span><span class="cx"> 
</span><span class="cx">     reader.closed.then(test1.step_func(function() {
</span><span class="cx">         assert_true(readCalled);
</span><del>-        test1.done('stream successfully closed');
</del><ins>+        test1.done('stream should close successfully');
</ins><span class="cx">     }));
</span><span class="cx"> });
</span><span class="cx"> 
</span><span class="cx"> var test2 = async_test('ReadableStream start should be able to return a promise and reject it', { timeout: 100 });
</span><span class="cx"> test2.step(function()
</span><span class="cx"> {
</span><del>-    var theError = new Error(&quot;rejected!&quot;);
</del><ins>+    var theError = new Error('rejected!');
</ins><span class="cx">     var rs = new ReadableStream({
</span><span class="cx">         start: function() {
</span><span class="cx">             return new Promise(test2.step_func(function(resolve, reject) {
</span><span class="lines">@@ -191,12 +97,12 @@
</span><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     rs.getReader().closed.catch(test2.step_func(function(e) {
</span><del>-        assert_equals(e, theError, 'promise is rejected with the same error');
</del><ins>+        assert_equals(e, theError, 'promise should be rejected with the same error');
</ins><span class="cx">         test2.done();
</span><span class="cx">     }));
</span><span class="cx"> });
</span><span class="cx"> 
</span><del>-var test3 = async_test('ReadableStream should be able to queue different objects.');
</del><ins>+var test3 = async_test('ReadableStream should be able to enqueue different objects.');
</ins><span class="cx"> test3.step(function() {
</span><span class="cx">     var readCalls = 0;
</span><span class="cx">     var objects = [
</span><span class="lines">@@ -207,8 +113,8 @@
</span><span class="cx"> 
</span><span class="cx">     var rs = new ReadableStream({
</span><span class="cx">         start: function(c) {
</span><del>-            for (var i = 0; i &lt; objects.length; i++) {
-                c.enqueue(objects[i]);
</del><ins>+            for (var o of objects) {
+                c.enqueue(o);
</ins><span class="cx">             }
</span><span class="cx">             c.close();
</span><span class="cx">         }
</span><span class="lines">@@ -217,20 +123,20 @@
</span><span class="cx">     var reader = rs.getReader();
</span><span class="cx"> 
</span><span class="cx">     reader.read().then(test3.step_func(function(r) {
</span><del>-        assert_object_equals(r, { value: objects[readCalls++], done: false }, 'read value correctly');
</del><ins>+        assert_object_equals(r, { value: objects[readCalls++], done: false }, 'value read should be the one enqueued');
</ins><span class="cx">     }));
</span><span class="cx"> 
</span><span class="cx">     reader.read().then(test3.step_func(function(r) {
</span><del>-        assert_object_equals(r, { value: objects[readCalls++], done: false }, 'read value correctly');
</del><ins>+        assert_object_equals(r, { value: objects[readCalls++], done: false }, 'value read should be the one enqueued');
</ins><span class="cx">     }));
</span><span class="cx"> 
</span><span class="cx">     reader.read().then(test3.step_func(function(r) {
</span><del>-        assert_object_equals(r, { value: objects[readCalls++], done: false }, 'read value correctly');
</del><ins>+        assert_object_equals(r, { value: objects[readCalls++], done: false }, 'value read should be the one enqueued');
</ins><span class="cx">     }));
</span><span class="cx"> 
</span><span class="cx">     reader.closed.then(test3.step_func(function() {
</span><span class="cx">         assert_equals(readCalls, 3);
</span><del>-        test3.done('stream was closed correctly');
</del><ins>+        test3.done('stream should close correctly correctly');
</ins><span class="cx">     }));
</span><span class="cx"> });
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>