Bug 1618225 - Added wpt test for loop with duration r=padenot
authorCorentin Arnould <koalab1999@gmail.com>
Wed, 24 Jun 2020 12:00:18 +0000
changeset 537108 feff7b5ed5b18b761f9e01e12a886d4c6a45c8a4
parent 537107 99ac03bfe9ce6e913ae3fa55fb8ce54ef98fbc15
child 537109 3a956cf3b8d34a361bf6897a30b99f9dc13eedc2
push id119816
push userpadenot@mozilla.com
push dateWed, 24 Jun 2020 12:05:27 +0000
treeherderautoland@feff7b5ed5b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1618225
milestone79.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 1618225 - Added wpt test for loop with duration r=padenot Silenced the mochitest Differential Revision: https://phabricator.services.mozilla.com/D79875
dom/media/webaudio/test/mochitest.ini
testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-duration-loop.html
--- a/dom/media/webaudio/test/mochitest.ini
+++ b/dom/media/webaudio/test/mochitest.ini
@@ -44,16 +44,17 @@ skip-if = !asan && toolkit != android # 
 [test_analyserNodeWithGain.html]
 skip-if = !asan && toolkit != android # These are tested in web-platform-tests, except on ASan and Android which don't run WPT.
 [test_analyserNodeMinimum.html]
 skip-if = !asan && toolkit != android # These are tested in web-platform-tests, except on ASan and Android which don't run WPT.
 [test_AudioBuffer.html]
 [test_audioBufferSourceNode.html]
 [test_audioBufferSourceNodeEnded.html]
 [test_audioBufferSourceNodeLazyLoopParam.html]
+skip-if = !asan && toolkit != android # These are tested in web-platform-tests, except on ASan and Android which don't run WPT.
 [test_audioBufferSourceNodeLoop.html]
 [test_audioBufferSourceNodeLoopStartEnd.html]
 [test_audioBufferSourceNodeLoopStartEndSame.html]
 [test_audioBufferSourceNodeDetached.html]
 skip-if = os == 'win' # bug 1127845, bug 1138468
 [test_audioBufferSourceNodeNoStart.html]
 [test_audioBufferSourceNodeNullBuffer.html]
 [test_audioBufferSourceNodeOffset.html]
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-duration-loop.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>
+      Test AudioBufferSourceNode With Looping And Duration
+    </title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="/webaudio/resources/audit-util.js"></script>
+    <script src="/webaudio/resources/audit.js"></script>
+  </head>
+  <body>
+    <script id="layout-test-code">
+      let audit = Audit.createTaskRunner();
+      audit.define('loop with duration', (task, should) => {
+        // Create the context
+        let context = new OfflineAudioContext(1, 4096, 48000);
+
+        // Create the sample buffer and fill the second half with 1
+        let buffer = context.createBuffer(1, 2048, context.sampleRate);
+        for(let i = 1024; i < 2048; i++) {
+          buffer.getChannelData(0)[i] = 1;
+        }
+
+        // Create the source and set its value
+        let source = context.createBufferSource();
+        source.loop = true;
+        source.loopStart = 1024 / context.sampleRate;
+        source.loopEnd = 2048 / context.sampleRate;
+        source.buffer = buffer;
+        source.connect(context.destination);
+        source.start(0, 1024 / context.sampleRate, 2048 / context.sampleRate);
+        // Render it!
+        context.startRendering()
+          .then(function(audioBuffer) {
+            for(let i = 0; i < 2048; i++) {
+              assert_equals(audioBuffer.getChannelData(0)[i], 1,
+                  "audioBuffer did not loop as intended");
+            }
+            for(let i = 2048; i < 4096; i++) {
+              assert_equals(audioBuffer.getChannelData(0)[i], 0,
+                  "audioBuffer did not respect duration");
+            }
+          })
+          .then(task.done());
+      });
+
+      audit.run();
+
+    </script>
+  </body>
+</html>