зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1154019 - Intermittent browser_devices_get_user_media.js | Test timed out | Found a Browser:WebRTCGlobalIndicator, r=Gijs.
This commit is contained in:
Родитель
e09d0ceffd
Коммит
a1f39c6d73
|
@ -242,6 +242,7 @@ let gTests = [
|
|||
is(PopupNotifications.panel.firstChild.getAttribute("popupid"),
|
||||
"webRTC-shareDevices", "panel using devices icon");
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -250,6 +251,7 @@ let gTests = [
|
|||
is(getMediaCaptureState(), "CameraAndMicrophone",
|
||||
"expected camera and microphone to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({audio: true, video: true});
|
||||
yield closeStream();
|
||||
}
|
||||
|
@ -270,6 +272,7 @@ let gTests = [
|
|||
is(PopupNotifications.panel.firstChild.getAttribute("popupid"),
|
||||
"webRTC-shareMicrophone", "panel using microphone icon");
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -277,6 +280,7 @@ let gTests = [
|
|||
expectObserverCalled("recording-device-events");
|
||||
is(getMediaCaptureState(), "Microphone", "expected microphone to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({audio: true});
|
||||
yield closeStream();
|
||||
}
|
||||
|
@ -297,6 +301,7 @@ let gTests = [
|
|||
is(PopupNotifications.panel.firstChild.getAttribute("popupid"),
|
||||
"webRTC-shareDevices", "panel using devices icon");
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -304,6 +309,7 @@ let gTests = [
|
|||
expectObserverCalled("recording-device-events");
|
||||
is(getMediaCaptureState(), "Camera", "expected camera to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({video: true});
|
||||
yield closeStream();
|
||||
}
|
||||
|
@ -322,6 +328,7 @@ let gTests = [
|
|||
// disable the camera
|
||||
enableDevice("Camera", false);
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -334,6 +341,7 @@ let gTests = [
|
|||
is(getMediaCaptureState(), "Microphone",
|
||||
"expected microphone to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({audio: true});
|
||||
yield closeStream();
|
||||
}
|
||||
|
@ -352,6 +360,7 @@ let gTests = [
|
|||
// disable the microphone
|
||||
enableDevice("Microphone", false);
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -364,6 +373,7 @@ let gTests = [
|
|||
is(getMediaCaptureState(), "Camera",
|
||||
"expected microphone to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({video: true});
|
||||
yield closeStream();
|
||||
}
|
||||
|
@ -427,6 +437,7 @@ let gTests = [
|
|||
expectObserverCalled("getUserMedia:request");
|
||||
checkDeviceSelectors(true, true);
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -435,6 +446,7 @@ let gTests = [
|
|||
is(getMediaCaptureState(), "CameraAndMicrophone",
|
||||
"expected camera and microphone to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({video: true, audio: true});
|
||||
|
||||
yield promiseNotificationShown(PopupNotifications.getNotification("webRTC-sharingDevices"));
|
||||
|
@ -469,6 +481,7 @@ let gTests = [
|
|||
expectObserverCalled("getUserMedia:request");
|
||||
checkDeviceSelectors(true, true);
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -477,6 +490,7 @@ let gTests = [
|
|||
is(getMediaCaptureState(), "CameraAndMicrophone",
|
||||
"expected camera and microphone to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({video: true, audio: true});
|
||||
|
||||
yield promiseNotificationShown(PopupNotifications.getNotification("webRTC-sharingDevices"));
|
||||
|
@ -730,6 +744,7 @@ let gTests = [
|
|||
Perms.add(uri, "microphone", Perms.ALLOW_ACTION);
|
||||
Perms.add(uri, "camera", Perms.ALLOW_ACTION);
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
// Start sharing what's been requested.
|
||||
yield promiseMessage("ok", () => {
|
||||
content.wrappedJSObject.requestDevice(aRequestAudio, aRequestVideo);
|
||||
|
@ -737,6 +752,7 @@ let gTests = [
|
|||
expectObserverCalled("getUserMedia:request");
|
||||
expectObserverCalled("getUserMedia:response:allow");
|
||||
expectObserverCalled("recording-device-events");
|
||||
yield indicator;
|
||||
yield checkSharingUI({video: aRequestVideo, audio: aRequestAudio});
|
||||
|
||||
yield promiseNotificationShown(PopupNotifications.getNotification("webRTC-sharingDevices"));
|
||||
|
@ -801,6 +817,7 @@ let gTests = [
|
|||
expectObserverCalled("getUserMedia:request");
|
||||
checkDeviceSelectors(false, true);
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -808,6 +825,7 @@ let gTests = [
|
|||
expectObserverCalled("recording-device-events");
|
||||
is(getMediaCaptureState(), "Camera", "expected camera to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({video: true});
|
||||
|
||||
yield promisePopupNotificationShown("webRTC-sharingDevices", () => {
|
||||
|
|
|
@ -241,6 +241,7 @@ let gTests = [
|
|||
is(PopupNotifications.panel.firstChild.getAttribute("popupid"),
|
||||
"webRTC-shareDevices", "panel using devices icon");
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -249,6 +250,7 @@ let gTests = [
|
|||
is(getMediaCaptureState(), "CameraAndMicrophone",
|
||||
"expected camera and microphone to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({audio: true, video: true});
|
||||
yield closeStream(global);
|
||||
}
|
||||
|
@ -265,6 +267,7 @@ let gTests = [
|
|||
expectObserverCalled("getUserMedia:request");
|
||||
checkDeviceSelectors(true, true);
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -273,6 +276,7 @@ let gTests = [
|
|||
is(getMediaCaptureState(), "CameraAndMicrophone",
|
||||
"expected camera and microphone to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({video: true, audio: true});
|
||||
|
||||
yield promiseNotificationShown(PopupNotifications.getNotification("webRTC-sharingDevices"));
|
||||
|
@ -308,6 +312,7 @@ let gTests = [
|
|||
expectObserverCalled("getUserMedia:request");
|
||||
checkDeviceSelectors(true, true);
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -316,6 +321,7 @@ let gTests = [
|
|||
is(getMediaCaptureState(), "CameraAndMicrophone",
|
||||
"expected camera and microphone to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({video: true, audio: true});
|
||||
|
||||
info("reloading the frame");
|
||||
|
@ -370,6 +376,7 @@ let gTests = [
|
|||
expectObserverCalled("getUserMedia:request");
|
||||
checkDeviceSelectors(true, false);
|
||||
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstChild.button.click();
|
||||
});
|
||||
|
@ -377,6 +384,7 @@ let gTests = [
|
|||
expectObserverCalled("recording-device-events");
|
||||
is(getMediaCaptureState(), "Microphone", "microphone to be shared");
|
||||
|
||||
yield indicator;
|
||||
yield checkSharingUI({video: false, audio: true});
|
||||
expectNoObserverCalled();
|
||||
|
||||
|
|
|
@ -633,21 +633,33 @@ function waitForNewTabEvent(aTabBrowser) {
|
|||
* @resolves to the window
|
||||
*/
|
||||
function promiseWindow(url) {
|
||||
info("waiting for a " + url + " window");
|
||||
info("expecting a " + url + " window");
|
||||
return new Promise(resolve => {
|
||||
Services.obs.addObserver(function obs(win) {
|
||||
win.QueryInterface(Ci.nsIDOMWindow);
|
||||
if (win.location.href !== url) {
|
||||
info("ignoring a window with this url: " + win.location.href);
|
||||
return;
|
||||
}
|
||||
win.addEventListener("load", function loadHandler() {
|
||||
win.removeEventListener("load", loadHandler);
|
||||
|
||||
Services.obs.removeObserver(obs, "domwindowopened");
|
||||
resolve(win);
|
||||
if (win.location.href !== url) {
|
||||
info("ignoring a window with this url: " + win.location.href);
|
||||
return;
|
||||
}
|
||||
|
||||
Services.obs.removeObserver(obs, "domwindowopened");
|
||||
resolve(win);
|
||||
});
|
||||
}, "domwindowopened", false);
|
||||
});
|
||||
}
|
||||
|
||||
function promiseIndicatorWindow() {
|
||||
// We don't show the indicator window on Mac.
|
||||
if ("nsISystemStatusBar" in Ci)
|
||||
return Promise.resolve();
|
||||
|
||||
return promiseWindow("chrome://browser/content/webrtcIndicator.xul");
|
||||
}
|
||||
|
||||
function assertWebRTCIndicatorStatus(expected) {
|
||||
let ui = Cu.import("resource:///modules/webrtcUI.jsm", {}).webrtcUI;
|
||||
let expectedState = expected ? "visible" : "hidden";
|
||||
|
@ -694,9 +706,6 @@ function assertWebRTCIndicatorStatus(expected) {
|
|||
});
|
||||
}
|
||||
}
|
||||
if (expected &&
|
||||
!Services.wm.getMostRecentWindow("Browser:WebRTCGlobalIndicator"))
|
||||
yield promiseWindow("chrome://browser/content/webrtcIndicator.xul");
|
||||
let indicator = Services.wm.getEnumerator("Browser:WebRTCGlobalIndicator");
|
||||
let hasWindow = indicator.hasMoreElements();
|
||||
is(hasWindow, !!expected, "popup " + msg);
|
||||
|
|
Загрузка…
Ссылка в новой задаче