Bug 1468951 [wpt PR 11526] - Update external/wpt/webrtc/RTCRtpParameters* tests., a=testonly
authorHenrik Boström <hbos@chromium.org>
Fri, 06 Jul 2018 23:36:07 +0000
changeset 426107 79e6840b7382fde7d034229ad88f981ec7a6bf32
parent 426106 eb120585f7214b80bf89fc02084da68973c3def0
child 426108 e8604b5977a8c18e72e0233ee380962d4088bc18
push id34267
push userrgurzau@mozilla.com
push dateWed, 11 Jul 2018 22:05:21 +0000
treeherdermozilla-central@3aca103e4915 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1468951, 11526, 1102436, 1025771, 803494, 777617, 1102502, 571430
milestone63.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 1468951 [wpt PR 11526] - Update external/wpt/webrtc/RTCRtpParameters* tests., a=testonly Automatic update from web-platform-testsUpdate external/wpt/webrtc/RTCRtpParameters* tests. This is in preparation for get/setParameters[1] and RTCRtpTransceiver[2]. Tests are updated to use promise_test and async/await to make them easier to write and to execute sequentially. Tests are updated to set up a call before getParameters() because many parameters are defined as "that has been negotiated". If we want to test what is returned before negotiation we should add that as separate tests. For now, this is necessary for the tests to run on [1][2]. Some tests are removed because they no longer reflect the spec. Because get/setParameters() and RTCRtpTransceiver has not landed yet, the tests are still expected to fail. [1] https://chromium-review.googlesource.com/c/chromium/src/+/1102436 [2] https://chromium-review.googlesource.com/c/chromium/src/+/1025771 Bug: 803494, 777617 Change-Id: I3f14a37925837576a602d91bb67e48181c56a946 Reviewed-on: https://chromium-review.googlesource.com/1102502 Reviewed-by: Harald Alvestrand <hta@chromium.org> Commit-Queue: Henrik Boström <hbos@chromium.org> Cr-Commit-Position: refs/heads/master@{#571430} -- wpt-commits: 36fb033a4051e63a0ab4bd073fdaadf808953564 wpt-pr: 11526
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/webrtc/RTCRtpParameters-codecs.html
testing/web-platform/tests/webrtc/RTCRtpParameters-encodings.html
testing/web-platform/tests/webrtc/RTCRtpParameters-helper.js
testing/web-platform/tests/webrtc/RTCRtpParameters-transactionId.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -626788,41 +626788,41 @@
    "f273bd7fdfc883a15e8fb16fef5309061254c6cc",
    "testharness"
   ],
   "webrtc/RTCRtpCapabilities-helper.js": [
    "22881ddd3cda1a64ff22474562de1568522e9745",
    "support"
   ],
   "webrtc/RTCRtpParameters-codecs.html": [
-   "56f7ca6bd03087b3858c6decde1387cd4017fd3b",
+   "6b7827be92ec883fe87bc2c422a7fa6bb557190b",
    "testharness"
   ],
   "webrtc/RTCRtpParameters-degradationPreference.html": [
    "8da53caafd7b98c462f75ef45ed0488a74c378c7",
    "testharness"
   ],
   "webrtc/RTCRtpParameters-encodings.html": [
-   "76d4a6dccec508ea25d8c0bc3037a25a7db3f3ac",
+   "27fa525156e34885a12971e722ba0efc729b8f39",
    "testharness"
   ],
   "webrtc/RTCRtpParameters-headerExtensions.html": [
    "11af81bd75e189e541468a7766b4af77034914f4",
    "testharness"
   ],
   "webrtc/RTCRtpParameters-helper.js": [
-   "fcf16b5ae297d141b48003115905aa5bf28eab32",
+   "10aa220467977eaceb70e2143acbf46b6876f0d6",
    "support"
   ],
   "webrtc/RTCRtpParameters-rtcp.html": [
    "1fa435f3f9be15799f4d45de4dc0995dcc01b156",
    "testharness"
   ],
   "webrtc/RTCRtpParameters-transactionId.html": [
-   "acb3d37db30fb2d436cc130c4a47601aa38625c8",
+   "a48817af4be42460a1f44f39e63f292662228db8",
    "testharness"
   ],
   "webrtc/RTCRtpReceiver-getCapabilities.html": [
    "9eef967677aa2f0880f5114e7831437f931f2256",
    "testharness"
   ],
   "webrtc/RTCRtpReceiver-getContributingSources.https.html": [
    "ce5367315aad59d4e0c847643b05318cea1cd31c",
--- a/testing/web-platform/tests/webrtc/RTCRtpParameters-codecs.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpParameters-codecs.html
@@ -7,16 +7,17 @@
 <script src="RTCRtpParameters-helper.js"></script>
 <script>
   'use strict';
 
   // Test is based on the following editor draft:
   // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html
 
   // The following helper functions are called from RTCRtpParameters-helper.js:
+  //   doOfferAnswerExchange
   //   validateSenderRtpParameters
 
   /*
     5.2.  RTCRtpSender Interface
       interface RTCRtpSender {
         Promise<void>           setParameters(optional RTCRtpParameters parameters);
         RTCRtpParameters        getParameters();
       };
@@ -75,159 +76,132 @@
     5.2.  setParameters
       7.  If parameters.encodings.length is different from N, or if any parameter
           in the parameters argument, marked as a Read-only parameter, has a value
           that is different from the corresponding parameter value returned from
           sender.getParameters(), abort these steps and return a promise rejected
           with a newly created InvalidModificationError. Note that this also applies
           to transactionId.
    */
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
+
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
+
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     const codec = getFirstCodec(param);
 
     if(codec.payloadType === undefined) {
       codec.payloadType = 8;
     } else {
       codec.payloadType += 1;
     }
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with codec.payloadType modified should reject with InvalidModificationError');
 
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     const codec = getFirstCodec(param);
 
     if(codec.mimeType === undefined) {
       codec.mimeType = 'audio/piedpiper';
     } else {
       codec.mimeType = `${codec.mimeType}-modified`;
     }
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with codec.mimeType modified should reject with InvalidModificationError');
 
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     const codec = getFirstCodec(param);
 
     if(codec.clockRate === undefined) {
       codec.clockRate = 8000;
     } else {
       codec.clockRate += 1;
     }
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with codec.clockRate modified should reject with InvalidModificationError');
 
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     const codec = getFirstCodec(param);
 
     if(codec.channels === undefined) {
       codec.channels = 6;
     } else {
       codec.channels += 1;
     }
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with codec.channels modified should reject with InvalidModificationError');
 
-
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     const codec = getFirstCodec(param);
 
     if(codec.sdpFmtpLine === undefined) {
       codec.sdpFmtpLine = 'a=fmtp:98 0-15';
     } else {
       codec.sdpFmtpLine = `${codec.sdpFmtpLine};foo=1`;
     }
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with codec.sdpFmtpLine modified should reject with InvalidModificationError');
 
-
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     const { codecs } = param;
 
     codecs.push({
       payloadType: 2,
       mimeType: 'audio/piedpiper',
       clockRate: 1000,
       channels: 2
     });
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with new codecs inserted should reject with InvalidModificationError');
 
-  promise_test(t => {
-    const pc = new RTCPeerConnection();
-    t.add_cleanup(() => pc.close());
-    const { sender } = pc.addTransceiver('audio');
-    const param = sender.getParameters();
-    validateSenderRtpParameters(param);
-
-    const { codecs } = param;
-
-    // skip and pass test if there is less than 2 codecs
-    if(codecs.length >= 2) {
-      const tmp = codecs[0];
-      codecs[0] = codecs[1];
-      codecs[1] = tmp;
-    }
-
-    return sender.setParameters(param);
-  }, 'setParameters with reordered codecs should succeed');
-
-  promise_test(t => {
-    const pc = new RTCPeerConnection();
-    t.add_cleanup(() => pc.close());
-    const { sender } = pc.addTransceiver('audio');
-    const param = sender.getParameters();
-    validateSenderRtpParameters(param);
-
-    const { codecs } = param;
-
-    param.codecs = codecs.slice(1);
-
-    return sender.setParameters(param);
-  }, 'setParameters with dropped codec should succeed');
-
 </script>
--- a/testing/web-platform/tests/webrtc/RTCRtpParameters-encodings.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpParameters-encodings.html
@@ -7,16 +7,17 @@
 <script src="RTCRtpParameters-helper.js"></script>
 <script>
   'use strict';
 
   // Test is based on the following editor draft:
   // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html
 
   // The following helper functions are called from RTCRtpParameters-helper.js:
+  //   doOfferAnswerExchange
   //   validateSenderRtpParameters
 
   /*
     5.1.  RTCPeerConnection Interface Extensions
       partial interface RTCPeerConnection {
         RTCRtpTransceiver           addTransceiver((MediaStreamTrack or DOMString) trackOrKind,
                                                    optional RTCRtpTransceiverInit init);
         ...
@@ -109,30 +110,35 @@
       5.  Let sender have a [[send encodings]] internal slot, representing a list
           of RTCRtpEncodingParameters dictionaries.
       6.  If sendEncodings is given as input to this algorithm, and is non-empty,
           set the [[send encodings]] slot to sendEncodings.
 
           Otherwise, set it to a list containing a single RTCRtpEncodingParameters
           with active set to true.
    */
-  test(() => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
+    t.add_cleanup(() => pc.close());
     const transceiver = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
+
     const param = transceiver.sender.getParameters();
     validateSenderRtpParameters(param);
     const { encodings } = param;
     const encoding = getFirstEncoding(param);
 
     assert_equals(encoding.active, true);
   }, 'addTransceiver() with undefined sendEncodings should have default encoding parameter with active set to true');
 
