summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-process-zero-outputs.https.html
blob: e1c19f0d759566f9d138eb2a05cc31e6d55575cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!doctype html>
<html>
  <head>
    <title>
      Test if |outputs| argument is all zero in AudioWorkletProcessor.process()
    </title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/webaudio/resources/audit.js"></script>
  </head>

  <body>
    <script>
      const audit = Audit.createTaskRunner();
      const filePath = 'processors/zero-outputs-check-processor.js';
      const context = new AudioContext();

      // Test if the incoming arrays are frozen as expected.
      audit.define('check-zero-outputs', (task, should) => {
        context.audioWorklet.addModule(filePath).then(() => {
          const workletNode =
              new AudioWorkletNode(context, 'zero-outputs-check-processor');
          workletNode.port.onmessage = (message) => {
            const actual = message.data;
            if (actual.type === 'assertion') {
              should(actual.success, actual.message).beTrue();
              task.done();
            }
          };
        });
      });

      audit.run();
    </script>
  </body>
</html>