bug 1184801 Test output of AnalyserNode with GainNode

--HG--
extra : rebase_source : 2158db1151e6b4dd3c862635c1bec4e0498a9135
This commit is contained in:
Karl Tomlinson 2015-07-28 11:03:31 +12:00
Родитель 8ea6318dc9
Коммит 0f7fc2c09c
1 изменённых файлов: 16 добавлений и 16 удалений

Просмотреть файл

@ -3,15 +3,17 @@
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script> <script>
async_test(function(t) { promise_test(function() {
// fftSize <= 128 so that the time domain data is full of input after // fftSize <= bufferSize so that the time domain data is full of input after
// notification that the first block has been processed. // processing the buffer.
const fftSize = 32; const fftSize = 32;
const bufferSize = 128;
var context = new AudioContext(); var context = new OfflineAudioContext(1, bufferSize, 48000);
var analyser1 = context.createAnalyser(); var analyser1 = context.createAnalyser();
analyser1.fftSize = fftSize; analyser1.fftSize = fftSize;
analyser1.connect(context.destination);
var analyser2 = context.createAnalyser(); var analyser2 = context.createAnalyser();
analyser2.fftSize = fftSize; analyser2.fftSize = fftSize;
@ -30,18 +32,16 @@ async_test(function(t) {
source.connect(gain); source.connect(gain);
source.start(); source.start();
// Waiting for an ended event ensures that the AnalyserNode has received the return context.startRendering().
// signal. then(function(buffer) {
var timer = context.createBufferSource(); assert_equals(buffer.getChannelData(0)[0], 1.0,
timer.buffer = buffer; "analyser1 output");
timer.onended = t.step_func_done(function() {
var data = new Float32Array(1);
analyser1.getFloatTimeDomainData(data);
assert_equals(data[0], 1.0, "analyser1 time domain data");
analyser2.getFloatTimeDomainData(data);
assert_equals(data[0], 1.0, "analyser2 time domain data");
});
timer.start() var data = new Float32Array(1);
analyser1.getFloatTimeDomainData(data);
assert_equals(data[0], 1.0, "analyser1 time domain data");
analyser2.getFloatTimeDomainData(data);
assert_equals(data[0], 1.0, "analyser2 time domain data");
});
}); });
</script> </script>