Bug 1414366 - Test ConstantSourceNode where stop has been called with the parameter lower or equal than the parameter to start. r=karlt

MozReview-Commit-ID: DDovVAs2M7S

--HG--
extra : rebase_source : 32ee0d65272b5751f2d41b5f6ea1cd3057fcec48
This commit is contained in:
Paul Adenot 2018-07-25 15:18:34 +02:00
parent bfb0d46900
commit 7996942c12

View File

@ -37,6 +37,42 @@
.then(() => task.done());
});
audit.define('stop before start', (task, should) => {
let context = new OfflineAudioContext(1, renderFrames, sampleRate);
let node = new ConstantSourceNode(context, {offset: 1});
node.connect(context.destination);
node.start(61 / context.sampleRate);
node.stop(31 / context.sampleRate);
context.startRendering()
.then(function(buffer) {
let actual = buffer.getChannelData(0);
should(actual,
"ConstantSourceNode with stop before " +
"start must output silence")
.beConstantValueOf(0);
})
.then(() => task.done());
});
audit.define('stop equal to start', (task, should) => {
let context = new OfflineAudioContext(1, renderFrames, sampleRate);
let node = new ConstantSourceNode(context, {offset: 1});
node.connect(context.destination);
node.start(31 / context.sampleRate);
node.stop(31 / context.sampleRate);
context.startRendering()
.then(function(buffer) {
let actual = buffer.getChannelData(0);
should(actual,
"ConstantSourceNode with stop equal to start " +
" must output silence")
.beConstantValueOf(0);
})
.then(() => task.done());
});
audit.define('start/stop', (task, should) => {
// Verify a constant source starts and stops at the correct time and has
// the correct (fixed) value.