| <script src="../resources/js-test-pre.js"></script> |
| <script src="resources/audio-testing.js"></script> |
| <script src="resources/audiobuffersource-testing.js"></script> |
| <div id="description"></div> |
| description("Tests that AudioBufferSourceNode validates start and stop calls."); |
| testRunner.waitUntilDone(); |
| window.jsTestIsAsync = true; |
| var sampleRate = 44100.0; |
| var context = new webkitOfflineAudioContext(1, numberOfFrames, sampleRate); |
| bufferSource = context.createBufferSource(); |
| bufferSource.buffer = createTestBuffer(context, numberOfFrames); |
| bufferSource.connect(context.destination); |
| // 'stop' should be called only after 'start'. |
| shouldThrow("bufferSource.stop(0)", "'Error: InvalidStateError: DOM Exception 11'"); |
| // 'start' should be called only once. |
| shouldThrow("bufferSource.start(0)", "'Error: InvalidStateError: DOM Exception 11'"); |
| // 'stop' should be called only once. |
| shouldThrow("bufferSource.stop(0)", "'Error: InvalidStateError: DOM Exception 11'"); |
| context.oncomplete = finishJSTest; |
| context.startRendering(); |
| <script src="../resources/js-test-post.js"></script> |