Index: third_party/WebKit/LayoutTests/webaudio/scriptprocessornode.html |
diff --git a/third_party/WebKit/LayoutTests/webaudio/scriptprocessornode.html b/third_party/WebKit/LayoutTests/webaudio/scriptprocessornode.html |
deleted file mode 100644 |
index db7537f13bc4bb4f5c679741228c0af308340d37..0000000000000000000000000000000000000000 |
--- a/third_party/WebKit/LayoutTests/webaudio/scriptprocessornode.html |
+++ /dev/null |
@@ -1,173 +0,0 @@ |
-<!DOCTYPE html> |
-<html> |
-<head> |
-<script src="../resources/js-test.js"></script> |
-<script src="resources/compatibility.js"></script> |
-<script src="resources/audit-util.js"></script> |
-<script src="resources/audio-testing.js"></script> |
-</head> |
- |
-<body> |
- |
-<div id="description"></div> |
-<div id="console"></div> |
- |
-<script> |
-description("Tests ScriptProcessorNode."); |
- |
-var sampleRate = 44100.0; |
-var outputChannels = 6; |
-var playbackTime = 0.0; |
- |
-// For the current implementation of ScriptProcessorNode, when it works with OfflineAudioContext (which runs much faster |
-// than real-time) the event.inputBuffer might be overwrite again before onaudioprocess ever get chance to be called. |
-// We carefully arrange the renderLengthInFrames and bufferSize to have exactly the same value to avoid this issue. |
-var renderLengthInFrames = 512; |
-var bufferSize = 512; |
- |
-var context; |
- |
-function createBuffer(context, length) { |
- var audioBuffer = context.createBuffer(2, length, sampleRate); |
- var n = audioBuffer.length; |
- var dataL = audioBuffer.getChannelData(0); |
- var dataR = audioBuffer.getChannelData(1); |
- |
- for (var i = 0; i < n; ++i) { |
- dataL[i] = -1; |
- dataR[i] = 1; |
- } |
- |
- return audioBuffer; |
-} |
- |
-function processAudioData(event) { |
- playbackTime = event.playbackTime; |
- var expectedTime = context.currentTime + (bufferSize / context.sampleRate); |
- var allowedTimeGap = 0.0000001; |
- |
- // There may be a little time gap which is from different thread operation |
- // between currentTime when main thread fires onaudioprocess() and currentTime when read in JS |
- // since currentTime is continuously increasing on audio thread. |
- |
- shouldBeCloseTo("playbackTime", expectedTime, allowedTimeGap, true); |
- |
- buffer = event.outputBuffer; |
- if (buffer.numberOfChannels != outputChannels) |
- testFailed("numberOfOutputChannels doesn't match!"); |
- |
- if (buffer.length != bufferSize) |
- testFailed("numberOfOutputChannels doesn't match!"); |
- |
- buffer = event.inputBuffer; |
- var bufferDataL = buffer.getChannelData(0); |
- var bufferDataR = buffer.getChannelData(1); |
- |
- var success = true; |
- // Go through every sample and make sure it's all -1 for the left-channel, and all +1 for the right-channel. |
- for (var i = 0; i < buffer.length; ++i) { |
- if (bufferDataL[i] != -1 || bufferDataR[i] != 1) { |
- success = false; |
- break; |
- } |
- } |
- |
- if (success) { |
- testPassed("onaudioprocess was called with correct data."); |
- } else { |
- testFailed("onaudioprocess was called with wrong data."); |
- } |
-} |
- |
-function doBufferSizeTest(size) { |
- try { |
- var jsnode = context.createScriptProcessor(size, 1, 1); |
- testPassed("Successfully created ScriptProcessorNode with bufferSize = " + size + "."); |
- } catch(e) { |
- testFailed("Failed to create ScriptProcessorNode with bufferSize = " + size + "."); |
- } |
-} |
- |
-function runTest() { |
- if (window.testRunner) { |
- testRunner.dumpAsText(); |
- testRunner.waitUntilDone(); |
- } |
- |
- window.jsTestIsAsync = true; |
- |
- // Create offline audio context. |
- context = new OfflineAudioContext(2, renderLengthInFrames, sampleRate); |
- |
- try { |
- var jsnode = context.createScriptProcessor(512, 0, 0); |
- testFailed("Exception should be thrown when both numberOfInputChannels and numberOfOutputChannels are zero."); |
- } catch(e) { |
- testPassed("Exception was thrown when both numberOfInputChannels and numberOfOutputChannels are zero."); |
- } |
- |
- try { |
- var jsnode = context.createScriptProcessor(512, 1, 0); |
- testPassed("Successfully created ScriptProcessorNode with numberOfInputChannels = 1 and numberOfOutputChannels = 0."); |
- } catch(e) { |
- testFailed("Exception should not be thrown when numberOfInputChannels = 1 and numberOfOutputChannels = 0."); |
- } |
- |
- try { |
- var jsnode = context.createScriptProcessor(512, 2, 0); |
- testPassed("Successfully created ScriptProcessorNode with numberOfInputChannels = 2 and numberOfOutputChannels = 0."); |
- } catch(e) { |
- testFailed("Exception should not be thrown when numberOfInputChannels = 2 and numberOfOutputChannels = 0."); |
- } |
- |
- try { |
- var jsnode = context.createScriptProcessor(512, 0, 1); |
- testPassed("Successfully created ScriptProcessorNode with numberOfInputChannels = 0 and numberOfOutputChannels = 1."); |
- } catch(e) { |
- testFailed("Exception should not be thrown when numberOfInputChannels = 0 and numberOfOutputChannels = 1."); |
- } |
- |
- try { |
- var jsnode = context.createScriptProcessor(512, 0, 2); |
- testPassed("Successfully created ScriptProcessorNode with numberOfInputChannels = 0 and numberOfOutputChannels = 2."); |
- } catch(e) { |
- testFailed("Exception should not be thrown when numberOfInputChannels = 0 and numberOfOutputChannels = 2."); |
- } |
- |
- try { |
- var jsnode = context.createScriptProcessor(511, 1, 1); |
- testFailed("Exception should be thrown for illegal bufferSize."); |
- } catch(e) { |
- testPassed("Exception was thrown for illegal bufferSize."); |
- } |
- |
- doBufferSizeTest(256); |
- doBufferSizeTest(512); |
- doBufferSizeTest(1024); |
- doBufferSizeTest(2048); |
- doBufferSizeTest(4096); |
- doBufferSizeTest(8192); |
- doBufferSizeTest(16384); |
- |
- var sourceBuffer = createBuffer(context, renderLengthInFrames); |
- |
- var bufferSource = context.createBufferSource(); |
- bufferSource.buffer = sourceBuffer; |
- |
- var jsnode = context.createScriptProcessor(bufferSize, 2, outputChannels); |
- |
- bufferSource.connect(jsnode); |
- jsnode.connect(context.destination); |
- jsnode.onaudioprocess = processAudioData; |
- |
- bufferSource.start(0); |
- context.oncomplete = finishJSTest; |
- context.startRendering(); |
-} |
- |
-runTest(); |
- |
-</script> |
- |
-</body> |
-</html> |