Bug 1452516 [wpt PR 9941] - webrtc: improve Firefox compability of RTCDTMFHelper, a=testonly
authorHarald Alvestrand <hta+github@alvestrand.no>
Mon, 09 Apr 2018 14:35:49 +0000
changeset 466992 d2ed890844c3341dc121b710c86c265b576d5322
parent 466991 8e1b167b453a3f00854c8b5c49375ff2d3699c93
child 466993 15ae72c25b3ca9bf231619c2e655a63b483bd7e6
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1452516
milestone61.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 1452516 [wpt PR 9941] - webrtc: improve Firefox compability of RTCDTMFHelper, a=testonly Automatic update from web-platform-testsMerge pull request #9941 from fippo/better-dtmf-test-helper webrtc: improve Firefox compability of RTCDTMFHelper wpt-commits: 9c9d8f24b19b9a8b432c76db4ade468be8a50250 wpt-pr: 9941 wpt-commits: 9c9d8f24b19b9a8b432c76db4ade468be8a50250 wpt-pr: 9941
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/webrtc/RTCDTMFSender-helper.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -602129,17 +602129,17 @@
    "a3cdf93a5c3da4552c616f43e1fca01b9261dd38",
    "testharness"
   ],
   "webrtc/RTCConfiguration-rtcpMuxPolicy.html": [
    "a9beda60053916185106aedac98014123d6f7105",
    "testharness"
   ],
   "webrtc/RTCDTMFSender-helper.js": [
-   "79825a416ad8e027628e80c9e0ef1a8dca2d8ca3",
+   "26b5336881897c93fafd1ddf32910cf6fef16987",
    "support"
   ],
   "webrtc/RTCDTMFSender-insertDTMF.https.html": [
    "591337627bf4bd0e40e6a5660efa9fc1e320d89f",
    "testharness"
   ],
   "webrtc/RTCDTMFSender-ontonechange-long.https.html": [
    "d89602fd655bf032cadfc538291ccea858eb2446",
--- a/testing/web-platform/tests/webrtc/RTCDTMFSender-helper.js
+++ b/testing/web-platform/tests/webrtc/RTCDTMFSender-helper.js
@@ -9,54 +9,54 @@
 // The following helper functions are called from RTCPeerConnection-helper.js:
 //   getTrackFromUserMedia
 //   doSignalingHandshake
 
 // Create a RTCDTMFSender using getUserMedia()
 // Connect the PeerConnection to another PC and wait until it is
 // properly connected, so that DTMF can be sent.
 function createDtmfSender(pc = new RTCPeerConnection()) {
-  var dtmfSender;
+  let dtmfSender;
   return getTrackFromUserMedia('audio')
   .then(([track, mediaStream]) => {
     const sender = pc.addTrack(track, mediaStream);
     dtmfSender = sender.dtmf;
     assert_true(dtmfSender instanceof RTCDTMFSender,
                 'Expect audio sender.dtmf to be set to a RTCDTMFSender');
     // Note: spec bug open - https://github.com/w3c/webrtc-pc/issues/1774
     // on whether sending should be possible before negotiation.
     const pc2 = new RTCPeerConnection();
     Object.defineProperty(pc, 'otherPc', { value: pc2 });
     exchangeIceCandidates(pc, pc2);
     return doSignalingHandshake(pc, pc2);
   }).then(() => {
+    if (!('canInsertDTMF' in dtmfSender)) {
+      return Promise.resolve();
+    }
     // Wait until dtmfSender.canInsertDTMF becomes true.
     // Up to 150 ms has been observed in test. Wait 1 second
     // in steps of 10 ms.
     // Note: Using a short timeout and rejected promise in order to
     // make test return a clear error message on failure.
     return new Promise((resolve, reject) => {
       let counter = 0;
-      let checkfunc = function() {
+      step_timeout(function checkCanInsertDTMF() {
         if (dtmfSender.canInsertDTMF) {
           resolve();
         } else {
           if (counter >= 100) {
             reject('Waited too long for canInsertDTMF');
             return;
           }
           ++counter;
-          step_timeout(checkfunc, 10);
+          step_timeout(checkCanInsertDTMF, 10);
         }
-      };
-      checkfunc();
+      }, 0);
     });
   }).then(() => {
-    assert_true(dtmfSender.canInsertDTMF,
-                'Failed to create usable dtmfSender:');
     return dtmfSender;
   });
 }
 
 /*
   Create an RTCDTMFSender and test tonechange events on it.
     testFunc
       Test function that is going to manipulate the DTMFSender.