Bug 1365081: added data channel test function for maxPacketLifeTime. r?jesup draft
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Mon, 15 May 2017 18:22:27 -0700
changeset 578189 1141adf5b0f0f43233b60774d40880785b16f75d
parent 578188 e71e3365324dbee97001f0173b54d3199c2cfa58
child 628720 e0eabdf0154e0eef4b41aba6dcfb26be76d22017
push id58926
push userdrno@ohlmeier.org
push dateTue, 16 May 2017 02:45:15 +0000
reviewersjesup
bugs1365081
milestone55.0a1
Bug 1365081: added data channel test function for maxPacketLifeTime. r?jesup MozReview-Commit-ID: KXSvIxBcLMB
dom/media/tests/mochitest/dataChannel.js
--- a/dom/media/tests/mochitest/dataChannel.js
+++ b/dom/media/tests/mochitest/dataChannel.js
@@ -160,16 +160,42 @@ var commandsCheckDataChannel = [
   function SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL2(test) {
     var channels = test.pcRemote.dataChannels;
     var message = "I am the walrus; Goo goo g'joob";
 
     return test.send(message).then(result => {
       is(channels.indexOf(result.channel), channels.length - 1, "Last channel used");
       is(result.data, message, "Received message has the correct content.");
     });
+  },
+
+  function CREATE_NEGOTIATED_MAXPACKET_LIFE_DATA_CHANNEL(test) {
+    var options = {
+      ordered: false,
+      maxPacketLifeTime: 10
+    };
+    return test.createDataChannel(options).then(result => {
+      var sourceChannel3 = result.local;
+      var targetChannel3 = result.remote;
+      is(sourceChannel3.readyState, "open", sourceChannel3 + " is in state: 'open'");
+      is(targetChannel3.readyState, "open", targetChannel3 + " is in state: 'open'");
+
+      is(targetChannel3.binaryType, "blob", targetChannel3 + " is of binary type 'blob'");
+
+    });
+  },
+
+  function SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL3(test) {
+    var channels = test.pcRemote.dataChannels;
+    var message = "Nice to see you working maxPacketLifeTime";
+
+    return test.send(message).then(result => {
+      is(channels.indexOf(result.channel), channels.length - 1, "Last channel used");
+      is(result.data, message, "Received message has the correct content.");
+    });
   }
 ];
 
 var commandsCheckLargeXfer = [
   function SEND_BIG_BUFFER(test) {
     var size = 512*1024; // SCTP internal buffer is 256K, so we'll have ~256K queued
     var buffer = new ArrayBuffer(size);
     // note: type received is always blob for binary data