<!DOCTYPE html>
<html>
  <head>
    <title>
      Test PeriodicWave exceptions
    </title>
    <script src="../../imported/w3c/web-platform-tests/resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>
    <script src="../resources/audit-util.js"></script>
    <script src="../resources/audit.js"></script>
  </head>
  <body>
    <script id="layout-test-code">
      let audit = Audit.createTaskRunner();

      audit.define(
          {
            label: 'non-finite values',
            description: 'Constructor should throw for non-finite coefficients'
          },
          (task, should) => {
            // Arbitrary context for testing.
            let context = new OfflineAudioContext(1, 1, 44100);

            should(
                () => context.createPeriodicWave([1, Infinity], [1, 1]),
                'createPeriodicWave([1, Infinity], [1,1])')
                .throw(TypeError);
            should(
                () => context.createPeriodicWave([1, NaN], [1, 1]),
                'createPeriodicWave([1, NaN], [1,1])')
                .throw(TypeError);
            should(
                () => context.createPeriodicWave([1, 1], [1, Infinity]),
                'createPeriodicWave([1, 1], [1, Infinity])')
                .throw(TypeError);
            should(
                () => context.createPeriodicWave([1, 1], [1, NaN]),
                'createPeriodicWave([1, 1], [1, NaN])')
                .throw(TypeError);
            task.done();
          });

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