-  test(() => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
+    t.add_cleanup(() => pc.close());
     const transceiver = pc.addTransceiver('audio', { sendEncodings: [] });
+    await doOfferAnswerExchange(t, pc);
 
     const param = transceiver.sender.getParameters();
     validateSenderRtpParameters(param);
     const { encodings } = param;
     const encoding = getFirstEncoding(param);
 
     assert_equals(encoding.active, true);
   }, 'addTransceiver() with empty list sendEncodings should have default encoding parameter with active set to true');
@@ -146,29 +152,31 @@
             of RTCRtpEncodingParameters dictionaries.
 
         6.  If sendEncodings is given as input to this algorithm, and is non-empty,
             set the [[send encodings]] slot to sendEncodings.
 
     5.2.  getParameters
       - encodings is set to the value of the [[send encodings]] internal slot.
    */
-  test(() => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
+    t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio', {
       sendEncodings: [{
         dtx: 'enabled',
         active: false,
         priority: 'low',
         ptime: 5,
         maxBitrate: 8,
         maxFramerate: 25,
         rid: 'foo'
       }]
     });
+    await doOfferAnswerExchange(t, pc);
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
     const encoding = getFirstEncoding(param);
 
     assert_equals(encoding.dtx, 'enabled');
     assert_equals(encoding.active, false);
     assert_equals(encoding.priority, 'low');
