Bug 1507064 [wpt PR 14046] - Implement RTCQuicStream.waitForWriteBufferedAmountBelow(), a=testonly
authorSteve Anton <steveanton@chromium.org>
Mon, 19 Nov 2018 18:45:54 +0000
changeset 506774 47f01bb0b976c4d087b91f5d93ddb24f844d98fe
parent 506773 c409ea7851c69dfa22240bc1e443afcf33468e22
child 506775 b9b654151838eff7b4ac713fe0d08fe093a11041
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
bugs1507064, 14046, 874296, 1286902, 608648
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 1507064 [wpt PR 14046] - Implement RTCQuicStream.waitForWriteBufferedAmountBelow(), a=testonly Automatic update from web-platform-testsImplement RTCQuicStream.waitForWriteBufferedAmountBelow() Bug: 874296 Change-Id: I694325a0cc85ad520c18762e34ba05e2204e2c74 Reviewed-on: https://chromium-review.googlesource.com/c/1286902 Commit-Queue: Steve Anton <steveanton@chromium.org> Reviewed-by: Henrik Boström <hbos@chromium.org> Cr-Commit-Position: refs/heads/master@{#608648} -- wpt-commits: d84cf823ac8a9bee7df5be37f4fafdbe218ab6a7 wpt-pr: 14046
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
@@ -248,9 +248,58 @@ promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
   localStream.write(new Uint8Array(10));
   localStream.finish();
   assert_equals(localStream.writeBufferedAmount, 10);
 }, 'writeBufferedAmount maintained after finish() has been called.');
 
+promise_test(async t => {
+  const [ localQuicTransport, remoteQuicTransport ] =
+      await makeTwoConnectedQuicTransports(t);
+  const localStream = localQuicTransport.createStream();
+  await localStream.waitForWriteBufferedAmountBelow(0);
+}, 'waitForWriteBufferedAmountBelow(0) resolves immediately.');
+
+promise_test(async t => {
+  const [ localQuicTransport, remoteQuicTransport ] =
+      await makeTwoConnectedQuicTransports(t);
+  const localStream = localQuicTransport.createStream();
+  await localStream.waitForWriteBufferedAmountBelow(
+      localStream.maxWriteBufferedAmount);
+}, 'waitForWriteBufferedAmountBelow(maxWriteBufferedAmount) resolves ' +
+  'immediately.');
+
+promise_test(async t => {
+  const [ localQuicTransport, remoteQuicTransport ] =
+      await makeTwoConnectedQuicTransports(t);
+  const localStream = localQuicTransport.createStream();
+  localStream.write(new Uint8Array(localStream.maxWriteBufferedAmount));
+  const promise1 = localStream.waitForWriteBufferedAmountBelow(0);
+  const promise2 = localStream.waitForWriteBufferedAmountBelow(0);
+  localStream.finish();
+  await Promise.all([
+      promise_rejects(t, 'InvalidStateError', promise1),
+      promise_rejects(t, 'InvalidStateError', promise2)]);
+}, 'Pending waitForWriteBufferedAmountBelow() promises rejected after ' +
+  'finish().');
+
+promise_test(async t => {
+  const [ localQuicTransport, remoteQuicTransport ] =
+      await makeTwoConnectedQuicTransports(t);
+  const localStream = localQuicTransport.createStream();
+  localStream.write(new Uint8Array(localStream.maxWriteBufferedAmount));
+  const promise1 = localStream.waitForWriteBufferedAmountBelow(0);
+  const promise2 = localStream.waitForWriteBufferedAmountBelow(0);
+  localStream.reset();
+  await Promise.all([
+      promise_rejects(t, 'InvalidStateError', promise1),
+      promise_rejects(t, 'InvalidStateError', promise2)]);
+}, 'Pending waitForWriteBufferedAmountBelow() promises rejected after ' +
+  'reset().');
+
+closed_stream_test(async (t, stream) => {
+  await promise_rejects(t, 'InvalidStateError',
+      stream.waitForWriteBufferedAmountBelow(0));
+}, 'waitForWriteBufferedBelow() rejects with InvalidStateError.');
+
 </script>