diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js')
-rw-r--r-- | devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js b/devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js new file mode 100644 index 000000000..e48836c3f --- /dev/null +++ b/devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Test `destroy-node` event on WebAudioActor. + */ + +add_task(function* () { + let { target, front } = yield initBackend(DESTROY_NODES_URL); + + let [, , created] = yield Promise.all([ + front.setup({ reload: true }), + once(front, "start-context"), + // Should create dest, gain, and oscillator node and 10 + // disposable buffer nodes + getN(front, "create-node", 13) + ]); + + let waitUntilDestroyed = getN(front, "destroy-node", 10); + + // Force CC so we can ensure it's run to clear out dead AudioNodes + forceNodeCollection(); + + let destroyed = yield waitUntilDestroyed; + + destroyed.forEach((node, i) => { + ok(node.type, "AudioBufferSourceNode", "Only buffer nodes are destroyed"); + ok(actorIsInList(created, destroyed[i]), + "`destroy-node` called only on AudioNodes in current document."); + }); + + yield removeTab(target.tab); +}); + +function actorIsInList(list, actor) { + for (let i = 0; i < list.length; i++) { + if (list[i].actorID === actor.actorID) + return list[i]; + } + return null; +} |