Bug 1506994 [wpt PR 14040] - Replace direct use of offerToReceiveAudio by generateAudioReceiveOnlyOffer, a=testonly
authorYouenn Fablet <youennf@gmail.com>
Mon, 19 Nov 2018 18:44:54 +0000
changeset 506749 f3f2be0cb3a60faebeea01707113df9e53a0f1fe
parent 506748 821fa7cd9dd5107388e09abe39e79fc1ba6cad0a
child 506750 2cf194f546b2f3818e7f79b4e13bb0cc4e5f37cc
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
bugs1506994, 14040
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 1506994 [wpt PR 14040] - Replace direct use of offerToReceiveAudio by generateAudioReceiveOnlyOffer, a=testonly Automatic update from web-platform-testsReplace direct use of offerToReceiveAudio by generateAudioReceiveOnlyOffer. This allows to use non legacy APIs by default if supported. -- Merge pull request #14040 from youennf/remove-offerToReceiveAudio-use-outside-legacy Replace direct use of offerToReceiveAudio by generateAudioReceiveOnlyOffer -- wpt-commits: 27e0acb4312abf064d6491ff29db3852a958dff8, 42abd6cc7ebd7c0b0513639e1a8c1bd958638fed wpt-pr: 14040
testing/web-platform/tests/webrtc/RTCConfiguration-rtcpMuxPolicy.html
testing/web-platform/tests/webrtc/RTCPeerConnection-iceGatheringState.html
testing/web-platform/tests/webrtc/RTCPeerConnection-onnegotiationneeded.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-rollback.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-offer.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback.html
--- a/testing/web-platform/tests/webrtc/RTCConfiguration-rtcpMuxPolicy.html
+++ b/testing/web-platform/tests/webrtc/RTCConfiguration-rtcpMuxPolicy.html
@@ -1,13 +1,14 @@
 <!doctype html>
 <title>RTCConfiguration rtcpMuxPolicy</title>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="RTCConfiguration-helper.js"></script>
+<script src="RTCPeerConnection-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 function is called from RTCConfiguration-helper.js:
   //   config_test
@@ -183,13 +184,13 @@
         'a=fingerprint:sha-256 ' + FINGERPRINT_SHA256 + '\r\n' +
         'a=setup:active\r\n' +
         'a=sendonly\r\n' +
         'a=rtcp-rsize\r\n' +
         'a=rtpmap:111 opus/48000/2\r\n';
     const pc = new RTCPeerConnection({rtcpMuxPolicy: 'require'});
     t.add_cleanup(() => pc.close());
 
-    await pc.createOffer({offerToReceiveAudio: true})
-      .then(offer => pc.setLocalDescription(offer));
+    const offer = await generateAudioReceiveOnlyOffer(pc);
+    await pc.setLocalDescription(offer);
     return promise_rejects(t, 'InvalidAccessError', pc.setRemoteDescription({type: 'answer', sdp}));
   }, 'setRemoteDescription throws InvalidAccessError when called with an answer without rtcp-mux and rtcpMuxPolicy is set to require');
 </script>
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-iceGatheringState.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-iceGatheringState.html
@@ -6,18 +6,19 @@
 <script src="RTCPeerConnection-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 RTCPeerConnection-helper.js:
+  // doSignalingHandshake
   // exchangeIceCandidates
-  // doSignalingHandshake
+  // generateAudioReceiveOnlyOffer
 
   /*
     4.3.2.  Interface Definition
       interface RTCPeerConnection : EventTarget {
         ...
         readonly  attribute RTCIceGatheringState   iceGatheringState;
                   attribute EventHandler           onicegatheringstatechange;
       };
@@ -67,17 +68,17 @@
       }
     });
 
     assert_equals(pc.onicegatheringstatechange, null,
       'Expect connection to have icegatheringstatechange event');
 
     pc.addEventListener('icegatheringstatechange', onIceGatheringStateChange);
 
-    pc.createOffer({ offerToReceiveAudio: true })
+    generateAudioReceiveOnlyOffer(pc)
     .then(offer => pc.setLocalDescription(offer))
     .then(err => t.step_func(err =>
       assert_unreached(`Unhandled rejection ${err.name}: ${err.message}`)));
   }, 'iceGatheringState should eventually become complete after setLocalDescription');
 
   /*
     4.4.2.  RTCIceGatheringState Enum
       gathering
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-onnegotiationneeded.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-onnegotiationneeded.html
@@ -7,16 +7,17 @@
 <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 RTCPeerConnection-helper.js:
   //   generateAnswer
+  //   generateAudioReceiveOnlyOffer
   //   test_never_resolve
 
   // Listen to the negotiationneeded event on a peer connection
   // Returns a promise that resolves when the first event is fired.
   // The resolve result is a dictionary with event and nextPromise,
   // which resolves when the next negotiationneeded event is fired.
   // This allow us to promisify the event listening and assert whether
   // an event is fired or not by testing whether a promise is resolved.
@@ -160,17 +161,17 @@
     4.7.3.  Updating the Negotiation-Needed flag
       To update the negotiation-needed flag
       2.  If connection's signaling state is not "stable", abort these steps.
    */
   test_never_resolve(t => {
     const pc = new RTCPeerConnection();
     const negotiated = awaitNegotiation(pc);
 
-    return pc.createOffer({ offerToReceiveAudio: true })
+    return generateAudioReceiveOnlyOffer(pc)
     .then(offer => pc.setLocalDescription(offer))
     .then(() => negotiated)
     .then(({nextPromise}) => {
       assert_equals(pc.signalingState, 'have-local-offer');
       pc.createDataChannel('test');
       return nextPromise;
     });
   }, 'negotiationneeded event should not fire if signaling state is not stable');
