Bug 1493012 [wpt PR 13123] - Make DTMF tone change more deterministic, a=testonly
authorHarald Alvestrand <hta@chromium.org>
Mon, 15 Oct 2018 17:15:53 +0000
changeset 500204 bf515d03bd6690197dfd8ba855de58ba4b179994
parent 500203 6aa6516f8f09161281eceb008546506c6eeac0f3
child 500205 87535197cdb7d84bb7160c5639e3c4fcfee72492
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1493012, 13123, 816475, 1236337, 596180
milestone64.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 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]