Bug 1507977 [wpt PR 14098] - Implement RTCQuicStream.readInto(), a=testonly
authorSteve Anton <steveanton@chromium.org>
Mon, 19 Nov 2018 18:46:31 +0000
changeset 506786 f93995d24b551c890b81a57bca1056fad56f612b
parent 506785 3cec1475937580e33ee98d3bae84c8c7f4d5e862
child 506787 8fa2886ddcf1dae2fa951ad3a7bf9d51a3317709
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1507977, 14098, 874296, 1289436, 608878
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507977 [wpt PR 14098] - Implement RTCQuicStream.readInto(), a=testonly Automatic update from web-platform-testsImplement RTCQuicStream.readInto() Bug: 874296 Tbr: hbos@chromium.org Change-Id: Id2905574237fe9221d49a1e772c9ba0f3e7957e1 Reviewed-on: https://chromium-review.googlesource.com/c/1289436 Commit-Queue: Steve Anton <steveanton@chromium.org> Reviewed-by: Steve Anton <steveanton@chromium.org> Cr-Commit-Position: refs/heads/master@{#608878} -- wpt-commits: 7eba3fb1b7375c07fe00d29b2154cc7407b3fd94 wpt-pr: 14098
testing/web-platform/tests/webrtc/RTCQuicStream.https.html
--- a/testing/web-platform/tests/webrtc/RTCQuicStream.https.html
+++ b/testing/web-platform/tests/webrtc/RTCQuicStream.https.html
@@ -50,20 +50,18 @@ promise_test(async t => {
   quicTransport.stop();
   assert_equals(firstQuicStream.state, 'closed');
   assert_equals(secondQuicStream.state, 'closed');
 }, 'RTCQuicTransport.stop() closes all local streams.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
-  const firstLocalStream = localQuicTransport.createStream();
-  firstLocalStream.finish();
-  const secondLocalStream = localQuicTransport.createStream();
-  secondLocalStream.finish();
+  localQuicTransport.createStream().finish();
+  localQuicTransport.createStream().finish();
   const remoteWatcher =
       new EventWatcher(t, remoteQuicTransport, [ 'quicstream', 'statechange' ]);
   const { stream: firstRemoteStream } =
       await remoteWatcher.wait_for('quicstream');
   const { stream: secondRemoteStream } =
       await remoteWatcher.wait_for('quicstream');
   localQuicTransport.stop();
   await remoteWatcher.wait_for('statechange');
@@ -104,69 +102,28 @@ promise_test(async t => {
   localStream.reset();
   assert_equals(localStream.state, 'closed');
 }, `reset() following finish() changes state to 'closed'.`);
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
-  localStream.finish();
-  const remoteWatcher = new EventWatcher(t, remoteQuicTransport, 'quicstream');
-  const { stream: remoteStream } = await remoteWatcher.wait_for('quicstream');
-  assert_equals(remoteStream.state, 'open');
-  const remoteStreamWatcher = new EventWatcher(t, remoteStream, 'statechange');
-  await remoteStreamWatcher.wait_for('statechange');
-  assert_equals(remoteStream.state, 'closing');
-}, 'createStream() followed by finish() fires a quicstream event followed by ' +
-    `a statechange event to 'closing' on the remote side.`);
-
-promise_test(async t => {
-  const [ localQuicTransport, remoteQuicTransport ] =
-      await makeTwoConnectedQuicTransports(t);
-  const localStream = localQuicTransport.createStream();
   localStream.reset();
   const remoteWatcher = new EventWatcher(t, remoteQuicTransport, 'quicstream');
   const { stream: remoteStream } = await remoteWatcher.wait_for('quicstream');
   assert_equals(remoteStream.state, 'open');
   const remoteStreamWatcher = new EventWatcher(t, remoteStream, 'statechange');
   await remoteStreamWatcher.wait_for('statechange');
   assert_equals(remoteStream.state, 'closed');
 }, 'createStream() followed by reset() fires a quicstream event followed ' +
     `by a statechange event to 'closed' on the remote side.`);
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
-      await makeTwoConnectedQuicTransports(t);
-  remoteQuicTransport.onquicstream = ({ stream }) => stream.reset();
-  const localStream = localQuicTransport.createStream();
-  localStream.finish();
-  const localWatcher = new EventWatcher(t, localStream, 'statechange');
-  await localWatcher.wait_for('statechange');
-  assert_equals(localStream.state, 'closed');
-}, 'finish() on a remote stream that has already finished fires a ' +
-    `statechange event to 'closed' on the remote side.`);
-
-promise_test(async t => {
-  const [ localQuicTransport, remoteQuicTransport ] =
-      await makeTwoConnectedQuicTransports(t);
-  const localStream = localQuicTransport.createStream();
-  localStream.finish();
-  localStream.reset();
-  const remoteWatcher = new EventWatcher(t, remoteQuicTransport, 'quicstream');
-  const { stream: remoteStream } = await remoteWatcher.wait_for('quicstream');
-  const remoteStreamWatcher = new EventWatcher(t, remoteStream, 'statechange');
-  await remoteStreamWatcher.wait_for('statechange');
-  assert_equals(remoteStream.state, 'closing');
-  await remoteStreamWatcher.wait_for('statechange');
-  assert_equals(remoteStream.state, 'closed');
-}, 'finish() then reset() fires two statechange events on the remote side.');
-
-promise_test(async t => {
-  const [ localQuicTransport, remoteQuicTransport ] =
     await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
   localStream.write(new Uint8Array(0));
   assert_equals(localStream.writeBufferedAmount, 0);
 }, 'write() with an empty array does nothing.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
@@ -212,16 +169,34 @@ promise_test(async t => {
   assert_equals(localStream.writeBufferedAmount, 10);
 }, 'write() throws if total write buffered amount would be greater than ' +
     'maxWriteBufferedAmount.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
+  localStream.write(new Uint8Array(10));
+  const remoteWatcher = new EventWatcher(t, remoteQuicTransport, 'quicstream');
+  await remoteWatcher.wait_for('quicstream');
+}, 'write() causes quicstream event to fire on the remote transport.');
+
+promise_test(async t => {
+  const [ localQuicTransport, remoteQuicTransport ] =
+      await makeTwoConnectedQuicTransports(t);
+  const localStream = localQuicTransport.createStream();
+  localStream.finish();
+  const remoteWatcher = new EventWatcher(t, remoteQuicTransport, 'quicstream');
+  await remoteWatcher.wait_for('quicstream');
+}, 'finish() causes quicstream event to fire on the remote transport.');
+
+promise_test(async t => {
+  const [ localQuicTransport, remoteQuicTransport ] =
+      await makeTwoConnectedQuicTransports(t);
+  const localStream = localQuicTransport.createStream();
   localStream.finish();
   assert_throws('InvalidStateError',
       () => localStream.write(new Uint8Array()));
 }, 'write() throws InvalidStateError if finish() has been called.');
 
 closed_stream_test(async (t, stream) => {
   assert_throws('InvalidStateError', () => stream.write(new Uint8Array()));
 }, 'write() throws InvalidStateError.');
@@ -297,9 +272,22 @@ promise_test(async t => {
 }, 'Pending waitForWriteBufferedAmountBelow() promises rejected after ' +
   'reset().');
 
 closed_stream_test(async (t, stream) => {
   await promise_rejects(t, 'InvalidStateError',
       stream.waitForWriteBufferedAmountBelow(0));
 }, 'waitForWriteBufferedBelow() rejects with InvalidStateError.');
 
+promise_test(async t => {
+  const [ localQuicTransport, remoteQuicTransport ] =
+      await makeTwoConnectedQuicTransports(t);
+  const localStream = localQuicTransport.createStream();
+  assert_object_equals(
+      localStream.readInto(new Uint8Array(10)),
+      { amount: 0, finished: false });
+}, 'readInto() on new local stream returns amount 0.');
+
+closed_stream_test(async (t, stream) => {
+  assert_throws('InvalidStateError', () => stream.readInto(new Uint8Array(1)));
+}, 'readInto() throws InvalidStateError.');
+
 </script>