summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-already-has-value.html
blob: ce2d5fcfe940b89b4ed04bc62a7be5f15131b64b (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html>
  <head>
    <title>
      convolver-setBuffer-already-has-value.html
    </title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/webaudio/resources/audit.js"></script>
  </head>
  <body>
    <script id="layout-test-code">
      let audit = Audit.createTaskRunner();

      audit.define('test', (task, should) => {
        let context = new AudioContext();
        let audioBuffer = new AudioBuffer(
          {numberOfChannels: 1, length: 1, sampleRate: context.sampleRate});
        let convolver = context.createConvolver();
        should(() => {
          convolver.buffer = null;
        }, 'Set buffer to null before set non-null').notThrow();

        should(() => {
          convolver.buffer = audioBuffer;
        }, 'Set buffer first normally').notThrow();

        should(() => {
          convolver.buffer = audioBuffer;
        }, 'Set buffer a second time').notThrow();

        should(() => {
          convolver.buffer = null;
        }, 'Set buffer to null').notThrow();

        should(() => {
          convolver.buffer = null;
        }, 'Set buffer to null again, to make sure').notThrow();

        should(() => {
          convolver.buffer = audioBuffer;
        }, 'Set buffer to non-null to verify it is set')
        .notThrow();

        task.done();
      });

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