@@ -185,17 +186,17 @@
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return assert_first_promise_fulfill_after_second(
       awaitNegotiation(pc),
-      pc.createOffer({ offerToReceiveAudio: true })
+      generateAudioReceiveOnlyOffer(pc)
       .then(offer =>
         pc.setLocalDescription(offer)
         .then(() => {
           pc.createDataChannel('test');
           return generateAnswer(offer);
         }))
       .then(answer => pc.setRemoteDescription(answer)),
       'Expect negotiationneeded promise to resolve after pc has set remote answer and go back to stable state');
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-rollback.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-rollback.html
@@ -7,16 +7,17 @@
 <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 RTCPeerConnection-helper.js:
   //   assert_session_desc_similar
+  //   generateAudioReceiveOnlyOffer
 
   /*
     4.3.2.  Interface Definition
       [Constructor(optional RTCConfiguration configuration)]
       interface RTCPeerConnection : EventTarget {
         Promise<void>                      setLocalDescription(
             RTCSessionDescriptionInit description);
 
@@ -100,17 +101,17 @@
     t.add_cleanup(() => pc.close());
     return promise_rejects(t, 'InvalidStateError',
       pc.setLocalDescription({ type: 'rollback' }));
   }, `setLocalDescription(rollback) from stable state should reject with InvalidStateError`);
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
-    return pc.createOffer({ offerToReceiveAudio: true })
+    return generateAudioReceiveOnlyOffer(pc)
     .then(offer =>
       pc.setRemoteDescription(offer)
       .then(() => pc.createAnswer()))
     .then(answer => pc.setLocalDescription(answer))
     .then(() => {
       return promise_rejects(t, 'InvalidStateError',
         pc.setLocalDescription({ type: 'rollback' }));
     });
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-offer.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-offer.html
@@ -7,16 +7,17 @@
 <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 RTCPeerConnection-helper.js:
   //   assert_session_desc_similar()
+  //   generateAudioReceiveOnlyOffer
 
   /*
     4.3.2.  Interface Definition
       [Constructor(optional RTCConfiguration configuration)]
       interface RTCPeerConnection : EventTarget {
         Promise<void>                      setRemoteDescription(
             RTCSessionDescriptionInit description);
 
@@ -110,17 +111,17 @@
 
     const states = [];
     pc2.addEventListener('signalingstatechange', () => states.push(pc2.signalingState));
 
     return pc1.createOffer()
     .then(offer1 => {
       return pc1.setLocalDescription(offer1)
        .then(()=> {
-        return pc1.createOffer({ offerToReceiveAudio: true })
+        return generateAudioReceiveOnlyOffer(pc1)
         .then(offer2 => {
           assert_session_desc_not_similar(offer1, offer2);
 
           return pc2.setRemoteDescription(offer1)
           .then(() => pc2.setRemoteDescription(offer2))
           .then(() => {
             assert_equals(pc2.signalingState, 'have-remote-offer');
             assert_session_desc_similar(pc2.remoteDescription, offer2);
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback.html
@@ -6,18 +6,19 @@
 <script src="RTCPeerConnection-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 RTCPeerConnection-helper.js:
+  //   assert_session_desc_similar
+  //   generateAudioReceiveOnlyOffer
   //   generateDataChannelOffer
-  //   assert_session_desc_similar
 
   /*
     4.3.2.  Interface Definition
       [Constructor(optional RTCConfiguration configuration)]
       interface RTCPeerConnection : EventTarget {
         Promise<void>                      setLocalDescription(
             RTCSessionDescriptionInit description);
 
@@ -100,17 +101,17 @@
     t.add_cleanup(() => pc.close());
     return promise_rejects(t, 'InvalidStateError',
       pc.setRemoteDescription({ type: 'rollback' }));
   }, `setRemoteDescription(rollback) from stable state should reject with InvalidStateError`);
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
-    return pc.createOffer({ offerToReceiveAudio: true })
+    return generateAudioReceiveOnlyOffer(pc)
     .then(offer => pc.setRemoteDescription(offer))
     .then(() => pc.setRemoteDescription({
       type: 'rollback',
       sdp: '!<Invalid SDP Content>;'
     }));
   }, `setRemoteDescription(rollback) should ignore invalid sdp content and succeed`);
 
 </script>