Bug 1312234 - Wait for gUM capture messages when tearing off a tab. r?florian draft
authorAndreas Pehrson <pehrsons@gmail.com>
Mon, 24 Oct 2016 16:25:27 +0200
changeset 428670 3849d81fa8ea53833a681af5190d1cf2d88a31b2
parent 428476 215f9686117673a2c914ed207bc7da9bb8d741ad
child 534807 a2b66e0eb00e2e089bf624e0b8f07c808a65b386
push id33389
push userbmo:pehrson@telenordigital.com
push dateMon, 24 Oct 2016 14:26:45 +0000
reviewersflorian
bugs1312234
milestone52.0a1
Bug 1312234 - Wait for gUM capture messages when tearing off a tab. r?florian MozReview-Commit-ID: CaCt5C1whHw
browser/base/content/test/webrtc/browser_devices_get_user_media_tear_off_tab.js
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_tear_off_tab.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_tear_off_tab.js
@@ -44,20 +44,22 @@ var gTests = [
     ok(gIdentityHandler._identityPopup.hidden,
        "control center should be hidden in the first window");
     win.gIdentityHandler._identityPopup.hidden = true;
 
     // Closing the new window should remove all sharing indicators.
     // We need to load the content script in the first window so that we can
     // catch the notifications fired globally when closing the second window.
     gBrowser.selectedBrowser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
-    yield BrowserTestUtils.closeWindow(win);
 
-    yield expectObserverCalled("recording-window-ended");
-    yield expectObserverCalled("recording-device-events");
+    let promises = [promiseObserverCalled("recording-device-events"),
+                    promiseObserverCalled("recording-window-ended")];
+    yield BrowserTestUtils.closeWindow(win);
+    yield Promise.all(promises);
+
     yield expectNoObserverCalled();
     yield checkNotSharing();
   }
 }
 
 ];
 
 function test() {