Bug 1359854 - Added test with b=TIAS. r=jesup, a=test-only
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Thu, 11 May 2017 21:01:48 -0700
changeset 396284 b8325c15c21de77ad6291567ab0224b7049fd681
parent 396283 241a875b457fd4164cfe96f57865dd0969f20909
child 396285 0249a50983444d2257882f7b0e781d449216e262
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, test-only
bugs1359854
milestone54.0
Bug 1359854 - Added test with b=TIAS. r=jesup, a=test-only MozReview-Commit-ID: 5xFTFVkO7AZ
dom/media/tests/mochitest/mochitest.ini
dom/media/tests/mochitest/sdpUtils.js
dom/media/tests/mochitest/test_peerConnection_restrictBandwidthWithTias.html
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -232,16 +232,18 @@ skip-if = (android_version == '18') # em
 [test_peerConnection_answererAddSecondAudioStream.html]
 skip-if = (android_version == '18') # emulator is too slow to finish a renegotiation test in under 5 minutes
 [test_peerConnection_removeAudioTrack.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_removeThenAddAudioTrack.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_addSecondVideoStream.html]
 skip-if = android_version == '18' # android(Bug 1189784, timeouts on 4.3 emulator)
+[test_peerConnection_restrictBandwidthWithTias.html]
+skip-if = android_version == '18' # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_removeVideoTrack.html]
 skip-if = (android_version == '18' && debug) # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_removeThenAddVideoTrack.html]
 skip-if = (android_version == '18' && debug) # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_replaceVideoThenRenegotiate.html]
 skip-if = (android_version == '18' && debug) # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_addSecondAudioStreamNoBundle.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
--- a/dom/media/tests/mochitest/sdpUtils.js
+++ b/dom/media/tests/mochitest/sdpUtils.js
@@ -65,16 +65,20 @@ setAllMsectionsInactive: function(sdp) {
 removeAllRtpMaps: function(sdp) {
   return sdp.replace(/a=rtpmap:.*\r\n/g, "");
 },
 
 reduceAudioMLineToDynamicPtAndOpus: function(sdp) {
   return sdp.replace(/m=audio .*\r\n/g, "m=audio 9 UDP/TLS/RTP/SAVPF 101 109\r\n");
 },
 
+addTiasBps: function(sdp, bps) {
+  return sdp.replace(/c=IN (.*)\r\n/g, "c=IN $1\r\nb=TIAS:" + bps + "\r\n");
+},
+
 transferSimulcastProperties: function(offer_sdp, answer_sdp) {
   if (!offer_sdp.includes("a=simulcast:")) {
     return answer_sdp;
   }
   ok(offer_sdp.includes("a=simulcast: send rid"), "Offer contains simulcast attribute");
   var o_simul = offer_sdp.match(/simulcast: send rid=(.*)([\n$])*/i);
   var new_answer_sdp = answer_sdp + "a=simulcast: recv rid=" + o_simul[1] + "\r\n";
   ok(offer_sdp.includes("a=rid:"), "Offer contains RID attribute");
copy from dom/media/tests/mochitest/test_peerConnection_basicVideo.html
copy to dom/media/tests/mochitest/test_peerConnection_restrictBandwidthWithTias.html
--- a/dom/media/tests/mochitest/test_peerConnection_basicVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_restrictBandwidthWithTias.html
@@ -2,22 +2,30 @@
 <html>
 <head>
   <script type="application/javascript" src="pc.js"></script>
 </head>
 <body>
 <pre id="test">
 <script type="application/javascript">
   createHTML({
-    bug: "796888",
-    title: "Basic video-only peer connection"
+    bug: "1359854",
+    title: "500Kb restricted video-only peer connection"
   });
 
   var test;
   runNetworkTest(function (options) {
     test = new PeerConnectionTest(options);
     test.setMediaConstraints([{video: true}], [{video: true}]);
+    test.chain.insertAfter('PC_REMOTE_GET_OFFER', [
+      function PC_REMOTE_ADD_TIAS(test) {
+        test._local_offer.sdp = sdputils.addTiasBps(
+          test._local_offer.sdp, 250000);
+        info("Offer with TIAS: " + JSON.stringify(test._local_offer));
+      }
+    ]);
+    // TODO it would be nice to verify the used bandwidth
     test.run();
   });
 </script>
 </pre>
 </body>
 </html>