Bug 1017329 - send a test message through data channel in reverse direction. r=whimboo
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Thu, 29 May 2014 00:29:00 +0200
changeset 198717 4fab17966aed62a27741e926ef08b499909ea25a
parent 198716 98b14328c39acb47ab4138d62cfb7677ad08cf13
child 198718 1137d4bcc40a9fd957bfa1c24fa6b71ea865d42b
push id5990
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:40:24 +0000
treeherdermozilla-aurora@0796197efbc9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1017329
milestone32.0a1
Bug 1017329 - send a test message through data channel in reverse direction. r=whimboo
dom/media/tests/mochitest/templates.js
--- a/dom/media/tests/mochitest/templates.js
+++ b/dom/media/tests/mochitest/templates.js
@@ -546,33 +546,51 @@ var commandsDataChannel = [
         is(test.pcRemote.dataChannels.indexOf(channel), 0, "1st channel used");
         is(data, message, "Received message has the correct content.");
 
         test.next();
       }, options);
     }
   ],
   [
+    'SEND_MESSAGE_BACK_THROUGH_FIRST_CHANNEL',
+    function (test) {
+      var message = "Return a message also through 1st channel";
+      var options = {
+        sourceChannel: test.pcRemote.dataChannels[0],
+        targetChannel: test.pcLocal.dataChannels[0]
+      };
+
+      test.send(message, function (channel, data) {
+        is(test.pcLocal.dataChannels.indexOf(channel), 0, "1st channel used");
+        is(data, message, "Return message has the correct content.");
+
+        test.next();
+      }, options);
+    }
+  ],
+  [
     'CREATE_NEGOTIATED_DATA_CHANNEL',
     function (test) {
       var options = {negotiated:true, id: 5, protocol:"foo/bar", ordered:false,
-		     maxRetransmits:500};
+        maxRetransmits:500};
       test.createDataChannel(options, function (sourceChannel2, targetChannel2) {
         is(sourceChannel2.readyState, "open", sourceChannel2 + " is in state: 'open'");
         is(targetChannel2.readyState, "open", targetChannel2 + " is in state: 'open'");
 
         is(targetChannel2.binaryType, "blob", targetChannel2 + " is of binary type 'blob'");
         is(targetChannel2.readyState, "open", targetChannel2 + " is in state: 'open'");
 
         if (options.id != undefined) {
           is(sourceChannel2.id, options.id, sourceChannel2 + " id is:" + sourceChannel2.id);
-	} else {
-	  options.id = sourceChannel2.id;
-	}
-	var reliable = !options.ordered ? false : (options.maxRetransmits || options.maxRetransmitTime);
+        }
+        else {
+          options.id = sourceChannel2.id;
+        }
+        var reliable = !options.ordered ? false : (options.maxRetransmits || options.maxRetransmitTime);
         is(sourceChannel2.protocol, options.protocol, sourceChannel2 + " protocol is:" + sourceChannel2.protocol);
         is(sourceChannel2.reliable, reliable, sourceChannel2 + " reliable is:" + sourceChannel2.reliable);
 /*
   These aren't exposed by IDL yet
         is(sourceChannel2.ordered, options.ordered, sourceChannel2 + " ordered is:" + sourceChannel2.ordered);
         is(sourceChannel2.maxRetransmits, options.maxRetransmits, sourceChannel2 + " maxRetransmits is:" +
 	   sourceChannel2.maxRetransmits);
         is(sourceChannel2.maxRetransmitTime, options.maxRetransmitTime, sourceChannel2 + " maxRetransmitTime is:" +