Backed out changeset e82170d665d8 (bug 1087944)

This commit is contained in:
Ryan VanderMeulen 2014-11-26 17:40:42 -05:00
parent 165f8e61c9
commit 96b12573a9

View File

@ -10,17 +10,6 @@
<pre id="test">
<script class="testbody" type="text/javascript">
var renderedBuffer = null;
function setOrCompareRenderedBuffer(aRenderedBuffer) {
if (renderedBuffer) {
is(renderedBuffer, aRenderedBuffer, "Rendered buffers from the event and the promise should be the same");
SimpleTest.finish();
} else {
renderedBuffer = aRenderedBuffer;
}
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var ctx = new OfflineAudioContext(2, 100, 22050);
@ -58,31 +47,18 @@ addLoadEvent(function() {
src.buffer = buf;
src.start(0);
src.connect(ctx.destination);
ctx.startRendering();
ctx.addEventListener("complete", function(e) {
ok(e instanceof OfflineAudioCompletionEvent, "Correct event received");
is(e.renderedBuffer.numberOfChannels, 2, "Correct expected number of buffers");
ok(renderedBuffer != null, "The event should be fired after the promise callback.");
expectNoException(function() {
ctx.startRendering().then(function() {
ok(false, "Promise should not resolve when startRendering is called a second time on an OfflineAudioContext")
}).catch(function(err) {
ok(true, "Promise should reject when startRendering is called a second time on an OfflineAudioContext")
});
});
compareBuffers(e.renderedBuffer, buf);
setOrCompareRenderedBuffer(e.renderedBuffer);
expectException(function() {
ctx.startRendering();
}, DOMException.INVALID_STATE_ERR);
SimpleTest.finish();
}, false);
expectNoException(function() {
ctx.startRendering().then(function(b) {
is(renderedBuffer, null, "The promise callback should be called first.");
setOrCompareRenderedBuffer(b);
}).catch(function (error) {
ok(false, "The promise from OfflineAudioContext.startRendering should never be rejected");
});
});
});
</script>