chromium/third_party/blink/web_tests/webaudio/AudioBuffer/huge-buffer.html

<!DOCTYPE html>
<html>
  <head>
    <title>
      Test Creation of Huge AudioBuffer
    </title>
    <script src="../../resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>
    <script src="../resources/audit.js"></script>
  </head>
  <body>
    <script id="layout-test-code">
      let audit = Audit.createTaskRunner();

      audit.define('huge buffer', (task, should) => {
        // Set options to try to allocate a huge amount of memory in an
        // AudioBuffer. This should fail gracefully with an error instead of
        // crashing with an OOM error.
        let options = {
          numberOfChannels: 32,
          length: 1 << 30,
          sampleRate: 16000
        };
        should(
            () => new AudioBuffer(options),
            'new AudioBuffer(' + JSON.stringify(options) + ')')
            .throw(DOMException, 'NotSupportedError');
        task.done();
      });

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