50 lines
1.4 KiB
HTML
50 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html>
|
|
<head>
|
|
<script src="../resources/js-test.js"></script>
|
|
<script src="resources/audio-testing.js"></script>
|
|
<script src="resources/delay-testing.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="description"></div>
|
|
<div id="console"></div>
|
|
|
|
<script>
|
|
description("Tests that AudioContext resume/suspend methods reject promises when called on an OfflineAudioContext.");
|
|
|
|
function runTest() {
|
|
window.jsTestIsAsync = true;
|
|
|
|
context = new OfflineAudioContext(1, sampleRate * renderLengthSeconds, sampleRate);
|
|
|
|
context.resume().then(function() {
|
|
testFailed('context.resume() promise resolved (should have rejected)');
|
|
finishJSTest();
|
|
}, function(e) {
|
|
if (e.name == 'InvalidStateError')
|
|
testPassed('context.resume() promise rejected with InvalidStateError value');
|
|
else
|
|
testFailed('context.resume() promise rejected, but without InvalidStateError value');
|
|
});
|
|
|
|
context.suspend().then(function() {
|
|
testFailed('context.suspend() promise resolved (should have rejected)');
|
|
finishJSTest();
|
|
}, function(e) {
|
|
if (e.name == 'TypeError')
|
|
testPassed('context.suspend() promise rejected with TypeError');
|
|
else
|
|
testFailed('context.suspend() promise rejected with ' + e.name + " instead of TypeError");
|
|
finishJSTest();
|
|
});
|
|
}
|
|
|
|
runTest();
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|