Bug 1635716 - Test that pending gUM requests are removed on navigation. r=ng a=pascalc
authorJan-Ivar Bruaroey <jib@mozilla.com>
Mon, 18 May 2020 19:49:01 +0000
changeset 591506 7e54014f11535023ffdb6ac56f99712e6b45c188
parent 591505 f482287318ff33b7ff954172acbae5a2aa7f6137
child 591507 cc5b1a7031f56cc977da784f861e64c692771a8d
push id13159
push userarchaeopteryx@coole-files.de
push dateTue, 19 May 2020 14:56:30 +0000
treeherdermozilla-beta@d1a9d96c3989 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersng, pascalc
bugs1635716
milestone77.0
Bug 1635716 - Test that pending gUM requests are removed on navigation. r=ng a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D75631
browser/base/content/test/webrtc/browser_devices_get_user_media_queue_request.js
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_queue_request.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_queue_request.js
@@ -202,13 +202,80 @@ var gTests = [
 
       SitePermissions.removeFromPrincipal(
         null,
         "microphone",
         gBrowser.selectedBrowser
       );
     },
   },
+
+  {
+    desc: "test queueing audio, video behind reload after pending audio, video",
+    run: async function testQueuingDenyAudioBehindAllowVideo() {
+      let observerPromise = expectObserverCalled("getUserMedia:request");
+      let promise = promisePopupNotificationShown("webRTC-shareDevices");
+      await promiseRequestDevice(true, false);
+      await promiseRequestDevice(false, true);
+      await promise;
+      await observerPromise;
+      checkDeviceSelectors(true, false);
+
+      await reloadAndAssertClosedStreams();
+
+      observerPromise = expectObserverCalled("getUserMedia:request");
+      // After the reload, gUM(audio) causes a prompt.
+      promise = promisePopupNotificationShown("webRTC-shareDevices");
+      await promiseRequestDevice(true, false);
+      await promiseRequestDevice(false, true);
+      await promise;
+      await observerPromise;
+      checkDeviceSelectors(true, false);
+
+      let indicator = promiseIndicatorWindow();
+      let observerPromise1 = expectObserverCalled(
+        "getUserMedia:response:allow"
+      );
+      let observerPromise2 = expectObserverCalled("recording-device-events");
+
+      // expect pending camera prompt to appear after ok'ing microphone one.
+      observerPromise = expectObserverCalled("getUserMedia:request");
+      promise = promisePopupNotificationShown("webRTC-shareDevices");
+
+      await promiseMessage("ok", () => {
+        PopupNotifications.panel.firstElementChild.button.click();
+      });
+      await observerPromise1;
+      await observerPromise2;
+      Assert.deepEqual(
+        await getMediaCaptureState(),
+        { audio: true },
+        "expected microphone to be shared"
+      );
+      await indicator;
+      await checkSharingUI({ video: false, audio: true });
+
+      await promise;
+      await observerPromise;
+      checkDeviceSelectors(false, true);
+
+      observerPromise1 = expectObserverCalled("getUserMedia:response:allow");
+      observerPromise2 = expectObserverCalled("recording-device-events");
+      await promiseMessage("ok", () => {
+        PopupNotifications.panel.firstElementChild.button.click();
+      });
+      await observerPromise1;
+      await observerPromise2;
+      Assert.deepEqual(
+        await getMediaCaptureState(),
+        { audio: true, video: true },
+        "expected microphone and camera to be shared"
+      );
+
+      // close all streams
+      await closeStream();
+    },
+  },
 ];
 
 add_task(async function test() {
   await runTests(gTests);
 });