@@ -185,73 +193,56 @@
           [[send encodings]] slot.
       7.  If parameters.encodings.length is different from N, or if any parameter
           in the parameters argument, marked as a Read-only parameter, has a value
           that is different from the corresponding parameter value returned from
           sender.getParameters(), abort these steps and return a promise rejected
           with a newly created InvalidModificationError. Note that this also applies
           to transactionId.
    */
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
+
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     const { encodings } = param;
     assert_equals(encodings.length, 1);
 
     // {} is valid RTCRtpEncodingParameters because all fields are optional
     encodings.push({});
     assert_equals(param.encodings.length, 2);
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `sender.setParameters() with mismatch number of encodings should reject with InvalidModificationError`);
 
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
+
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     param.encodings = undefined;
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `sender.setParameters() with encodings unset should reject with InvalidModificationError`);
 
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
-
-    const param = sender.getParameters();
-    validateSenderRtpParameters(param);
-    const encoding = getFirstEncoding(param);
-    const { ssrc } = encoding;
-
-    // ssrc may not be set since it is optional
-    if(ssrc === undefined) {
-      encoding.ssrc = 2;
-    } else {
-      // If it is set, increase the number by 1 to make it different from original
-      encoding.ssrc = ssrc + 1;
-    }
-
-    return promise_rejects(t, 'InvalidModificationError',
-      sender.setParameters(param));
-  }, `setParameters() with modified encoding.ssrc field should reject with InvalidModificationError`);
-
-  promise_test(t => {
-    const pc = new RTCPeerConnection();
-    t.add_cleanup(() => pc.close());
-    const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
     const encoding = getFirstEncoding(param);
     const { rtx } = encoding;
 
     if(rtx === undefined) {
       encoding.rtx = { ssrc: 2 };
@@ -260,44 +251,23 @@
     } else {
       rtx.ssrc += 1;
     }
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `setParameters() with modified encoding.rtx field should reject with InvalidModificationError`);
 
-  promise_test(t => {
-    const pc = new RTCPeerConnection();
-    t.add_cleanup(() => pc.close());
-    const { sender } = pc.addTransceiver('audio');
-
-    const param = sender.getParameters();
-    validateSenderRtpParameters(param);
-    const encoding = getFirstEncoding(param);
-    const { fec } = encoding;
-
-    if(fec === undefined) {
-      encoding.fec = { ssrc: 2 };
-    } else if(fec.ssrc === undefined) {
-      fec.ssrc = 2;
-    } else {
-      fec.ssrc += 1;
-    }
-
-    return promise_rejects(t, 'InvalidModificationError',
-      sender.setParameters(param));
-  }, `setParameters() with modified encoding.fec field should reject with InvalidModificationError`);
-
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio', {
       sendEncodings: [{ rid: 'foo' }],
     });
