Bug 1041155 - The browser_wa_properties-view-media-nodes.js test doesn't wait for the audio device to be actually closed, r=paul.

This commit is contained in:
Florian Quèze 2014-07-19 20:08:28 +02:00
parent aba751a27d
commit 6ceb2243eb

View File

@ -8,6 +8,30 @@
let MEDIA_PERMISSION = "media.navigator.permission.disabled";
function waitForDeviceClosed() {
info("Checking that getUserMedia streams are no longer in use.");
let temp = {};
Cu.import("resource:///modules/webrtcUI.jsm", temp);
let webrtcUI = temp.webrtcUI;
if (!webrtcUI.showGlobalIndicator)
return Promise.resolve();
let deferred = Promise.defer();
const TOPIC = "recording-device-events";
Services.obs.addObserver(function deviceEventsObserver() {
info("Observing " + TOPIC);
if (!webrtcUI.showGlobalIndicator) {
Services.obs.removeObserver(deviceEventsObserver, TOPIC);
deferred.resolve();
}
}, TOPIC, false);
return deferred.promise;
}
function spawnTest() {
let [target, debuggee, panel] = yield initWebAudioEditor(MEDIA_NODES_URL);
let { panelWin } = panel;
@ -41,5 +65,8 @@ function spawnTest() {
Services.prefs.setBoolPref(MEDIA_PERMISSION, mediaPermissionPref);
yield teardown(panel);
yield waitForDeviceClosed();
finish();
}