blob: a05d377fbd66ab0426338e504457a16590495d9f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>
Test Creation of Huge AudioBuffer
</title>
<script src="../../imported/w3c/web-platform-tests/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>