+    await doOfferAnswerExchange(t, pc);
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
     const encoding = getFirstEncoding(param);
 
     assert_equals(encoding.rid, 'foo');
 
     encoding.rid = 'bar';
@@ -306,34 +276,36 @@
   }, `setParameters() with modified encoding.rid field should reject with InvalidModificationError`);
 
   /*
     5.2.  setParameters
       8.  If the scaleResolutionDownBy parameter in the parameters argument has a
           value less than 1.0, abort these steps and return a promise rejected with
           a newly created RangeError.
    */
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
     const encoding = getFirstEncoding(param);
 
     encoding.scaleResolutionDownBy = 0.5;
     return promise_rejects(t, 'RangeError',
       sender.setParameters(param));
   }, `setParameters() with encoding.scaleResolutionDownBy field set to less than 1.0 should reject with RangeError`);
 
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
     const encoding = getFirstEncoding(param);
 
     encoding.scaleResolutionDownBy = 1.5;
     return sender.setParameters(param)
     .then(() => {
@@ -341,57 +313,81 @@
       validateSenderRtpParameters(param);
       const encoding = getFirstEncoding(param);
 
       assert_approx_equals(encoding.scaleResolutionDownBy, 1.5, 0.01);
     });
   }, `setParameters() with encoding.scaleResolutionDownBy field set to greater than 1.0 should succeed`);
 
   // Helper function to test that modifying an encoding field should succeed
