Bug 1493012 [wpt PR 13123] - Make DTMF tone change more deterministic, a=testonly
☠☠ backed out by 09dd66ffc95a ☠ ☠
authorHarald Alvestrand <hta@chromium.org>
Mon, 15 Oct 2018 17:15:53 +0000
changeset 489894 ed08ae0756f26271af55ca0fa0c3f293f34e7e2e
parent 489893 ecb9978f1b912df708d85e43961a62b26ce28c92
child 489895 758fc6b2f0291789d17f2aca267d8912e9470d9d
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerstestonly
bugs1493012, 13123, 816475, 1236337, 596180
milestone64.0a1
Bug 1493012 [wpt PR 13123] - Make DTMF tone change more deterministic, a=testonly Automatic update from web-platform-testsMake DTMF tone change more deterministic Moved the scheduling of subsequent tones from the webrtc layer to the blink layer. Revised the tests to remove the chance to sneak in extra tonechange events when overriding a remaining tone buffer. Also change "approximate timing" to "at least this long". Bug: chromium:816475 Change-Id: Id91011600b61f43152c8fb896d72433ccb871c61 Reviewed-on: https://chromium-review.googlesource.com/c/1236337 Commit-Queue: Harald Alvestrand <hta@chromium.org> Reviewed-by: Henrik Boström <hbos@chromium.org> Cr-Commit-Position: refs/heads/master@{#596180} -- wpt-commits: a67acb73fa2f29bb85ba29c428587dd12b8940bc wpt-pr: 13123
testing/web-platform/tests/webrtc/RTCDTMFSender-helper.js
testing/web-platform/tests/webrtc/RTCDTMFSender-ontonechange.https.html
--- a/testing/web-platform/tests/webrtc/RTCDTMFSender-helper.js
+++ b/testing/web-platform/tests/webrtc/RTCDTMFSender-helper.js
@@ -104,22 +104,26 @@ function test_tone_change_events(testFun
           `Expect current event.tone to be ${expectedTone}`);
 
         assert_equals(dtmfSender.toneBuffer, expectedToneBuffer,
           `Expect dtmfSender.toneBuffer to be updated to ${expectedToneBuffer}`);
 
         const now = Date.now();
         const duration = now - lastEventTime;
 
-        assert_approx_equals(duration, expectedDuration, 400,
+        // We check that the delay is at least the expected one, but
+        // system load may cause random delay, so we do not put any
+        // realistic upper bound on the timing of the event.
+        assert_between_inclusive(duration, expectedDuration,
+                                 expectedDuration + 4000,
           `Expect tonechange event for "${tone}" to be fired approximately after ${expectedDuration} milliseconds`);
 
         lastEventTime = now;
 
-        if(toneChanges.length === 0) {
+        if (toneChanges.length === 0) {
           // Wait for same duration as last expected duration + 100ms
           // before passing test in case there are new tone events fired,
           // in which case the test should fail.
           t.step_timeout(
             t.step_func(() => {
               t.done();
               pc.close();
               pc.otherPc.close();
--- a/testing/web-platform/tests/webrtc/RTCDTMFSender-ontonechange.https.html
+++ b/testing/web-platform/tests/webrtc/RTCDTMFSender-ontonechange.https.html
@@ -156,23 +156,17 @@
   /*
     7.2.  insertDTMF
       3.  If a Playout task is scheduled to be run, abort these steps;
           otherwise queue a task that runs the following steps (Playout task):
    */
   test_tone_change_events((t, dtmfSender) => {
     dtmfSender.addEventListener('tonechange', ev => {
       if(ev.tone === 'B') {
-        // Set a timeout to make sure the toneBuffer
-        // is changed after the tonechange event listener
-        // by test_tone_change_events is called.
-        // This is to correctly test the expected toneBuffer.
-        t.step_timeout(() => {
-          dtmfSender.insertDTMF('12', 100, 70);
-        }, 10);
+        dtmfSender.insertDTMF('12', 100, 70);
       }
     });
 
     dtmfSender.insertDTMF('ABC', 100, 70);
   }, [
     ['A', 'BC', 0],
     ['B', 'C', 170],
     ['1', '2', 170],
@@ -184,20 +178,18 @@
   /*
     7.2.  insertDTMF
       3.  If a Playout task is scheduled to be run, abort these steps;
           otherwise queue a task that runs the following steps (Playout task):
    */
   test_tone_change_events((t, dtmfSender) => {
     dtmfSender.addEventListener('tonechange', ev => {
       if(ev.tone === 'B') {
-        t.step_timeout(() => {
-          dtmfSender.insertDTMF('12', 100, 70);
-          dtmfSender.insertDTMF('34', 100, 70);
-        }, 10);
+        dtmfSender.insertDTMF('12', 100, 70);
+        dtmfSender.insertDTMF('34', 100, 70);
       }
     });
 
     dtmfSender.insertDTMF('ABC', 100, 70);
   }, [
     ['A', 'BC', 0],
     ['B', 'C', 170],
     ['3', '4', 170],
@@ -208,19 +200,17 @@
   /*
     7.2.  insertDTMF
       3.  If a Playout task is scheduled to be run, abort these steps;
           otherwise queue a task that runs the following steps (Playout task):
    */
   test_tone_change_events((t, dtmfSender) => {
     dtmfSender.addEventListener('tonechange', ev => {
       if(ev.tone === 'B') {
-        t.step_timeout(() => {
-          dtmfSender.insertDTMF('');
-        }, 10);
+        dtmfSender.insertDTMF('');
       }
     });
 
     dtmfSender.insertDTMF('ABC', 100, 70);
   }, [
     ['A', 'BC', 0],
     ['B', 'C', 170],
     ['', '', 170]