Bug 1504336 - Avoid race in test_pc_simulcastOddResolution.html. r=jib, a=test-only
authorAndreas Pehrson <apehrson@mozilla.com>
Tue, 26 Mar 2019 08:36:13 +0000
changeset 525770 8f40010937b5e862caf30954caf17444709b38bb
parent 525769 e221b428f081392adf3d082122dfafac86246125
child 525771 3c19646ca2d05508dddd236d6ada2611eeecbcad
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib, test-only
bugs1504336
milestone67.0
Bug 1504336 - Avoid race in test_pc_simulcastOddResolution.html. r=jib, a=test-only Differential Revision: https://phabricator.services.mozilla.com/D24725
dom/media/tests/mochitest/test_peerConnection_simulcastOddResolution.html
--- a/dom/media/tests/mochitest/test_peerConnection_simulcastOddResolution.html
+++ b/dom/media/tests/mochitest/test_peerConnection_simulcastOddResolution.html
@@ -40,16 +40,25 @@
     await Promise.all([
         haveEvent(test.pcRemote.localMediaElements[0], "resize"),
         haveEvent(test.pcLocal.remoteMediaElements[0], "resize"),
     ]);
     emitter.stop();
     info("Source resolution changed");
   }
 
+  async function setParameters(test, emitter, encodings) {
+    info(`Setting parameters to ${JSON.stringify(encodings)}`);
+    emitter.start();
+    await test.pcRemote._pc.getSenders()[0].setParameters({encodings});
+    await haveEvent(test.pcLocal.remoteMediaElements[0], "resize");
+    emitter.stop();
+		info("Parameters set");
+	}
+
   async function checkResolution(test, emitter, rid) {
     const vlocal = test.pcRemote.localMediaElements[0];
     const vremote = test.pcLocal.remoteMediaElements[0];
 
     info(`Changing to rid ${rid}`);
     selectRecvRID(test.pcLocal, rid);
     emitter.start();
     await haveEvent(vremote, "resize");
@@ -167,17 +176,17 @@
       async function PC_LOCAL_CHANGE_SRC_1() {
         await changeSourceResolution(test, emitter, 1280, 720);
         await checkResolutions(test, emitter);
       },
       async function PC_LOCAL_CHANGE_PARAMS_2() {
         encodings.find(({rid}) => rid == "foo").scaleResolutionDownBy = 1;
         encodings.find(({rid}) => rid == "bar").scaleResolutionDownBy = 2;
         encodings.find(({rid}) => rid == "baz").scaleResolutionDownBy = 3;
-        await test.pcRemote._pc.getSenders()[0].setParameters({encodings});
+        await setParameters(test, emitter, encodings);
         await checkResolutions(test, emitter);
       },
     ]);
 
     await test.run();
   });
 </script>
 </pre>