-  function test_modified_encoding(field, value1, value2, desc) {
-    promise_test(t => {
+  function test_modified_encoding(kind, field, value1, value2, desc) {
+    promise_test(async t => {
       const pc = new RTCPeerConnection();
       t.add_cleanup(() => pc.close());
-      const { sender } = pc.addTransceiver('audio', {
+      const { sender } = pc.addTransceiver(kind, {
         sendEncodings: [{
           [field]: value1
         }]
       });
+      await doOfferAnswerExchange(t, pc);
 
-      const param = sender.getParameters();
-      validateSenderRtpParameters(param);
-      const encoding = getFirstEncoding(param);
+      const param1 = sender.getParameters();
+      validateSenderRtpParameters(param1);
+      const encoding1 = getFirstEncoding(param1);
+
+      assert_equals(encoding1[field], value1);
+      encoding1[field] = value2;
 
-      assert_equals(encoding[field], value1);
-      encoding[field] = value2;
+      await sender.setParameters(param1);
+      const param2 = sender.getParameters();
+      validateSenderRtpParameters(param2);
+      const encoding2 = getFirstEncoding(param2);
+      assert_equals(encoding2[field], value2);
+    }, desc + ' with RTCRtpTransceiverInit');
 
-      return sender.setParameters(param)
-      .then(() => {
-        const param = sender.getParameters();
-        validateSenderRtpParameters(param);
-        const encoding = getFirstEncoding(param);
-        assert_equals(encoding[field], value2);
-      });
-    }, desc);
+    promise_test(async t => {
+      const pc = new RTCPeerConnection();
+      t.add_cleanup(() => pc.close());
+      const { sender } = pc.addTransceiver(kind);
+      await doOfferAnswerExchange(t, pc);
+
+      const initParam = sender.getParameters();
+      validateSenderRtpParameters(initParam);
+      initParam.encodings[0][field] = value1;
+      await sender.setParameters(initParam);
+
+      const param1 = sender.getParameters();
+      validateSenderRtpParameters(param1);
+      const encoding1 = getFirstEncoding(param1);
+
+      assert_equals(encoding1[field], value1);
+      encoding1[field] = value2;
+
+      await sender.setParameters(param1);
+      const param2 = sender.getParameters();
+      validateSenderRtpParameters(param2);
+      const encoding2 = getFirstEncoding(param2);
+      assert_equals(encoding2[field], value2);
+    }, desc + ' without RTCRtpTransceiverInit');
   }
 
-  test_modified_encoding('dtx', 'enabled', 'disabled',
+  test_modified_encoding('audio', 'dtx', 'enabled', 'disabled',
     'setParameters() with modified encoding.dtx should succeed');
 
-  test_modified_encoding('dtx', 'enabled', undefined,
+  test_modified_encoding('audio', 'dtx', 'enabled', undefined,
     'setParameters() with unset encoding.dtx should succeed');
 
-  test_modified_encoding('active', true, false,
+  test_modified_encoding('audio', 'active', false, true,
     'setParameters() with modified encoding.active should succeed');
 
-  test_modified_encoding('priority', 'very-low', 'high',
+  test_modified_encoding('audio', 'priority', 'very-low', 'high',
     'setParameters() with modified encoding.priority should succeed');
 
-  test_modified_encoding('ptime', 2, 4,
+  test_modified_encoding('audio', 'ptime', 2, 4,
     'setParameters() with modified encoding.ptime should succeed');
 
-  test_modified_encoding('maxBitrate', 2, 4,
+  test_modified_encoding('audio', 'maxBitrate', 10000, 20000,
     'setParameters() with modified encoding.maxBitrate should succeed');
 
-  test_modified_encoding('maxBitrate', 24, 16,
+  test_modified_encoding('video', 'maxFramerate', 24, 16,
     'setParameters() with modified encoding.maxFramerate should succeed');
 
 </script>
--- a/testing/web-platform/tests/webrtc/RTCRtpParameters-helper.js
+++ b/testing/web-platform/tests/webrtc/RTCRtpParameters-helper.js
@@ -3,16 +3,29 @@
 // Test is based on the following editor draft:
 // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html
 
 // Helper function for testing RTCRtpParameters dictionary fields
 
 // This file depends on dictionary-helper.js which should
 // be loaded from the main HTML file.
 
+// An offer/answer exchange is necessary for getParameters() to have any
+// negotiated parameters to return.
+async function doOfferAnswerExchange(t, caller) {
+  const callee = new RTCPeerConnection();
+  t.add_cleanup(() => callee.close());
+  const offer = await caller.createOffer();
+  await caller.setLocalDescription(offer);
+  await callee.setRemoteDescription(offer);
+  const answer = await callee.createAnswer();
+  await callee.setLocalDescription(answer);
+  await caller.setRemoteDescription(answer);
+}
+
 /*
   Validates the RTCRtpParameters returned from RTCRtpSender.prototype.getParameters
 
   5.2.  RTCRtpSender Interface
     getParameters
       - transactionId is set to a new unique identifier, used to match this getParameters
         call to a setParameters call that may occur later.
 
--- a/testing/web-platform/tests/webrtc/RTCRtpParameters-transactionId.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpParameters-transactionId.html
@@ -7,16 +7,17 @@
 <script src="RTCRtpParameters-helper.js"></script>
 <script>
   'use strict';
 
   // Test is based on the following editor draft:
   // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html
 
   // The following helper functions are called from RTCRtpParameters-helper.js:
+  //   doOfferAnswerExchange
   //   validateSenderRtpParameters
 
   /*
     5.1.  RTCPeerConnection Interface Extensions
       partial interface RTCPeerConnection {
         RTCRtpTransceiver           addTransceiver((MediaStreamTrack or DOMString) trackOrKind,
                                                    optional RTCRtpTransceiverInit init);
         ...
@@ -55,19 +56,20 @@
           getParameters call to a setParameters call that may occur later.
    */
 
   /*
     5.2.  getParameters
       - transactionId is set to a new unique identifier, used to match this
         getParameters call to a setParameters call that may occur later.
    */
-  test(() => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
 
     const param1 = sender.getParameters();
     const param2 = sender.getParameters();
 
     validateSenderRtpParameters(param1);
     validateSenderRtpParameters(param2);
 
     assert_not_equals(param1.transactionId, param2.transactionId);
@@ -78,63 +80,67 @@
     5.2.  setParameters
       7.  If parameters.encodings.length is different from N, or if any parameter
           in the parameters argument, marked as a Read-only parameter, has a value
           that is different from the corresponding parameter value returned from
           sender.getParameters(), abort these steps and return a promise rejected
           with a newly created InvalidModificationError. Note that this also applies
           to transactionId.
    */
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     const { transactionId } = param;
     param.transactionId = `${transactionId}-modified`;
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `sender.setParameters() with transaction ID different from last getParameters() should reject with InvalidModificationError`);
 
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     param.transactionId = undefined;
 
     return promise_rejects(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `sender.setParameters() with transaction ID unset should reject with InvalidModificationError`);
 
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     return sender.setParameters(param)
     .then(() =>
-      promise_rejects(t, 'InvalidModificationError',
+      promise_rejects(t, 'InvalidStateError',
         sender.setParameters(param)));
-  }, `setParameters() twice with the same parameters should reject with InvalidModificationError`);
+  }, `setParameters() twice with the same parameters should reject with InvalidStateError`);
 
-  promise_test(t => {
+  promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
+    await doOfferAnswerExchange(t, pc);
 
     const param1 = sender.getParameters();
     const param2 = sender.getParameters();
 
     validateSenderRtpParameters(param1);
     validateSenderRtpParameters(param2);
 
     assert_not_equals(param1.transactionId, param2.transactionId);