Bug 1444007 - Remove race condition in browser_devices_get_user_media_multi_process.js. r?arai draft
authorDão Gottwald <dao@mozilla.com>
Thu, 22 Mar 2018 12:06:24 +0100
changeset 771097 ec3a3ecfa4088859e510ba4e844b88720e57bf20
parent 771093 7771df14ea181add1dc4133f0f5559bf620bf976
push id103556
push userdgottwald@mozilla.com
push dateThu, 22 Mar 2018 11:07:01 +0000
reviewersarai
bugs1444007
milestone61.0a1
Bug 1444007 - Remove race condition in browser_devices_get_user_media_multi_process.js. r?arai MozReview-Commit-ID: 8cvuI8a984p
browser/base/content/test/webrtc/browser_devices_get_user_media_multi_process.js
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_multi_process.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_multi_process.js
@@ -181,27 +181,26 @@ var gTests = [
 
     ok(webrtcUI.showGlobalIndicator, "webrtcUI wants the global indicator shown");
     ok(webrtcUI.showCameraIndicator, "webrtcUI wants the camera indicator shown");
     ok(!webrtcUI.showMicrophoneIndicator, "webrtcUI wants the mic indicator hidden");
     is(webrtcUI.getActiveStreams(true).length, 2, "2 active camera streams");
     is(webrtcUI.getActiveStreams(true, true, true).length, 2, "2 active streams");
 
     info("removing the second tab");
-    // FIXME: This should wait for indicator update instead (bug 1444007).
-    let sessionStorePromise = BrowserTestUtils.waitForSessionStoreUpdate(tab);
     BrowserTestUtils.removeTab(tab);
-    await sessionStorePromise;
 
     // Check that we still show the sharing indicators for the first tab's stream.
-    await TestUtils.waitForCondition(() => webrtcUI.showCameraIndicator);
+    await Promise.all([
+      TestUtils.waitForCondition(() => webrtcUI.showCameraIndicator),
+      TestUtils.waitForCondition(() => webrtcUI.getActiveStreams(true).length == 1),
+    ]);
     ok(webrtcUI.showGlobalIndicator, "webrtcUI wants the global indicator shown");
     ok(webrtcUI.showCameraIndicator, "webrtcUI wants the camera indicator shown");
     ok(!webrtcUI.showMicrophoneIndicator, "webrtcUI wants the mic indicator hidden");
-    is(webrtcUI.getActiveStreams(true).length, 1, "1 active camera stream");
     is(webrtcUI.getActiveStreams(true, true, true).length, 1, "1 active stream");
 
     await checkSharingUI({video: true});
 
     // When both tabs use the same content process, the frame script for the
     // first tab receives observer notifications for things happening in the
     // second tab, so let's clear the observer call counts before we cleanup
     // in the first tab.