Bug 1115779 - Fix devtools web audio intermittent timeouts by waiting for a tick before collecting nodes. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 19 May 2016 15:44:00 -0400
changeset 369146 a917f7712208fccd7cbdd7858bb0b9db58af4195
parent 369145 c0a6a1b663f7e38860dff1e11810efdf2902416f
child 369147 bf8d6578893967e467eb3b37617b8c12493b7272
push id18759
push userbmo:zer0@mozilla.com
push dateFri, 20 May 2016 14:22:18 +0000
reviewersjryans
bugs1115779
milestone49.0a1
Bug 1115779 - Fix devtools web audio intermittent timeouts by waiting for a tick before collecting nodes. r=jryans
devtools/client/webaudioeditor/test/browser_wa_destroy-node-01.js
devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js
--- a/devtools/client/webaudioeditor/test/browser_wa_destroy-node-01.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_destroy-node-01.js
@@ -33,16 +33,19 @@ add_task(function* () {
 
   // Flatten arrays of event arguments and take the first (AudioNodeModel)
   // and get its ID.
   let actorIDs = created.map(ev => ev[0].id);
 
   // Click a soon-to-be dead buffer node
   yield clickGraphNode(panelWin, actorIDs[5]);
 
+  // Wait for a tick before gc to prevent this test from intermittent timeout
+  // where the node never get collected.
+  yield DevToolsUtils.waitForTick();
   forceCC();
 
   // Wait for destruction and graph to re-render
   yield Promise.all([destroyed, waitForGraphRendered(panelWin, 3, 2)]);
 
   // Test internal storage
   is(panelWin.gAudioNodes.length, 3, "All nodes should be GC'd except one gain, osc and dest node.");
 
--- a/devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js
+++ b/devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js
@@ -11,16 +11,20 @@ add_task(function* () {
   let waitUntilDestroyed = getN(front, "destroy-node", 10);
   let [, , created] = yield Promise.all([
     front.setup({ reload: true }),
     once(front, "start-context"),
     // Should create 1 destination node and 10 disposable buffer nodes
     getN(front, "create-node", 13)
   ]);
 
+  // Wait for a tick before gc to prevent this test from intermittent timeout
+  // where the node never get collected.
+  yield DevToolsUtils.waitForTick();
+
   // Force CC so we can ensure it's run to clear out dead AudioNodes
   forceCC();
 
   let destroyed = yield waitUntilDestroyed;
 
   destroyed.forEach((node, i) => {
     ok(node.type, "AudioBufferSourceNode", "Only buffer nodes are destroyed");
     ok(actorIsInList(created, destroyed[i]),